@switchbot/homebridge-switchbot 5.0.0-beta.52 → 5.0.0-beta.54

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.
@@ -1,29 +1,38 @@
1
1
  /**
2
- * Robotic Vacuum Cleaner Accessory Class
2
+ * Robotic Vacuum Cleaner Accessory (SwitchBot-aligned)
3
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
4
+ * This implementation is intentionally limited to SwitchBot OpenAPI-supported
5
+ * behaviors for Robot Vacuum families. We expose only commands and modes that
6
+ * exist in the public API docs:
7
+ * https://github.com/OpenWonderLabs/SwitchBotAPI
10
8
  *
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.
9
+ * Capability matrix (derived from OpenAPI v1.1):
10
+ * - S1 / S1 Plus / K10+ / K10+ Pro
11
+ * Commands: start, stop, dock, PowLevel {0-3}
12
+ * No pause/resume, no mop, no area selection
13
+ * - K10+ Pro Combo
14
+ * • Commands: startClean {action: sweep|mop, param: {fanLevel 1-4}}, pause, dock
15
+ * • changeParam {fanLevel}, setVolume
16
+ * - S10 / S20 / K11+ / K20+ Pro
17
+ * • Commands: startClean {action: sweep|sweep_mop|mop (model-dependent), param: {fanLevel 1-4, waterLevel 1-2?}},
18
+ * pause, dock, changeParam, setVolume, (S10/S20) selfClean/addWaterForHumi
19
+ * • Some models support waterLevel, some do not (e.g. K10+ Pro Combo)
16
20
  *
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
21
+ * Matter clusters exposed:
22
+ * - rvcRunMode: Idle/Cleaning only (no Mapping mode via OpenAPI)
23
+ * - rvcCleanMode: Interpreted per model:
24
+ * Basic vac (S1/K10 family): suction levels Quiet/Standard/Strong/MAX
25
+ * Mop-capable (K10+ Pro Combo/K11+/K20+ Pro): action Vacuum or Mop
26
+ * • Mop+Vac-capable (S10/S20): action → Vacuum or Vacuum & Mop
27
+ * - rvcOperationalState: start/stop/pause/goHome handlers are attached only when supported
28
+ * - serviceArea: NOT exposed (area/room selection isn’t in public OpenAPI)
22
29
  */
23
30
  import type { API, Logger } from 'homebridge';
24
31
  import { BaseMatterAccessory } from './BaseMatterAccessory.js';
25
32
  export declare class RoboticVacuumAccessory extends BaseMatterAccessory {
26
- private activeTimers;
33
+ private currentCleanAction;
34
+ private currentFanLevel;
35
+ private capabilities;
27
36
  constructor(api: API, log: Logger, opts?: Partial<import('./BaseMatterAccessory').BaseMatterAccessoryConfig & {
28
37
  deviceId?: string;
29
38
  }>);
@@ -34,43 +43,11 @@ export declare class RoboticVacuumAccessory extends BaseMatterAccessory {
34
43
  private handleStart;
35
44
  private handleResume;
36
45
  private handleGoHome;
37
- private handleSelectAreas;
38
- private handleSkipArea;
39
- /**
40
- * Helper method to clear all active timers
41
- */
42
- private clearTimers;
43
- /**
44
- * Helper method to initiate return to dock sequence
45
- * Can be called synchronously from other handlers
46
- */
47
- private returnToDock;
48
- /**
49
- * Update Methods - Use these to update the vacuum state from your API/device
50
- *
51
- * Since this is a platform accessory, state updates work immediately after registration.
52
- */
53
46
  updateOperationalState(state: number): void;
54
47
  updateRunMode(mode: number): void;
55
48
  updateCleanMode(mode: number): void;
56
- updateSelectedAreas(areaIds: number[]): void;
57
- updateCurrentArea(areaId: number | null): void;
58
- updateProgress(progress: Array<{
59
- areaId: number;
60
- status: number;
61
- }>): void;
62
49
  /**
63
- * Update battery percentage
64
- *
65
- * Note: The Matter specification for RoboticVacuumCleaner does not include
66
- * the PowerSource cluster. Battery information for robotic vacuums should be
67
- * communicated through device-specific status reporting or via the RVC
68
- * operational state cluster.
69
- *
70
- * This method is retained for API compatibility but does not update any
71
- * Matter cluster state.
72
- *
73
- * @param percentageOrBatPercentRemaining - Battery percentage (0-100) or batPercentRemaining (0-200)
50
+ * Update battery percentage (no PowerSource cluster for this device type)
74
51
  */
75
52
  updateBatteryPercentage(percentageOrBatPercentRemaining: number): Promise<void>;
76
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RoboticVacuumAccessory.d.ts","sourceRoot":"","sources":["../../src/devices-matter/RoboticVacuumAccessory.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAkB,MAAM,YAAY,CAAA;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,OAAO,CAAC,YAAY,CAAuB;gBAE/B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,uBAAuB,EAAE,yBAAyB,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;YA+EtH,mBAAmB;YAuCnB,qBAAqB;YAyBrB,WAAW;YAOX,UAAU;YAQV,WAAW;YAoBX,YAAY;YAoBZ,YAAY;YAiBZ,iBAAiB;YAUjB,cAAc;IAQ5B;;OAEG;IACH,OAAO,CAAC,WAAW;IAKnB;;;OAGG;IACH,OAAO,CAAC,YAAY;IA0BpB;;;;OAIG;IAEI,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAmB3C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMjC,eAAe,CAAC,IAAI,EAAE,MAAM,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