@homebridge-plugins/homebridge-sharkiq 2.0.0-beta.1 → 2.0.0-beta.10

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/README.md +55 -3
  3. package/config.schema.json +3 -16
  4. package/dist/devices/RoboticVacuumAccessory.d.ts +36 -0
  5. package/dist/devices/RoboticVacuumAccessory.d.ts.map +1 -0
  6. package/dist/devices/RoboticVacuumAccessory.js +367 -0
  7. package/dist/devices/RoboticVacuumAccessory.js.map +1 -0
  8. package/dist/platform.d.ts +12 -0
  9. package/dist/platform.d.ts.map +1 -1
  10. package/dist/platform.js +160 -41
  11. package/dist/platform.js.map +1 -1
  12. package/dist/platformAccessory.d.ts +19 -1
  13. package/dist/platformAccessory.d.ts.map +1 -1
  14. package/dist/platformAccessory.js +326 -37
  15. package/dist/platformAccessory.js.map +1 -1
  16. package/dist/sharkiq-js/room_encoding.d.ts +8 -0
  17. package/dist/sharkiq-js/room_encoding.d.ts.map +1 -0
  18. package/dist/sharkiq-js/room_encoding.js +35 -0
  19. package/dist/sharkiq-js/room_encoding.js.map +1 -0
  20. package/dist/sharkiq-js/sharkiq.d.ts.map +1 -1
  21. package/dist/sharkiq-js/sharkiq.js +2 -20
  22. package/dist/sharkiq-js/sharkiq.js.map +1 -1
  23. package/docs/assets/highlight.css +9 -2
  24. package/docs/assets/main.js +5 -5
  25. package/docs/assets/navigation.js +1 -0
  26. package/docs/assets/search.js +1 -0
  27. package/docs/assets/style.css +251 -229
  28. package/docs/hierarchy.html +1 -0
  29. package/docs/index.html +56 -15
  30. package/docs/modules.html +1 -2
  31. package/docs/variables/default.html +1 -0
  32. package/package.json +15 -17
  33. package/test/encodeRoomList.spec.ts +25 -0
  34. package/typedoc.json +0 -4
  35. package/docs/assets/dmt/dmt-component-data.js +0 -1
  36. package/docs/assets/dmt/dmt-components.css +0 -20
  37. package/docs/assets/dmt/dmt-components.js +0 -67
  38. package/docs/assets/dmt/dmt-search.cmp +0 -0
  39. package/docs/assets/dmt/dmt-theme.css +0 -1
  40. package/docs/functions/default.html +0 -2
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
- ## [1.4.1] (TBD)
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,9 +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
42
+ "europe": false
45
43
  }
46
44
  ]
47
45
  }
@@ -63,6 +61,8 @@ If you are in Europe or the UK, set the `europe` config value to `true`. SharkCl
63
61
 
64
62
  The default interval between updating the docked status is 30 seconds (30000 ms). To change the docked status interval, add `dockedUpdateInterval` to your config. Value is in milliseconds. If the interval is too low, you have the risk of your account being rate limited.
65
63
 
64
+ The `enhancedVacuumMode` option (enabled by default) provides improved vacuum behavior with more intuitive power level mappings that prepare for future native HomeKit robot vacuum support. When enabled, power levels are: 25%=Eco, 50%=Normal, 100%=Max. When disabled, it uses legacy mappings: 30%=Eco, 60%=Normal, 90%=Max.
65
+
66
66
  ## Features
67
67
 
68
68
  - Be able to turn on and off the vacuum
@@ -71,6 +71,27 @@ The default interval between updating the docked status is 30 seconds (30000 ms)
71
71
  - The sensor will display as "opened" when the vacuum is docked and "closed" when the vacuum is not docked
72
72
  - Set `invertDockedStatus` to `true` to display as "closed" when the vacuum is docked and "opened" when the vacuum is not docked
73
73
  - Pause switch for pausing the vacuum while it's running
74
+ - **Enhanced Vacuum Mode** (new): Improved power level mappings and vacuum-optimized behavior that prepares for future native HomeKit robot vacuum support
75
+
76
+ ## Homebridge 2.0.0+ Compatibility
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
+
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:
88
+
89
+ - **Current Implementation**: Uses optimized FanV2 service with vacuum-specific behavior
90
+ - **Enhanced Mode**: Provides intuitive power levels (25%=Eco, 50%=Normal, 100%=Max) instead of arbitrary percentages
91
+ - **Future Ready**: Framework in place to detect native robot vacuum services when they become available in HomeKit/HAP-NodeJS
92
+ - **Backward Compatible**: Supports legacy mode for users who prefer the original 30%/60%/90% mappings
93
+
94
+ **Note**: As of Homebridge 2.0.0-alpha.28, the HomeKit AccessoryProtocol (HAP) specification does not yet include native robot vacuum services. Apple's iOS 18 robot vacuum support in the Home app uses private/undocumented services that are not available in the open-source HAP-NodeJS framework. This plugin will automatically adapt when public robot vacuum services become available.
74
95
 
75
96
  ### OAuth Code Login Method
76
97
 
@@ -94,3 +115,34 @@ Contributions would be very helpful to help this Homebridge plugin stay maintain
94
115
  ## Useful Links
95
116
 
96
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).
@@ -30,7 +30,7 @@
30
30
  "vacuums": {
31
31
  "title": "SharkClean Vacuum Devicess",
32
32
  "type": "array",
33
- "required": true,
33
+ "required": false,
34
34
  "items": {
35
35
  "title": "SharkClean DSN",
36
36
  "type": "string"
@@ -42,19 +42,8 @@
42
42
  "type": "boolean",
43
43
  "required": false,
44
44
  "default": false
45
- },
46
- "invertDockedStatus": {
47
- "title": "Invert Vacuum Docked Status",
48
- "type": "boolean",
49
- "required": false,
50
- "default": false
51
- },
52
- "dockedUpdateInterval": {
53
- "title": "Docked Update Interval",
54
- "type": "integer",
55
- "required": false,
56
- "default": 30000
57
45
  }
46
+
58
47
  }
59
48
  },
60
49
  "layout": [
@@ -106,9 +95,7 @@
106
95
  }
107
96
  ]
108
97
  },
109
- "europe",
110
- "invertDockedStatus",
111
- "dockedUpdateInterval"
98
+ "europe"
112
99
  ]
113
100
  }
114
101
  ]
@@ -0,0 +1,36 @@
1
+ import type { API, Logger } from 'homebridge';
2
+ type MatterAccessory = any;
3
+ export declare class RoboticVacuumAccessory {
4
+ private api;
5
+ private log;
6
+ private device;
7
+ private isReady;
8
+ private publishedAccessory;
9
+ private pollIntervalId;
10
+ private dockedDelay;
11
+ private dockedUpdateInterval;
12
+ constructor(api: API, log: Logger, device: any);
13
+ private retry;
14
+ toAccessory(): MatterAccessory;
15
+ attachToPublishedAccessory(accessory: MatterAccessory): void;
16
+ private performInitialSync;
17
+ private startPolling;
18
+ private stopPolling;
19
+ private setClusterValue;
20
+ updateOperationalState(): Promise<void>;
21
+ updateRunMode(): Promise<void>;
22
+ updateCleanMode(): Promise<void>;
23
+ updateSelectedAreas(): Promise<void>;
24
+ updateProgress(): Promise<void>;
25
+ private handleStart;
26
+ private handleStop;
27
+ private handlePause;
28
+ private handleResume;
29
+ private handleGoHome;
30
+ private handleChangeRunMode;
31
+ private handleChangeCleanMode;
32
+ private handleSelectAreas;
33
+ private handleSkipArea;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=RoboticVacuumAccessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoboticVacuumAccessory.d.ts","sourceRoot":"","sources":["../../src/devices/RoboticVacuumAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAK7C,KAAK,eAAe,GAAG,GAAG,CAAA;AAI1B,qBAAa,sBAAsB;IACjC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,oBAAoB,CAA0C;gBAE1D,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;YAOhC,KAAK;IAkBZ,WAAW,IAAI,eAAe;IA4E9B,0BAA0B,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;YA8BrD,kBAAkB;IAkBhC,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,eAAe;IAoBV,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBvC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAe9B,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBhC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAcpC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;YAW9B,WAAW;YASX,UAAU;YASV,WAAW;YASX,YAAY;YASZ,YAAY;YASZ,mBAAmB;YAcnB,qBAAqB;YAKrB,iBAAiB;YAYjB,cAAc;CAG7B"}
@@ -0,0 +1,367 @@
1
+ import { TIMEOUTS } from '../constants.js';
2
+ import { OperatingModes, PowerModes, Properties } from '../sharkiq-js/sharkiq.js';
3
+ const MatterAccessoryEventTypes = globalThis.MatterAccessoryEventTypes || {};
4
+ // Simplified RoboticVacuumAccessory implementation based on the template
5
+ export class RoboticVacuumAccessory {
6
+ api;
7
+ log;
8
+ device;
9
+ isReady = false;
10
+ publishedAccessory = null;
11
+ pollIntervalId = null;
12
+ dockedDelay = 0;
13
+ dockedUpdateInterval = TIMEOUTS.DEFAULT_DOCKED_UPDATE_INTERVAL;
14
+ constructor(api, log, device) {
15
+ this.api = api;
16
+ this.log = log;
17
+ this.device = device;
18
+ }
19
+ // Simple retry helper with exponential backoff
20
+ async retry(fn, attempts = 3, initialDelay = 500) {
21
+ let lastError;
22
+ let delay = initialDelay;
23
+ for (let i = 0; i < attempts; i++) {
24
+ try {
25
+ return await fn();
26
+ }
27
+ catch (e) {
28
+ lastError = e;
29
+ this.log.debug(`Retry ${i + 1}/${attempts} failed:`, e);
30
+ if (i < attempts - 1) {
31
+ await new Promise(res => setTimeout(res, delay));
32
+ delay *= 2;
33
+ }
34
+ }
35
+ }
36
+ throw lastError;
37
+ }
38
+ toAccessory() {
39
+ const serialNumber = this.device._dsn && this.device._dsn.toString ? this.device._dsn.toString() : String(this.device._dsn);
40
+ const uuid = this.api.matter.uuid.generate(serialNumber);
41
+ const deviceType = this.api.matter.deviceTypes.RoboticVacuumCleaner;
42
+ const acc = {
43
+ uuid,
44
+ displayName: this.device._name || `Robot Vacuum ${serialNumber}`,
45
+ deviceType,
46
+ serialNumber,
47
+ manufacturer: 'Shark',
48
+ model: this.device._vac_model_number || 'SharkIQ',
49
+ firmwareRevision: this.device._firmware_version || '1.0.0',
50
+ hardwareRevision: '1.0.0',
51
+ clusters: {
52
+ rvcRunMode: {
53
+ supportedModes: [
54
+ { label: 'Idle', mode: 0 },
55
+ { label: 'Cleaning', mode: 1 },
56
+ { label: 'Mapping', mode: 2 },
57
+ ],
58
+ currentMode: 0,
59
+ },
60
+ rvcCleanMode: {
61
+ supportedModes: [
62
+ { label: 'Vacuum', mode: 0 },
63
+ { label: 'Mop', mode: 1 },
64
+ { label: 'Vacuum & Mop', mode: 2 },
65
+ ],
66
+ currentMode: 0,
67
+ },
68
+ rvcOperationalState: {
69
+ operationalStateList: [
70
+ { operationalStateId: 0, operationalStateLabel: 'Stopped' },
71
+ { operationalStateId: 1, operationalStateLabel: 'Running' },
72
+ { operationalStateId: 2, operationalStateLabel: 'Paused' },
73
+ { operationalStateId: 64, operationalStateLabel: 'Seeking Charger' },
74
+ { operationalStateId: 65, operationalStateLabel: 'Charging' },
75
+ { operationalStateId: 66, operationalStateLabel: 'Docked' },
76
+ ],
77
+ operationalState: 0,
78
+ },
79
+ serviceArea: {
80
+ supportedMaps: [],
81
+ supportedAreas: [],
82
+ selectedAreas: [],
83
+ currentArea: null,
84
+ },
85
+ },
86
+ handlers: {
87
+ rvcRunMode: {
88
+ changeToMode: async (request) => this.handleChangeRunMode(request),
89
+ },
90
+ rvcCleanMode: {
91
+ changeToMode: async (request) => this.handleChangeCleanMode(request),
92
+ },
93
+ rvcOperationalState: {
94
+ start: async () => this.handleStart(),
95
+ stop: async () => this.handleStop(),
96
+ pause: async () => this.handlePause(),
97
+ resume: async () => this.handleResume(),
98
+ goHome: async () => this.handleGoHome(),
99
+ },
100
+ serviceArea: {
101
+ selectAreas: async (request) => this.handleSelectAreas(request),
102
+ skipArea: async (request) => this.handleSkipArea(request),
103
+ },
104
+ },
105
+ };
106
+ return acc;
107
+ }
108
+ // Attach event listeners to the exact published Matter accessory object
109
+ attachToPublishedAccessory(accessory) {
110
+ // Keep a reference to the exact published accessory object so we can update clusters later
111
+ this.publishedAccessory = accessory;
112
+ try {
113
+ accessory._eventEmitter?.on(MatterAccessoryEventTypes.READY, async (port) => {
114
+ this.isReady = true;
115
+ this.log.info(`Matter accessory ready on port ${port} for ${accessory.displayName}`);
116
+ // When ready, perform an initial sync to populate state
117
+ try {
118
+ await this.performInitialSync();
119
+ // Start periodic polling after initial sync
120
+ this.startPolling();
121
+ }
122
+ catch (e) {
123
+ this.log.debug('performInitialSync error', e);
124
+ }
125
+ });
126
+ accessory._eventEmitter?.on(MatterAccessoryEventTypes.COMMISSIONED, () => {
127
+ this.log.info(`Matter accessory commissioned: ${accessory.displayName}`);
128
+ });
129
+ accessory._eventEmitter?.on(MatterAccessoryEventTypes.DECOMMISSIONED, () => {
130
+ this.log.warn(`Matter accessory decommissioned: ${accessory.displayName}`);
131
+ });
132
+ }
133
+ catch (e) {
134
+ this.log.debug('attachToPublishedAccessory error', e);
135
+ }
136
+ }
137
+ // Perform initial device sync once the Matter accessory is ready
138
+ async performInitialSync() {
139
+ try {
140
+ this.log.debug('Performing initial device sync for Matter accessory', this.device._dsn);
141
+ if (typeof this.device.update === 'function') {
142
+ await this.retry(() => this.device.update());
143
+ }
144
+ // Update Matter clusters with current device state (power mode, docked status, etc.)
145
+ await this.updateOperationalState();
146
+ await this.updateRunMode();
147
+ await this.updateCleanMode();
148
+ await this.updateSelectedAreas();
149
+ await this.updateProgress();
150
+ }
151
+ catch (e) {
152
+ this.log.debug('performInitialSync error', e);
153
+ }
154
+ }
155
+ // Start periodic polling for device state
156
+ startPolling() {
157
+ if (this.pollIntervalId) {
158
+ return;
159
+ }
160
+ const interval = this.dockedUpdateInterval || TIMEOUTS.DEFAULT_DOCKED_UPDATE_INTERVAL;
161
+ this.pollIntervalId = setInterval(async () => {
162
+ try {
163
+ const maybeDelay = await this.retry(() => this.device.update([Properties.DOCKED_STATUS, Properties.OPERATING_MODE, Properties.POWER_MODE]));
164
+ if (typeof maybeDelay === 'number') {
165
+ this.dockedDelay = maybeDelay;
166
+ }
167
+ await this.updateOperationalState();
168
+ await this.updateRunMode();
169
+ await this.updateCleanMode();
170
+ await this.updateSelectedAreas();
171
+ await this.updateProgress();
172
+ }
173
+ catch (e) {
174
+ this.log.debug('Polling update error', e);
175
+ }
176
+ }, interval + this.dockedDelay);
177
+ }
178
+ // Stop periodic polling
179
+ stopPolling() {
180
+ if (this.pollIntervalId) {
181
+ clearInterval(this.pollIntervalId);
182
+ this.pollIntervalId = null;
183
+ }
184
+ }
185
+ // Helper to set cluster values defensively on the published accessory object
186
+ setClusterValue(clusterName, prop, value) {
187
+ try {
188
+ if (!this.publishedAccessory) {
189
+ return;
190
+ }
191
+ // If accessory exposes an update method, prefer it
192
+ if (typeof this.publishedAccessory.updateCluster === 'function') {
193
+ this.publishedAccessory.updateCluster(clusterName, { [prop]: value });
194
+ return;
195
+ }
196
+ // Otherwise, update the clusters object directly
197
+ if (this.publishedAccessory.clusters && this.publishedAccessory.clusters[clusterName]) {
198
+ this.publishedAccessory.clusters[clusterName][prop] = value;
199
+ }
200
+ }
201
+ catch (e) {
202
+ this.log.debug('setClusterValue error', e);
203
+ }
204
+ }
205
+ // Update operational state cluster from device state
206
+ async updateOperationalState() {
207
+ try {
208
+ await this.device.update();
209
+ const mode = this.device.operating_mode();
210
+ // Map operating modes to RVC operationalState values
211
+ // 0: Stopped, 1: Running, 2: Paused, 64: Seeking Charger, 65: Charging, 66: Docked
212
+ let opState = 0;
213
+ if (mode === OperatingModes.START) {
214
+ opState = 1;
215
+ }
216
+ else if (mode === OperatingModes.STOP) {
217
+ opState = 2;
218
+ }
219
+ // Docked status overrides when docked
220
+ const docked = this.device.docked_status && this.device.docked_status() === 1;
221
+ if (docked) {
222
+ opState = 66;
223
+ }
224
+ this.setClusterValue('rvcOperationalState', 'operationalState', opState);
225
+ }
226
+ catch (e) {
227
+ this.log.debug('updateOperationalState error', e);
228
+ }
229
+ }
230
+ // Update run mode cluster (Idle / Cleaning / Mapping)
231
+ async updateRunMode() {
232
+ try {
233
+ await this.device.update();
234
+ const mode = this.device.operating_mode();
235
+ let runMode = 0;
236
+ if (mode === OperatingModes.START) {
237
+ runMode = 1;
238
+ }
239
+ this.setClusterValue('rvcRunMode', 'currentMode', runMode);
240
+ }
241
+ catch (e) {
242
+ this.log.debug('updateRunMode error', e);
243
+ }
244
+ }
245
+ // Update clean mode cluster (Vacuum / Mop / Vacuum & Mop)
246
+ async updateCleanMode() {
247
+ try {
248
+ await this.device.update();
249
+ const power = this.device.power_mode && this.device.power_mode();
250
+ // Best-effort mapping: treat power mode as clean mode placeholder
251
+ let cleanMode = 0;
252
+ if (power === PowerModes.MAX) {
253
+ cleanMode = 0;
254
+ }
255
+ this.setClusterValue('rvcCleanMode', 'currentMode', cleanMode);
256
+ }
257
+ catch (e) {
258
+ this.log.debug('updateCleanMode error', e);
259
+ }
260
+ }
261
+ // Update selected areas / supported areas cluster
262
+ async updateSelectedAreas() {
263
+ try {
264
+ // If device exposes map/area info, use it. Otherwise leave defaults.
265
+ const maps = this.device.maps || [];
266
+ const areas = this.device.areas || [];
267
+ this.setClusterValue('serviceArea', 'supportedMaps', maps);
268
+ this.setClusterValue('serviceArea', 'supportedAreas', areas);
269
+ // No selectedAreas by default
270
+ }
271
+ catch (e) {
272
+ this.log.debug('updateSelectedAreas error', e);
273
+ }
274
+ }
275
+ // Update progress / current area cluster
276
+ async updateProgress() {
277
+ try {
278
+ await this.device.update();
279
+ const currentArea = this.device.current_area || null;
280
+ this.setClusterValue('serviceArea', 'currentArea', currentArea);
281
+ }
282
+ catch (e) {
283
+ this.log.debug('updateProgress error', e);
284
+ }
285
+ }
286
+ // Handler implementations delegate to the underlying SharkIqVacuum device
287
+ async handleStart() {
288
+ this.log.info('Matter -> Start');
289
+ try {
290
+ await this.retry(() => this.device.clean_rooms([]));
291
+ }
292
+ catch (e) {
293
+ this.log.debug('handleStart error', e);
294
+ }
295
+ }
296
+ async handleStop() {
297
+ this.log.info('Matter -> Stop');
298
+ try {
299
+ await this.retry(() => this.device.cancel_clean());
300
+ }
301
+ catch (e) {
302
+ this.log.debug('handleStop error', e);
303
+ }
304
+ }
305
+ async handlePause() {
306
+ this.log.info('Matter -> Pause');
307
+ try {
308
+ await this.retry(() => this.device.set_operating_mode(this.device.OperatingModes?.STOP ?? 2));
309
+ }
310
+ catch (e) {
311
+ this.log.debug('handlePause error', e);
312
+ }
313
+ }
314
+ async handleResume() {
315
+ this.log.info('Matter -> Resume');
316
+ try {
317
+ await this.retry(() => this.device.set_operating_mode(this.device.OperatingModes?.START ?? 1));
318
+ }
319
+ catch (e) {
320
+ this.log.debug('handleResume error', e);
321
+ }
322
+ }
323
+ async handleGoHome() {
324
+ this.log.info('Matter -> GoHome');
325
+ try {
326
+ await this.retry(() => this.device.cancel_clean());
327
+ }
328
+ catch (e) {
329
+ this.log.debug('handleGoHome error', e);
330
+ }
331
+ }
332
+ async handleChangeRunMode(request) {
333
+ this.log.info('Matter -> Change Run Mode', request);
334
+ const newMode = request?.newMode;
335
+ try {
336
+ if (newMode === 1) {
337
+ await this.retry(() => this.device.clean_rooms([]));
338
+ }
339
+ else if (newMode === 0) {
340
+ await this.retry(() => this.device.cancel_clean());
341
+ }
342
+ }
343
+ catch (e) {
344
+ this.log.debug('handleChangeRunMode error', e);
345
+ }
346
+ }
347
+ async handleChangeCleanMode(request) {
348
+ this.log.info('Matter -> Change Clean Mode', request);
349
+ // Best-effort: implement if device supports clean mode change
350
+ }
351
+ async handleSelectAreas(request) {
352
+ this.log.info('Matter -> Select Areas', request);
353
+ const areas = request?.newAreas;
354
+ if (Array.isArray(areas) && areas.length > 0) {
355
+ try {
356
+ await this.retry(() => this.device.clean_rooms(areas));
357
+ }
358
+ catch (e) {
359
+ this.log.debug('handleSelectAreas error', e);
360
+ }
361
+ }
362
+ }
363
+ async handleSkipArea(request) {
364
+ this.log.info('Matter -> Skip Area', request);
365
+ }
366
+ }
367
+ //# sourceMappingURL=RoboticVacuumAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoboticVacuumAccessory.js","sourceRoot":"","sources":["../../src/devices/RoboticVacuumAccessory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGjF,MAAM,yBAAyB,GAAS,UAAkB,CAAC,yBAAyB,IAAI,EAAE,CAAA;AAE1F,yEAAyE;AACzE,MAAM,OAAO,sBAAsB;IACzB,GAAG,CAAK;IACR,GAAG,CAAQ;IACX,MAAM,CAAK;IACX,OAAO,GAAG,KAAK,CAAA;IACf,kBAAkB,GAA2B,IAAI,CAAA;IACjD,cAAc,GAA0C,IAAI,CAAA;IAC5D,WAAW,GAAG,CAAC,CAAA;IACf,oBAAoB,GAAG,QAAQ,CAAC,8BAA8B,CAAA;IAEtE,YAAY,GAAQ,EAAE,GAAW,EAAE,MAAW;QAC5C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,+CAA+C;IACvC,KAAK,CAAC,KAAK,CAAI,EAAoB,EAAE,QAAQ,GAAG,CAAC,EAAE,YAAY,GAAG,GAAG;QAC3E,IAAI,SAAc,CAAA;QAClB,IAAI,KAAK,GAAG,YAAY,CAAA;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,E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C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAA;YACpD,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,OAAY;QAC9C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAA;QACrD,8DAA8D;IAChE,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,OAAY;QAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAA;QAChD,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,CAAA;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAA;YACxD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAAY;QACvC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF"}
@@ -1,5 +1,10 @@
1
1
  import type { API, Characteristic, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service } from 'homebridge';
2
2
  import type { SharkIqVacuum } from './sharkiq-js/sharkiq';
3
+ declare module 'homebridge' {
4
+ interface API {
5
+ publishMatterAccessories?: (pluginIdentifier: string, accessories: PlatformAccessory[]) => void;
6
+ }
7
+ }
3
8
  export declare class SharkIQPlatform implements DynamicPlatformPlugin {
4
9
  readonly log: Logger;
5
10
  readonly config: PlatformConfig;
@@ -8,7 +13,14 @@ export declare class SharkIQPlatform implements DynamicPlatformPlugin {
8
13
  readonly Characteristic: typeof Characteristic;
9
14
  readonly accessories: PlatformAccessory[];
10
15
  vacuumDevices: SharkIqVacuum[];
16
+ readonly matterAccessories: Map<string, any>;
17
+ readonly matterEnabled: boolean;
11
18
  constructor(log: Logger, config: PlatformConfig, api: API);
19
+ /**
20
+ * Called when homebridge restores cached Matter accessories from disk at startup.
21
+ * This lets the platform keep track of cached Matter accessories if needed.
22
+ */
23
+ configureMatterAccessory(accessory: any): void;
12
24
  login: () => Promise<SharkIqVacuum[]>;
13
25
  configureAccessory(accessory: PlatformAccessory): void;
14
26
  discoverDevices(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEhI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAYzD,qBAAa,eAAgB,YAAW,qBAAqB;aAUzC,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAX1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAA;IACvC,SAAgB,cAAc,EAAE,OAAO,cAAc,CAAA;IAGrD,SAAgB,WAAW,EAAE,iBAAiB,EAAE,CAAK;IAE9C,aAAa,EAAE,aAAa,EAAE,CAAK;gBAGxB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IA+B1B,KAAK,QAAa,OAAO,CAAC,aAAa,EAAE,CAAC,CAgCzC;IAGD,kBAAkB,CAAC,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