@homebridge-plugins/homebridge-sharkiq 2.0.0-beta.2 → 2.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -2
- package/README.md +41 -4
- package/config.schema.json +8 -26
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/devices/BaseMatterAccessory.d.ts +63 -0
- package/dist/devices/BaseMatterAccessory.d.ts.map +1 -0
- package/dist/devices/BaseMatterAccessory.js +100 -0
- package/dist/devices/BaseMatterAccessory.js.map +1 -0
- package/dist/devices/RoboticVacuumAccessory.d.ts +67 -0
- package/dist/devices/RoboticVacuumAccessory.d.ts.map +1 -0
- package/dist/devices/RoboticVacuumAccessory.js +649 -0
- package/dist/devices/RoboticVacuumAccessory.js.map +1 -0
- package/dist/devices/index.d.ts +9 -0
- package/dist/devices/index.d.ts.map +1 -0
- package/dist/devices/index.js +8 -0
- package/dist/devices/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +39 -16
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +195 -92
- package/dist/platform.js.map +1 -1
- package/dist/sharkiq-js/room_encoding.d.ts +8 -0
- package/dist/sharkiq-js/room_encoding.d.ts.map +1 -0
- package/dist/sharkiq-js/room_encoding.js +35 -0
- package/dist/sharkiq-js/room_encoding.js.map +1 -0
- package/dist/sharkiq-js/sharkiq.d.ts.map +1 -1
- package/dist/sharkiq-js/sharkiq.js +2 -20
- package/dist/sharkiq-js/sharkiq.js.map +1 -1
- package/docs/assets/highlight.css +9 -2
- package/docs/index.html +35 -3
- package/docs/variables/default.html +2 -1
- package/package.json +3 -3
- package/test/context.spec.ts +33 -0
- package/test/encodeRoomList.spec.ts +25 -0
- package/test/polling.spec.ts +74 -0
- package/dist/errorHandling.d.ts +0 -19
- package/dist/errorHandling.d.ts.map +0 -1
- package/dist/errorHandling.js +0 -27
- package/dist/errorHandling.js.map +0 -1
- package/dist/platformAccessory.d.ts +0 -33
- package/dist/platformAccessory.d.ts.map +0 -1
- package/dist/platformAccessory.js +0 -384
- package/dist/platformAccessory.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/)
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [2.0.0] (https://github.com/homebridge-plugins/homebridge-sharkiq/releases/tag/v2.0.0) (2025-XX-XX)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
- This release is Matter-only. The plugin now publishes external Matter Robotic Vacuum Cleaner accessories and no longer publishes HAP platform accessories. If you need the legacy HAP behavior, continue using a pre-2.0 release or a branch that preserves the HAP path.
|
|
9
|
+
- Minimum required Homebridge: >= 2.0.0-alpha.28 (or later) with Matter support exposed via `api.matter`.
|
|
10
|
+
|
|
11
|
+
### What's Changed
|
|
12
|
+
- Converted plugin to Matter-only and added Matter external accessory publishing for Robotic Vacuum Cleaner devices.
|
|
13
|
+
- Added lifecycle wiring so accessories wait for READY before initial sync and polling.
|
|
14
|
+
- Added retry/backoff for critical Ayla API calls.
|
|
15
|
+
- Removed HAP-specific configuration options (invertDockedStatus, dockedUpdateInterval, enhancedVacuumMode).
|
|
16
|
+
|
|
17
|
+
**Full Changelog**: https://github.com/homebridge-plugins/homebridge-sharkiq/compare/v1.4.1...v2.0.0
|
|
18
|
+
|
|
19
|
+
## [1.4.1] (https://github.com/homebridge-plugins/homebridge-sharkiq/releases/tag/v1.4.1) (2025-XX-XX)
|
|
6
20
|
|
|
7
21
|
### What's Changed
|
|
8
22
|
- Fix ARM64 OAuth code handling for users with both email/password and OAuth code [#54](https://github.com/homebridge-plugins/homebridge-sharkiq/issues/54)
|
|
9
23
|
|
|
24
|
+
**Full Changelog**: https://github.com/homebridge-plugins/homebridge-sharkiq/compare/v1.4.0...v1.4.1
|
|
25
|
+
|
|
10
26
|
## [1.4.0](https://github.com/homebridge-plugins/homebridge-sharkiq/releases/tag/v1.4.0) (2025-07-17)
|
|
11
27
|
|
|
12
28
|
### What's Changes
|
|
@@ -14,4 +30,5 @@ All notable changes to this project will be documented in this file. This projec
|
|
|
14
30
|
- Fix JSON parsing errors in SharkIQ API responses [#44](https://github.com/homebridge-plugins/homebridge-sharkiq/pull/44) [@mmenanno](https://github.com/mmenanno)
|
|
15
31
|
- Housekeeping and updated dependencies.
|
|
16
32
|
|
|
17
|
-
**Full Changelog**: https://github.com/homebridge-plugins/homebridge-sharkiq/compare/v1.3.2...v1.4.0
|
|
33
|
+
**Full Changelog**: https://github.com/homebridge-plugins/homebridge-sharkiq/compare/v1.3.2...v1.4.0
|
|
34
|
+
|
package/README.md
CHANGED
|
@@ -39,10 +39,7 @@ Configure Homebridge. The config file for SharkIQ should include:
|
|
|
39
39
|
"[Shark Vacuum DSN]",
|
|
40
40
|
"..."
|
|
41
41
|
],
|
|
42
|
-
"europe": false
|
|
43
|
-
"invertDockedStatus": false,
|
|
44
|
-
"dockedUpdateInterval": 30000,
|
|
45
|
-
"enhancedVacuumMode": true
|
|
42
|
+
"europe": false
|
|
46
43
|
}
|
|
47
44
|
]
|
|
48
45
|
}
|
|
@@ -78,6 +75,15 @@ The `enhancedVacuumMode` option (enabled by default) provides improved vacuum be
|
|
|
78
75
|
|
|
79
76
|
## Homebridge 2.0.0+ Compatibility
|
|
80
77
|
|
|
78
|
+
This release of the plugin is Matter-only and requires a Homebridge runtime that exposes the Matter API.
|
|
79
|
+
Minimum tested Homebridge: 2.0.0-alpha.28 or later. If your Homebridge installation does not support Matter, this plugin will log an error and will not start.
|
|
80
|
+
|
|
81
|
+
This plugin uses Matter external accessories (Robotic Vacuum Cleaner) to integrate with the platform and no longer publishes HAP platform accessories.
|
|
82
|
+
|
|
83
|
+
If you rely on the legacy HAP (HomeKit) path, keep using an older plugin release or run this code from a separate branch — this release intentionally removes HAP fallback.
|
|
84
|
+
|
|
85
|
+
Compatibility notes and behavior:
|
|
86
|
+
|
|
81
87
|
This plugin is compatible with Homebridge 2.0.0-alpha.28 and later versions, providing enhanced vacuum functionality while maintaining compatibility with current HomeKit limitations:
|
|
82
88
|
|
|
83
89
|
- **Current Implementation**: Uses optimized FanV2 service with vacuum-specific behavior
|
|
@@ -109,3 +115,34 @@ Contributions would be very helpful to help this Homebridge plugin stay maintain
|
|
|
109
115
|
## Useful Links
|
|
110
116
|
|
|
111
117
|
- [SharkIQ Python](https://github.com/JeffResc/sharkiq/)
|
|
118
|
+
|
|
119
|
+
## Integration checklist — Matter
|
|
120
|
+
|
|
121
|
+
Follow these steps to verify Matter integration locally on a Homebridge instance that supports Matter (Homebridge >= 2.0.0-alpha.28):
|
|
122
|
+
|
|
123
|
+
1. Ensure your Homebridge runtime supports Matter and the `api.matter` external accessory API.
|
|
124
|
+
2. Configure the plugin in `config.json` with your Shark credentials or `oAuthCode` and do NOT include deprecated HAP-only options (the plugin is Matter-only).
|
|
125
|
+
3. Start Homebridge in a terminal and watch logs. You should see the plugin log the DSNs found on your account and then a "Publishing X robotic device(s) as external Matter accessories" message.
|
|
126
|
+
4. After publishing, Homebridge should emit READY/COMMISSIONED events for each accessory. The plugin will perform an initial sync and start polling.
|
|
127
|
+
5. From the Home app or a Matter controller, attempt these actions and verify the vacuum responds:
|
|
128
|
+
|
|
129
|
+
- Start / Stop cleaning
|
|
130
|
+
- Pause / Resume
|
|
131
|
+
- Go Home (return to dock)
|
|
132
|
+
- Select Areas (if your device supports area cleaning)
|
|
133
|
+
|
|
134
|
+
6. Observe plugin logs for successful API calls and state updates. Look for `Matter accessory ready` and `Performing initial device sync` log lines.
|
|
135
|
+
|
|
136
|
+
Quick troubleshooting:
|
|
137
|
+
|
|
138
|
+
- If you see "requires Homebridge with Matter support" in logs, update Homebridge to a Matter-enabled build.
|
|
139
|
+
- If actions fail, inspect network connectivity and plugin logs for Ayla API errors; the plugin now includes retries with exponential backoff for critical calls.
|
|
140
|
+
|
|
141
|
+
Optional: run the prepublish checks locally (lint, build, docs) to validate everything before publishing:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Run this in the project root (macOS / zsh)
|
|
145
|
+
npm run prepublishOnly
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If you'd like, I can add a short automated script that validates a sample run (requires a Matter-enabled Homebridge instance and credentials).
|
package/config.schema.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vacuums": {
|
|
31
31
|
"title": "SharkClean Vacuum Devicess",
|
|
32
32
|
"type": "array",
|
|
33
|
-
"required":
|
|
33
|
+
"required": false,
|
|
34
34
|
"items": {
|
|
35
35
|
"title": "SharkClean DSN",
|
|
36
36
|
"type": "string"
|
|
@@ -43,25 +43,14 @@
|
|
|
43
43
|
"required": false,
|
|
44
44
|
"default": false
|
|
45
45
|
},
|
|
46
|
-
"
|
|
47
|
-
"title": "
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"default": false
|
|
51
|
-
},
|
|
52
|
-
"dockedUpdateInterval": {
|
|
53
|
-
"title": "Docked Update Interval",
|
|
54
|
-
"type": "integer",
|
|
46
|
+
"pollInterval": {
|
|
47
|
+
"title": "Polling interval (seconds)",
|
|
48
|
+
"description": "How often to poll Shark devices for status updates. Set to 0 to disable polling.",
|
|
49
|
+
"type": "number",
|
|
55
50
|
"required": false,
|
|
56
|
-
"default":
|
|
57
|
-
},
|
|
58
|
-
"enhancedVacuumMode": {
|
|
59
|
-
"title": "Enhanced Vacuum Mode",
|
|
60
|
-
"type": "boolean",
|
|
61
|
-
"required": false,
|
|
62
|
-
"default": true,
|
|
63
|
-
"description": "Use improved power level mappings and vacuum-optimized behavior. Prepares for future robot vacuum service support."
|
|
51
|
+
"default": 30
|
|
64
52
|
}
|
|
53
|
+
|
|
65
54
|
}
|
|
66
55
|
},
|
|
67
56
|
"layout": [
|
|
@@ -113,14 +102,7 @@
|
|
|
113
102
|
}
|
|
114
103
|
]
|
|
115
104
|
},
|
|
116
|
-
"europe"
|
|
117
|
-
"invertDockedStatus",
|
|
118
|
-
"dockedUpdateInterval",
|
|
119
|
-
{
|
|
120
|
-
"type": "help",
|
|
121
|
-
"helpvalue": "<h5>Enhanced Vacuum Mode</h5><em class='primary-text'>Enables improved vacuum behavior with better power level mappings (25%=Eco, 50%=Normal, 100%=Max). This prepares your setup for future native HomeKit robot vacuum support.</em>"
|
|
122
|
-
},
|
|
123
|
-
"enhancedVacuumMode"
|
|
105
|
+
"europe"
|
|
124
106
|
]
|
|
125
107
|
}
|
|
126
108
|
]
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;CAKhB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAA;AAEV,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAA"}
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,GAAG,EAAE,EAAE;CACC,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,GAAG,EAAE,EAAE;CACC,CAAA;AAEV,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,mBAAmB,EAAE,GAAG;IACxB,8BAA8B,EAAE,IAAI;IACpC,uBAAuB,EAAE,GAAG;CACpB,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Matter Accessory Class
|
|
3
|
+
*
|
|
4
|
+
* This base class implements the MatterAccessory interface and provides
|
|
5
|
+
* common functionality that all Matter devices can use.
|
|
6
|
+
*
|
|
7
|
+
* Individual device types should extend this class and call super() with
|
|
8
|
+
* the required configuration.
|
|
9
|
+
*/
|
|
10
|
+
import type { API, EndpointType, Logger, MatterAccessory } from 'homebridge';
|
|
11
|
+
export interface BaseMatterAccessoryConfig {
|
|
12
|
+
uuid: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
deviceType: EndpointType;
|
|
15
|
+
serialNumber: string;
|
|
16
|
+
manufacturer: string;
|
|
17
|
+
model: string;
|
|
18
|
+
firmwareRevision: string;
|
|
19
|
+
hardwareRevision: string;
|
|
20
|
+
context?: Record<string, unknown>;
|
|
21
|
+
clusters?: MatterAccessory['clusters'];
|
|
22
|
+
handlers?: MatterAccessory['handlers'];
|
|
23
|
+
parts?: MatterAccessory['parts'];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Base class for all Matter accessories
|
|
27
|
+
* Implements the MatterAccessory interface and provides common methods
|
|
28
|
+
*/
|
|
29
|
+
export declare abstract class BaseMatterAccessory implements MatterAccessory {
|
|
30
|
+
readonly uuid: string;
|
|
31
|
+
readonly displayName: string;
|
|
32
|
+
readonly deviceType: EndpointType;
|
|
33
|
+
readonly serialNumber: string;
|
|
34
|
+
readonly manufacturer: string;
|
|
35
|
+
readonly model: string;
|
|
36
|
+
readonly firmwareRevision: string;
|
|
37
|
+
readonly hardwareRevision: string;
|
|
38
|
+
readonly context: Record<string, unknown>;
|
|
39
|
+
readonly clusters?: MatterAccessory['clusters'];
|
|
40
|
+
readonly handlers?: MatterAccessory['handlers'];
|
|
41
|
+
readonly parts?: MatterAccessory['parts'];
|
|
42
|
+
protected readonly api: API;
|
|
43
|
+
protected readonly log: Logger;
|
|
44
|
+
constructor(api: API, log: Logger, config: BaseMatterAccessoryConfig);
|
|
45
|
+
/**
|
|
46
|
+
* Update the accessory state
|
|
47
|
+
* Helper method to update cluster attributes
|
|
48
|
+
*/
|
|
49
|
+
protected updateState(cluster: string, attributes: Record<string, unknown>): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Log helper methods
|
|
52
|
+
*/
|
|
53
|
+
protected logInfo(message: string, ...args: unknown[]): void;
|
|
54
|
+
protected logError(message: string, ...args: unknown[]): void;
|
|
55
|
+
protected logDebug(message: string, ...args: unknown[]): void;
|
|
56
|
+
protected logWarn(message: string, ...args: unknown[]): void;
|
|
57
|
+
/**
|
|
58
|
+
* Convert this class instance to a plain MatterAccessory object
|
|
59
|
+
* This is what gets registered with Homebridge
|
|
60
|
+
*/
|
|
61
|
+
toAccessory(): MatterAccessory;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=BaseMatterAccessory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMatterAccessory.d.ts","sourceRoot":"","sources":["../../src/devices/BaseMatterAccessory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5E,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,YAAY,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,MAAM,CA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C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI5D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI7D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI7D,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI5D;;;OAGG;IACI,WAAW,IAAI,eAAe;CAgBtC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Matter Accessory Class
|
|
3
|
+
*
|
|
4
|
+
* This base class implements the MatterAccessory interface and provides
|
|
5
|
+
* common functionality that all Matter devices can use.
|
|
6
|
+
*
|
|
7
|
+
* Individual device types should extend this class and call super() with
|
|
8
|
+
* the required configuration.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Base class for all Matter accessories
|
|
12
|
+
* Implements the MatterAccessory interface and provides common methods
|
|
13
|
+
*/
|
|
14
|
+
export class BaseMatterAccessory {
|
|
15
|
+
// Required MatterAccessory properties
|
|
16
|
+
uuid;
|
|
17
|
+
displayName;
|
|
18
|
+
deviceType;
|
|
19
|
+
serialNumber;
|
|
20
|
+
manufacturer;
|
|
21
|
+
model;
|
|
22
|
+
firmwareRevision;
|
|
23
|
+
hardwareRevision;
|
|
24
|
+
context;
|
|
25
|
+
clusters;
|
|
26
|
+
handlers;
|
|
27
|
+
parts;
|
|
28
|
+
// Protected properties available to child classes
|
|
29
|
+
api;
|
|
30
|
+
log;
|
|
31
|
+
constructor(api, log, config) {
|
|
32
|
+
this.api = api;
|
|
33
|
+
this.log = log;
|
|
34
|
+
// Set all required properties
|
|
35
|
+
this.uuid = config.uuid;
|
|
36
|
+
this.displayName = config.displayName;
|
|
37
|
+
this.deviceType = config.deviceType;
|
|
38
|
+
this.serialNumber = config.serialNumber;
|
|
39
|
+
this.manufacturer = config.manufacturer;
|
|
40
|
+
this.model = config.model;
|
|
41
|
+
this.firmwareRevision = config.firmwareRevision;
|
|
42
|
+
this.hardwareRevision = config.hardwareRevision;
|
|
43
|
+
this.clusters = config.clusters;
|
|
44
|
+
this.handlers = config.handlers;
|
|
45
|
+
this.parts = config.parts;
|
|
46
|
+
// Set context with all metadata
|
|
47
|
+
this.context = {
|
|
48
|
+
serialNumber: this.serialNumber,
|
|
49
|
+
manufacturer: this.manufacturer,
|
|
50
|
+
model: this.model,
|
|
51
|
+
firmwareRevision: this.firmwareRevision,
|
|
52
|
+
hardwareRevision: this.hardwareRevision,
|
|
53
|
+
...config.context,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Update the accessory state
|
|
58
|
+
* Helper method to update cluster attributes
|
|
59
|
+
*/
|
|
60
|
+
async updateState(cluster, attributes) {
|
|
61
|
+
await this.api.matter.updateAccessoryState(this.uuid, cluster, attributes);
|
|
62
|
+
this.log.debug(`[${this.displayName}] Updated ${cluster} state:`, attributes);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Log helper methods
|
|
66
|
+
*/
|
|
67
|
+
logInfo(message, ...args) {
|
|
68
|
+
this.log.info(`[${this.displayName}] ${message}`, ...args);
|
|
69
|
+
}
|
|
70
|
+
logError(message, ...args) {
|
|
71
|
+
this.log.error(`[${this.displayName}] ${message}`, ...args);
|
|
72
|
+
}
|
|
73
|
+
logDebug(message, ...args) {
|
|
74
|
+
this.log.debug(`[${this.displayName}] ${message}`, ...args);
|
|
75
|
+
}
|
|
76
|
+
logWarn(message, ...args) {
|
|
77
|
+
this.log.warn(`[${this.displayName}] ${message}`, ...args);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Convert this class instance to a plain MatterAccessory object
|
|
81
|
+
* This is what gets registered with Homebridge
|
|
82
|
+
*/
|
|
83
|
+
toAccessory() {
|
|
84
|
+
return {
|
|
85
|
+
uuid: this.uuid,
|
|
86
|
+
displayName: this.displayName,
|
|
87
|
+
deviceType: this.deviceType,
|
|
88
|
+
serialNumber: this.serialNumber,
|
|
89
|
+
manufacturer: this.manufacturer,
|
|
90
|
+
model: this.model,
|
|
91
|
+
firmwareRevision: this.firmwareRevision,
|
|
92
|
+
hardwareRevision: this.hardwareRevision,
|
|
93
|
+
context: this.context,
|
|
94
|
+
clusters: this.clusters,
|
|
95
|
+
handlers: this.handlers,
|
|
96
|
+
parts: this.parts,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=BaseMatterAccessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMatterAccessory.js","sourceRoot":"","sources":["../../src/devices/BaseMatterAccessory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH;;;GAGG;AACH,MAAM,OAAgB,mBAAmB;IACvC,sCAAsC;IACtB,IAAI,CAAQ;IACZ,WAAW,CAAQ;IACnB,UAAU,CAAc;IACxB,YAAY,CAAQ;IACpB,YAAY,CAAQ;IACpB,KAAK,CAAQ;IACb,gBAAgB,CAAQ;IACxB,gBAAgB,CAAQ;IACxB,OAAO,CAAyB;IAChC,QAAQ,CAA8B;IACtC,QAAQ,CAA8B;IACtC,KAAK,CAA2B;IAEhD,kDAAkD;IAC/B,GAAG,CAAK;IACR,GAAG,CAAQ;IAE9B,YACE,GAAQ,EACR,GAAW,EACX,MAAiC;QAEjC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QAEd,8BAA8B;QAC9B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;QACrC,IAAI,CAAC,UAAU,GAA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CAAA;IAC5D,CAAC;IAES,QAAQ,CAAC,OAAe,EAAE,GAAG,IAAe;QACpD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;IAC7D,CAAC;IAES,QAAQ,CAAC,OAAe,EAAE,GAAG,IAAe;QACpD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;IAC7D,CAAC;IAES,OAAO,CAAC,OAAe,EAAE,GAAG,IAAe;QACnD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;IAC5D,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Robotic Vacuum Cleaner Accessory Class
|
|
3
|
+
*
|
|
4
|
+
* This is a comprehensive example demonstrating all available features
|
|
5
|
+
* of the RoboticVacuumCleaner device type including:
|
|
6
|
+
* - Multiple run modes (Idle, Cleaning, Mapping)
|
|
7
|
+
* - Multiple clean modes (Vacuum, Mop, Vacuum & Mop, Deep Clean)
|
|
8
|
+
* - Operational state management with realistic transitions
|
|
9
|
+
* - Service area (room) support
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: Platform Matter accessories
|
|
12
|
+
* =======================================
|
|
13
|
+
* This vacuum is registered as a platform accessory using
|
|
14
|
+
* api.matter.registerPlatformAccessories(), which works the same as HAP.
|
|
15
|
+
* Platform accessories are registered synchronously and are immediately ready for use.
|
|
16
|
+
*
|
|
17
|
+
* Demo behavior:
|
|
18
|
+
* - Start/Resume: Sets run mode to "Cleaning", runs for 15/10 seconds, then returns to dock
|
|
19
|
+
* - Return to dock: Immediately sets "Idle" mode, then Seeking (5s) → Charging (3s) → Docked
|
|
20
|
+
* - Stop: Immediately stops and resets to "Idle" mode
|
|
21
|
+
* - Pause: Cancels automatic completion timer, keeps "Cleaning" mode
|
|
22
|
+
*/
|
|
23
|
+
import type { API, Logger } from 'homebridge';
|
|
24
|
+
import type { SharkIqVacuum } from '../sharkiq-js/sharkiq.js';
|
|
25
|
+
import { BaseMatterAccessory } from './BaseMatterAccessory.js';
|
|
26
|
+
export declare class RoboticVacuumAccessory extends BaseMatterAccessory {
|
|
27
|
+
private activeTimers;
|
|
28
|
+
private readonly sharkDevice?;
|
|
29
|
+
private pollInterval?;
|
|
30
|
+
constructor(api: API, log: Logger, sharkDevice?: SharkIqVacuum, pollIntervalMs?: number);
|
|
31
|
+
private startPolling;
|
|
32
|
+
private stopPolling;
|
|
33
|
+
private buildServiceAreaCluster;
|
|
34
|
+
private handleChangeRunMode;
|
|
35
|
+
private handleChangeCleanMode;
|
|
36
|
+
private handlePause;
|
|
37
|
+
private handleStop;
|
|
38
|
+
private handleStart;
|
|
39
|
+
private handleResume;
|
|
40
|
+
private handleGoHome;
|
|
41
|
+
private handleSelectAreas;
|
|
42
|
+
private handleSkipArea;
|
|
43
|
+
/**
|
|
44
|
+
* Helper method to clear all active timers
|
|
45
|
+
*/
|
|
46
|
+
private clearTimers;
|
|
47
|
+
/**
|
|
48
|
+
* Helper method to initiate return to dock sequence
|
|
49
|
+
* Can be called synchronously from other handlers
|
|
50
|
+
*/
|
|
51
|
+
private returnToDock;
|
|
52
|
+
/**
|
|
53
|
+
* Update Methods - Use these to update the vacuum state from your API/device
|
|
54
|
+
*
|
|
55
|
+
* Since this is a platform accessory, state updates work immediately after registration.
|
|
56
|
+
*/
|
|
57
|
+
updateOperationalState(state: number): void;
|
|
58
|
+
updateRunMode(mode: number): void;
|
|
59
|
+
updateCleanMode(mode: number): void;
|
|
60
|
+
updateSelectedAreas(areaIds: number[]): void;
|
|
61
|
+
updateCurrentArea(areaId: number | null): void;
|
|
62
|
+
updateProgress(progress: Array<{
|
|
63
|
+
areaId: number;
|
|
64
|
+
status: number;
|
|
65
|
+
}>): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=RoboticVacuumAccessory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoboticVacuumAccessory.d.ts","sourceRoot":"","sources":["../../src/devices/RoboticVacuumAccessory.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAkB,MAAM,YAAY,CAAA;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAe;IAC5C,OAAO,CAAC,YAAY,CAAC,CAAgB;gBAEzB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,MAAM;IA2KvF,OAAO,CA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