@apocaliss92/nodedreame 1.7.2 → 1.8.0
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/dist/index.cjs +175 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -1
- package/dist/index.d.ts +90 -1
- package/dist/index.js +169 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -755,6 +755,58 @@ declare function decodeAiFeature(raw: AiDetectionRaw, feature: DreameAiFeature):
|
|
|
755
755
|
*/
|
|
756
756
|
declare function encodeAiFeatureWrite(raw: AiDetectionRaw, feature: DreameAiFeature, value: boolean): number | string;
|
|
757
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Auto-switch settings codec. The robot packs a large bundle of secondary
|
|
760
|
+
* cleaning toggles + multi-value settings into a SINGLE MIoT property —
|
|
761
|
+
* `AUTO_SWITCH_SETTINGS` (siid 4 piid 50) — whose value is a JSON string.
|
|
762
|
+
* Ported from the Tasshack `dreame-vacuum` HA integration (v2.0.0b25,
|
|
763
|
+
* `DreameVacuumAutoSwitchProperty` + `set_auto_switch_property`):
|
|
764
|
+
*
|
|
765
|
+
* - READ : a JSON LIST `[{"k":"LessColl","v":1}, …]` (or a single
|
|
766
|
+
* `{"k":…,"v":…}` object) — every supported key/value pair.
|
|
767
|
+
* - WRITE : a SINGLE `{"k":"LessColl","v":0}` object carrying ONLY the
|
|
768
|
+
* changed key; the device merges it server-side.
|
|
769
|
+
*
|
|
770
|
+
* Unlike `AI_DETECTION` this family is JSON-ONLY (no int-bitmask variant) and the
|
|
771
|
+
* values are arbitrary ints (booleans 0/1, small enums, and `-1`/`-n` "not
|
|
772
|
+
* applicable" sentinels) — the codec returns the raw int and leaves the
|
|
773
|
+
* boolean-vs-enum interpretation to the caller. Presence is data-driven: a key is
|
|
774
|
+
* "supported" iff it appears in the decoded payload (exactly how Tasshack derives
|
|
775
|
+
* `auto_switch_data`).
|
|
776
|
+
*/
|
|
777
|
+
/** Canonical auto-switch keys. A given model reports a subset. */
|
|
778
|
+
type AutoSwitchKey = 'collisionAvoidance' | 'fillLight' | 'autoDrying' | 'stainAvoidance' | 'moppingType' | 'cleanGenius' | 'widerCornerCoverage' | 'floorDirectionCleaning' | 'petFocusedCleaning' | 'autoRecleaning' | 'autoRewashing' | 'mopPadSwing' | 'autoCharging' | 'humanFollow' | 'maxSuctionPower' | 'smartDrying' | 'drainageConfirmResult' | 'drainageTestResult' | 'hotWashing' | 'uvSterilization' | 'cleaningRoute' | 'customMoppingMode' | 'moppingMode' | 'selfCleanFrequency' | 'intensiveCarpetCleaning' | 'gapCleaningExtension' | 'moppingUnderFurnitures' | 'ultraCleanMode' | 'streamingVoicePrompt' | 'mopExtend' | 'mopExtendFrequency' | 'sideReach' | 'intelligentStainCleaning';
|
|
779
|
+
/**
|
|
780
|
+
* Short on-wire key for each setting inside the `AUTO_SWITCH_SETTINGS` JSON
|
|
781
|
+
* (Tasshack `DreameVacuumAutoSwitchProperty`). These opaque strings are the
|
|
782
|
+
* device's own identifiers and must match byte-for-byte.
|
|
783
|
+
*/
|
|
784
|
+
declare const AUTO_SWITCH_JSON_KEY: Readonly<Record<AutoSwitchKey, string>>;
|
|
785
|
+
/** The raw on-wire `AUTO_SWITCH_SETTINGS` value: a JSON string, or absent. */
|
|
786
|
+
type AutoSwitchRaw = string | null;
|
|
787
|
+
/**
|
|
788
|
+
* Decode ONE auto-switch setting's int value from the packed
|
|
789
|
+
* `AUTO_SWITCH_SETTINGS` payload. Returns `null` when the value is absent or the
|
|
790
|
+
* key is not present in the payload (i.e. unsupported by this model/firmware).
|
|
791
|
+
*/
|
|
792
|
+
declare function decodeAutoSwitch(raw: AutoSwitchRaw, key: AutoSwitchKey): number | null;
|
|
793
|
+
/**
|
|
794
|
+
* The auto-switch keys the payload actually reports (presence-driven — mirrors
|
|
795
|
+
* Tasshack `auto_switch_data`). On-wire keys with no canonical mapping (newer
|
|
796
|
+
* firmware extras like `MopFullyScalable`) are skipped. Order follows
|
|
797
|
+
* {@link AUTO_SWITCH_JSON_KEY} for determinism.
|
|
798
|
+
*/
|
|
799
|
+
declare function supportedAutoSwitchKeys(raw: AutoSwitchRaw): readonly AutoSwitchKey[];
|
|
800
|
+
/** All `{ canonical key → int }` pairs the payload reports (canonical keys only). */
|
|
801
|
+
declare function decodeAutoSwitchAll(raw: AutoSwitchRaw): Readonly<Partial<Record<AutoSwitchKey, number>>>;
|
|
802
|
+
/**
|
|
803
|
+
* Compute the value to WRITE to `AUTO_SWITCH_SETTINGS` for ONE setting. Mirrors
|
|
804
|
+
* Tasshack `set_auto_switch_property`: a SINGLE `{"k":<key>,"v":<int>}` object
|
|
805
|
+
* (NOT the full list) — the device merges it server-side, so the other settings
|
|
806
|
+
* are preserved without a read-modify-write.
|
|
807
|
+
*/
|
|
808
|
+
declare function encodeAutoSwitchWrite(key: AutoSwitchKey, value: number): string;
|
|
809
|
+
|
|
758
810
|
/**
|
|
759
811
|
* Vacuum consumable/maintenance map (ported from Tasshack `dreame-vacuum`
|
|
760
812
|
* v2.0.0b25 — property + action mappings). Each consumable lives on its own MIoT
|
|
@@ -1370,6 +1422,43 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
|
|
|
1370
1422
|
* is unknown (a blind write would clobber the other toggles).
|
|
1371
1423
|
*/
|
|
1372
1424
|
setAiFeature(feature: DreameAiFeature, value: boolean): Promise<unknown>;
|
|
1425
|
+
/**
|
|
1426
|
+
* The raw `AUTO_SWITCH_SETTINGS` value (siid 4 piid 50) — a JSON string packing
|
|
1427
|
+
* every secondary toggle/setting — or `null` when not yet observed. Prefer the
|
|
1428
|
+
* decoded {@link autoSwitchProperty} / {@link supportedAutoSwitchKeys} surface.
|
|
1429
|
+
*/
|
|
1430
|
+
get autoSwitchRaw(): AutoSwitchRaw;
|
|
1431
|
+
/** Whether this model reports the packed auto-switch bundle at all. */
|
|
1432
|
+
get hasAutoSwitchSettings(): boolean;
|
|
1433
|
+
/**
|
|
1434
|
+
* The auto-switch settings this model reports, decoded from the packed value.
|
|
1435
|
+
* Presence-driven (a key appears iff the payload carries it) — mirrors
|
|
1436
|
+
* Tasshack `auto_switch_data`.
|
|
1437
|
+
*/
|
|
1438
|
+
get supportedAutoSwitchKeys(): readonly AutoSwitchKey[];
|
|
1439
|
+
/**
|
|
1440
|
+
* Read ONE auto-switch setting's int value, decoded from the packed
|
|
1441
|
+
* `AUTO_SWITCH_SETTINGS` payload. `null` when the value is unobserved or the
|
|
1442
|
+
* key is not present. The value is an opaque int (boolean 0/1, a small enum, or
|
|
1443
|
+
* a `-1`/`-n` "not applicable" sentinel) — the caller interprets it.
|
|
1444
|
+
*/
|
|
1445
|
+
autoSwitchProperty(key: AutoSwitchKey): number | null;
|
|
1446
|
+
/**
|
|
1447
|
+
* Seed {@link autoSwitchRaw} from the CLOUD SHADOW (the last value the robot
|
|
1448
|
+
* pushed for `AUTO_SWITCH_SETTINGS`, siid 4 piid 50) WITHOUT waking it. Like the
|
|
1449
|
+
* AI bundle these are STATIC settings the robot rarely re-pushes over MQTT, so a
|
|
1450
|
+
* fresh connect to an idle robot has no value cached — call this on activate to
|
|
1451
|
+
* surface the current settings. Returns the resolved raw value (`null` when the
|
|
1452
|
+
* shadow carries none yet).
|
|
1453
|
+
*/
|
|
1454
|
+
refreshAutoSwitch(): Promise<AutoSwitchRaw>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Set ONE auto-switch setting. Mirrors Tasshack `set_auto_switch_property`: a
|
|
1457
|
+
* single-key `{"k":<key>,"v":<int>}` write the device merges server-side (the
|
|
1458
|
+
* other settings are preserved without a read-modify-write). Rejects when the
|
|
1459
|
+
* model does not report the bundle.
|
|
1460
|
+
*/
|
|
1461
|
+
setAutoSwitchProperty(key: AutoSwitchKey, value: number): Promise<unknown>;
|
|
1373
1462
|
/**
|
|
1374
1463
|
* Start cleaning (MIoT action siid 2 aiid 1). Named `startCleaning` — NOT
|
|
1375
1464
|
* `start` — because `BaseDevice.start()` is the lifecycle method that opens
|
|
@@ -2318,4 +2407,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2318
2407
|
*/
|
|
2319
2408
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2320
2409
|
|
|
2321
|
-
export { AI_FEATURE_BIT, AI_FEATURE_JSON_KEY, type AiDetectionRaw, BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type ConsumableReading, type ConsumableSpec, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, type DreameAiFeature, DreameApiError, DreameAuthError, type DreameCloudState, type DreameConsumableKey, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, VACUUM_CONSUMABLES, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, consumableSpec, createClientDumper, createDumper, decodeAiFeature, encodeAiFeatureWrite, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, renderMowerSvg, renderVacuumPng, resolveCapabilities };
|
|
2410
|
+
export { AI_FEATURE_BIT, AI_FEATURE_JSON_KEY, AUTO_SWITCH_JSON_KEY, type AiDetectionRaw, type AutoSwitchKey, type AutoSwitchRaw, BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type ConsumableReading, type ConsumableSpec, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, type DreameAiFeature, DreameApiError, DreameAuthError, type DreameCloudState, type DreameConsumableKey, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, VACUUM_CONSUMABLES, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, consumableSpec, createClientDumper, createDumper, decodeAiFeature, decodeAutoSwitch, decodeAutoSwitchAll, encodeAiFeatureWrite, encodeAutoSwitchWrite, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -755,6 +755,58 @@ declare function decodeAiFeature(raw: AiDetectionRaw, feature: DreameAiFeature):
|
|
|
755
755
|
*/
|
|
756
756
|
declare function encodeAiFeatureWrite(raw: AiDetectionRaw, feature: DreameAiFeature, value: boolean): number | string;
|
|
757
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Auto-switch settings codec. The robot packs a large bundle of secondary
|
|
760
|
+
* cleaning toggles + multi-value settings into a SINGLE MIoT property —
|
|
761
|
+
* `AUTO_SWITCH_SETTINGS` (siid 4 piid 50) — whose value is a JSON string.
|
|
762
|
+
* Ported from the Tasshack `dreame-vacuum` HA integration (v2.0.0b25,
|
|
763
|
+
* `DreameVacuumAutoSwitchProperty` + `set_auto_switch_property`):
|
|
764
|
+
*
|
|
765
|
+
* - READ : a JSON LIST `[{"k":"LessColl","v":1}, …]` (or a single
|
|
766
|
+
* `{"k":…,"v":…}` object) — every supported key/value pair.
|
|
767
|
+
* - WRITE : a SINGLE `{"k":"LessColl","v":0}` object carrying ONLY the
|
|
768
|
+
* changed key; the device merges it server-side.
|
|
769
|
+
*
|
|
770
|
+
* Unlike `AI_DETECTION` this family is JSON-ONLY (no int-bitmask variant) and the
|
|
771
|
+
* values are arbitrary ints (booleans 0/1, small enums, and `-1`/`-n` "not
|
|
772
|
+
* applicable" sentinels) — the codec returns the raw int and leaves the
|
|
773
|
+
* boolean-vs-enum interpretation to the caller. Presence is data-driven: a key is
|
|
774
|
+
* "supported" iff it appears in the decoded payload (exactly how Tasshack derives
|
|
775
|
+
* `auto_switch_data`).
|
|
776
|
+
*/
|
|
777
|
+
/** Canonical auto-switch keys. A given model reports a subset. */
|
|
778
|
+
type AutoSwitchKey = 'collisionAvoidance' | 'fillLight' | 'autoDrying' | 'stainAvoidance' | 'moppingType' | 'cleanGenius' | 'widerCornerCoverage' | 'floorDirectionCleaning' | 'petFocusedCleaning' | 'autoRecleaning' | 'autoRewashing' | 'mopPadSwing' | 'autoCharging' | 'humanFollow' | 'maxSuctionPower' | 'smartDrying' | 'drainageConfirmResult' | 'drainageTestResult' | 'hotWashing' | 'uvSterilization' | 'cleaningRoute' | 'customMoppingMode' | 'moppingMode' | 'selfCleanFrequency' | 'intensiveCarpetCleaning' | 'gapCleaningExtension' | 'moppingUnderFurnitures' | 'ultraCleanMode' | 'streamingVoicePrompt' | 'mopExtend' | 'mopExtendFrequency' | 'sideReach' | 'intelligentStainCleaning';
|
|
779
|
+
/**
|
|
780
|
+
* Short on-wire key for each setting inside the `AUTO_SWITCH_SETTINGS` JSON
|
|
781
|
+
* (Tasshack `DreameVacuumAutoSwitchProperty`). These opaque strings are the
|
|
782
|
+
* device's own identifiers and must match byte-for-byte.
|
|
783
|
+
*/
|
|
784
|
+
declare const AUTO_SWITCH_JSON_KEY: Readonly<Record<AutoSwitchKey, string>>;
|
|
785
|
+
/** The raw on-wire `AUTO_SWITCH_SETTINGS` value: a JSON string, or absent. */
|
|
786
|
+
type AutoSwitchRaw = string | null;
|
|
787
|
+
/**
|
|
788
|
+
* Decode ONE auto-switch setting's int value from the packed
|
|
789
|
+
* `AUTO_SWITCH_SETTINGS` payload. Returns `null` when the value is absent or the
|
|
790
|
+
* key is not present in the payload (i.e. unsupported by this model/firmware).
|
|
791
|
+
*/
|
|
792
|
+
declare function decodeAutoSwitch(raw: AutoSwitchRaw, key: AutoSwitchKey): number | null;
|
|
793
|
+
/**
|
|
794
|
+
* The auto-switch keys the payload actually reports (presence-driven — mirrors
|
|
795
|
+
* Tasshack `auto_switch_data`). On-wire keys with no canonical mapping (newer
|
|
796
|
+
* firmware extras like `MopFullyScalable`) are skipped. Order follows
|
|
797
|
+
* {@link AUTO_SWITCH_JSON_KEY} for determinism.
|
|
798
|
+
*/
|
|
799
|
+
declare function supportedAutoSwitchKeys(raw: AutoSwitchRaw): readonly AutoSwitchKey[];
|
|
800
|
+
/** All `{ canonical key → int }` pairs the payload reports (canonical keys only). */
|
|
801
|
+
declare function decodeAutoSwitchAll(raw: AutoSwitchRaw): Readonly<Partial<Record<AutoSwitchKey, number>>>;
|
|
802
|
+
/**
|
|
803
|
+
* Compute the value to WRITE to `AUTO_SWITCH_SETTINGS` for ONE setting. Mirrors
|
|
804
|
+
* Tasshack `set_auto_switch_property`: a SINGLE `{"k":<key>,"v":<int>}` object
|
|
805
|
+
* (NOT the full list) — the device merges it server-side, so the other settings
|
|
806
|
+
* are preserved without a read-modify-write.
|
|
807
|
+
*/
|
|
808
|
+
declare function encodeAutoSwitchWrite(key: AutoSwitchKey, value: number): string;
|
|
809
|
+
|
|
758
810
|
/**
|
|
759
811
|
* Vacuum consumable/maintenance map (ported from Tasshack `dreame-vacuum`
|
|
760
812
|
* v2.0.0b25 — property + action mappings). Each consumable lives on its own MIoT
|
|
@@ -1370,6 +1422,43 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
|
|
|
1370
1422
|
* is unknown (a blind write would clobber the other toggles).
|
|
1371
1423
|
*/
|
|
1372
1424
|
setAiFeature(feature: DreameAiFeature, value: boolean): Promise<unknown>;
|
|
1425
|
+
/**
|
|
1426
|
+
* The raw `AUTO_SWITCH_SETTINGS` value (siid 4 piid 50) — a JSON string packing
|
|
1427
|
+
* every secondary toggle/setting — or `null` when not yet observed. Prefer the
|
|
1428
|
+
* decoded {@link autoSwitchProperty} / {@link supportedAutoSwitchKeys} surface.
|
|
1429
|
+
*/
|
|
1430
|
+
get autoSwitchRaw(): AutoSwitchRaw;
|
|
1431
|
+
/** Whether this model reports the packed auto-switch bundle at all. */
|
|
1432
|
+
get hasAutoSwitchSettings(): boolean;
|
|
1433
|
+
/**
|
|
1434
|
+
* The auto-switch settings this model reports, decoded from the packed value.
|
|
1435
|
+
* Presence-driven (a key appears iff the payload carries it) — mirrors
|
|
1436
|
+
* Tasshack `auto_switch_data`.
|
|
1437
|
+
*/
|
|
1438
|
+
get supportedAutoSwitchKeys(): readonly AutoSwitchKey[];
|
|
1439
|
+
/**
|
|
1440
|
+
* Read ONE auto-switch setting's int value, decoded from the packed
|
|
1441
|
+
* `AUTO_SWITCH_SETTINGS` payload. `null` when the value is unobserved or the
|
|
1442
|
+
* key is not present. The value is an opaque int (boolean 0/1, a small enum, or
|
|
1443
|
+
* a `-1`/`-n` "not applicable" sentinel) — the caller interprets it.
|
|
1444
|
+
*/
|
|
1445
|
+
autoSwitchProperty(key: AutoSwitchKey): number | null;
|
|
1446
|
+
/**
|
|
1447
|
+
* Seed {@link autoSwitchRaw} from the CLOUD SHADOW (the last value the robot
|
|
1448
|
+
* pushed for `AUTO_SWITCH_SETTINGS`, siid 4 piid 50) WITHOUT waking it. Like the
|
|
1449
|
+
* AI bundle these are STATIC settings the robot rarely re-pushes over MQTT, so a
|
|
1450
|
+
* fresh connect to an idle robot has no value cached — call this on activate to
|
|
1451
|
+
* surface the current settings. Returns the resolved raw value (`null` when the
|
|
1452
|
+
* shadow carries none yet).
|
|
1453
|
+
*/
|
|
1454
|
+
refreshAutoSwitch(): Promise<AutoSwitchRaw>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Set ONE auto-switch setting. Mirrors Tasshack `set_auto_switch_property`: a
|
|
1457
|
+
* single-key `{"k":<key>,"v":<int>}` write the device merges server-side (the
|
|
1458
|
+
* other settings are preserved without a read-modify-write). Rejects when the
|
|
1459
|
+
* model does not report the bundle.
|
|
1460
|
+
*/
|
|
1461
|
+
setAutoSwitchProperty(key: AutoSwitchKey, value: number): Promise<unknown>;
|
|
1373
1462
|
/**
|
|
1374
1463
|
* Start cleaning (MIoT action siid 2 aiid 1). Named `startCleaning` — NOT
|
|
1375
1464
|
* `start` — because `BaseDevice.start()` is the lifecycle method that opens
|
|
@@ -2318,4 +2407,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2318
2407
|
*/
|
|
2319
2408
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2320
2409
|
|
|
2321
|
-
export { AI_FEATURE_BIT, AI_FEATURE_JSON_KEY, type AiDetectionRaw, BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type ConsumableReading, type ConsumableSpec, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, type DreameAiFeature, DreameApiError, DreameAuthError, type DreameCloudState, type DreameConsumableKey, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, VACUUM_CONSUMABLES, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, consumableSpec, createClientDumper, createDumper, decodeAiFeature, encodeAiFeatureWrite, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, renderMowerSvg, renderVacuumPng, resolveCapabilities };
|
|
2410
|
+
export { AI_FEATURE_BIT, AI_FEATURE_JSON_KEY, AUTO_SWITCH_JSON_KEY, type AiDetectionRaw, type AutoSwitchKey, type AutoSwitchRaw, BaseDevice, type BaseDeviceEvents, type BatchDeviceDataFetcher, type CapabilityResolver, ChargingStatus, type CleanOpts, CleaningMode, type ConsumableReading, type ConsumableSpec, type CreateDeviceArgs, DefaultCapabilityResolver, type DeviceCapabilities, type DeviceDump, type DeviceEvent, type DreameAiFeature, DreameApiError, DreameAuthError, type DreameCloudState, type DreameConsumableKey, type DreameDevice, DreameDeviceOfflineError, DreameError, type DreameRegion, type DreameSession, DreameTransportError, type DumperOptions, LIBRARY_NAME, MODEL_CAPABILITIES as MOWER_MODEL_CAPABILITIES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapDimensions, type MapFrameType, type MapLayer, type MapLayerType, type MapLowLyingArea, type MapObstacle, type MapPath, type MapPathType, type MapPoint, type MapPose, type MapRestrictedArea, type MapRoom, type MapRoomWall, type MapRun, type MapSegment, type MapStorey, type MapVirtualWall, type MapWallsInfo, type MiotAction, MiotError, type MiotProp, MiotState, type MowerAvailableMap, type MowerCapabilities, MowerCapabilityResolver, MowerChargingStatus, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerZone, Nodreame, type NodreameDeps, type NodreameEvents, type NodreameOptions, type OssFetchInput, type OssFetcherLike, type PropertyChangedEvent, type PropertyResult, type PropertyState, type PropertyWrite, type RenderMowerSvgOptions, type RenderVacuumPngOptions, type StateChangedEvent, SuctionLevel, TaskStatus, VACUUM_CONSUMABLES, MODEL_CAPABILITIES$1 as VACUUM_MODEL_CAPABILITIES, type VacuumCapabilities, VacuumCapabilityResolver, VacuumDevice, type VacuumGetMapInput, type VacuumMap, WaterVolume, consumableSpec, createClientDumper, createDumper, decodeAiFeature, decodeAutoSwitch, decodeAutoSwitchAll, encodeAiFeatureWrite, encodeAutoSwitchWrite, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/support/version.ts
|
|
2
2
|
var LIBRARY_NAME = "nodedreame";
|
|
3
|
-
var LIBRARY_VERSION = "1.
|
|
3
|
+
var LIBRARY_VERSION = "1.8.0";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -1157,6 +1157,12 @@ var VACUUM_PROP = {
|
|
|
1157
1157
|
* via `ai-detection.ts` ({@link decodeAiFeature} / {@link encodeAiFeatureWrite}).
|
|
1158
1158
|
*/
|
|
1159
1159
|
AI_DETECTION: { siid: 4, piid: 22 },
|
|
1160
|
+
/**
|
|
1161
|
+
* Auto-switch settings bundle (Tasshack types.py — `AUTO_SWITCH_SETTINGS`,
|
|
1162
|
+
* siid 4 piid 50). A JSON string packing every secondary toggle/setting as
|
|
1163
|
+
* `[{"k":<key>,"v":<int>}, …]`. Decode/encode per-setting via `auto-switch.ts`.
|
|
1164
|
+
*/
|
|
1165
|
+
AUTO_SWITCH_SETTINGS: { siid: 4, piid: 50 },
|
|
1160
1166
|
/** VERIFIED r2532a 2026-05-03 — task progress percentage 0..100. */
|
|
1161
1167
|
TASK_PROGRESS_PCT: { siid: 4, piid: 63 },
|
|
1162
1168
|
/** VERIFIED r2532a — mop-drying progress (minutes ticking during MopDrying). */
|
|
@@ -1570,6 +1576,105 @@ function encodeAiFeatureWrite(raw, feature, value) {
|
|
|
1570
1576
|
);
|
|
1571
1577
|
}
|
|
1572
1578
|
|
|
1579
|
+
// src/models/vacuum/auto-switch.ts
|
|
1580
|
+
var AUTO_SWITCH_JSON_KEY = {
|
|
1581
|
+
collisionAvoidance: "LessColl",
|
|
1582
|
+
fillLight: "FillinLight",
|
|
1583
|
+
autoDrying: "AutoDry",
|
|
1584
|
+
stainAvoidance: "StainIdentify",
|
|
1585
|
+
moppingType: "CleanType",
|
|
1586
|
+
cleanGenius: "SmartHost",
|
|
1587
|
+
widerCornerCoverage: "MeticulousTwist",
|
|
1588
|
+
floorDirectionCleaning: "MaterialDirectionClean",
|
|
1589
|
+
petFocusedCleaning: "PetPartClean",
|
|
1590
|
+
autoRecleaning: "SmartAutoMop",
|
|
1591
|
+
autoRewashing: "SmartAutoWash",
|
|
1592
|
+
mopPadSwing: "MopScalable",
|
|
1593
|
+
autoCharging: "SmartCharge",
|
|
1594
|
+
humanFollow: "MonitorHumanFollow",
|
|
1595
|
+
maxSuctionPower: "SuctionMax",
|
|
1596
|
+
smartDrying: "SmartDrying",
|
|
1597
|
+
drainageConfirmResult: "FluctuationConfirmResult",
|
|
1598
|
+
drainageTestResult: "FluctuationTestResult",
|
|
1599
|
+
hotWashing: "HotWash",
|
|
1600
|
+
uvSterilization: "UVLight",
|
|
1601
|
+
cleaningRoute: "CleanRoute",
|
|
1602
|
+
customMoppingMode: "MopEffectSwitch",
|
|
1603
|
+
moppingMode: "MopEffectState",
|
|
1604
|
+
selfCleanFrequency: "BackWashType",
|
|
1605
|
+
intensiveCarpetCleaning: "CarpetFineClean",
|
|
1606
|
+
gapCleaningExtension: "LacuneMopScalable",
|
|
1607
|
+
moppingUnderFurnitures: "MopScalable2",
|
|
1608
|
+
ultraCleanMode: "SuperWash",
|
|
1609
|
+
streamingVoicePrompt: "MonitorPromptLevel",
|
|
1610
|
+
mopExtend: "MopExtrSwitch",
|
|
1611
|
+
mopExtendFrequency: "ExtrFreq",
|
|
1612
|
+
sideReach: "SbrushExtrSwitch",
|
|
1613
|
+
intelligentStainCleaning: "HeavyStainSmart"
|
|
1614
|
+
};
|
|
1615
|
+
var JSON_KEY_TO_CANONICAL = Object.fromEntries(
|
|
1616
|
+
Object.entries(AUTO_SWITCH_JSON_KEY).map(([k, v]) => [v, k])
|
|
1617
|
+
);
|
|
1618
|
+
function coerceInt(v) {
|
|
1619
|
+
if (typeof v === "number") return Number.isFinite(v) ? v : null;
|
|
1620
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
1621
|
+
const n = Number(v);
|
|
1622
|
+
return Number.isFinite(n) ? n : null;
|
|
1623
|
+
}
|
|
1624
|
+
return null;
|
|
1625
|
+
}
|
|
1626
|
+
function parseAutoSwitchMap(raw) {
|
|
1627
|
+
if (typeof raw !== "string" || raw.length <= 2) return null;
|
|
1628
|
+
let parsed;
|
|
1629
|
+
try {
|
|
1630
|
+
parsed = JSON.parse(raw);
|
|
1631
|
+
} catch {
|
|
1632
|
+
return null;
|
|
1633
|
+
}
|
|
1634
|
+
const out = /* @__PURE__ */ new Map();
|
|
1635
|
+
const add = (entry) => {
|
|
1636
|
+
if (entry === null || typeof entry !== "object") return;
|
|
1637
|
+
const rec = entry;
|
|
1638
|
+
if (typeof rec["k"] !== "string") return;
|
|
1639
|
+
const value = coerceInt(rec["v"]);
|
|
1640
|
+
if (value !== null) out.set(rec["k"], value);
|
|
1641
|
+
};
|
|
1642
|
+
if (Array.isArray(parsed)) {
|
|
1643
|
+
for (const entry of parsed) add(entry);
|
|
1644
|
+
} else {
|
|
1645
|
+
add(parsed);
|
|
1646
|
+
}
|
|
1647
|
+
return out.size > 0 ? out : null;
|
|
1648
|
+
}
|
|
1649
|
+
function decodeAutoSwitch(raw, key2) {
|
|
1650
|
+
const map = parseAutoSwitchMap(raw);
|
|
1651
|
+
if (map === null) return null;
|
|
1652
|
+
const jsonKey = AUTO_SWITCH_JSON_KEY[key2];
|
|
1653
|
+
return map.has(jsonKey) ? map.get(jsonKey) ?? null : null;
|
|
1654
|
+
}
|
|
1655
|
+
function supportedAutoSwitchKeys(raw) {
|
|
1656
|
+
const map = parseAutoSwitchMap(raw);
|
|
1657
|
+
if (map === null) return [];
|
|
1658
|
+
const present = [];
|
|
1659
|
+
for (const key2 of Object.keys(AUTO_SWITCH_JSON_KEY)) {
|
|
1660
|
+
if (map.has(AUTO_SWITCH_JSON_KEY[key2])) present.push(key2);
|
|
1661
|
+
}
|
|
1662
|
+
return present;
|
|
1663
|
+
}
|
|
1664
|
+
function decodeAutoSwitchAll(raw) {
|
|
1665
|
+
const map = parseAutoSwitchMap(raw);
|
|
1666
|
+
if (map === null) return {};
|
|
1667
|
+
const out = {};
|
|
1668
|
+
for (const [jsonKey, value] of map) {
|
|
1669
|
+
const canonical = JSON_KEY_TO_CANONICAL[jsonKey];
|
|
1670
|
+
if (canonical !== void 0) out[canonical] = value;
|
|
1671
|
+
}
|
|
1672
|
+
return out;
|
|
1673
|
+
}
|
|
1674
|
+
function encodeAutoSwitchWrite(key2, value) {
|
|
1675
|
+
return JSON.stringify({ k: AUTO_SWITCH_JSON_KEY[key2], v: Math.trunc(value) });
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1573
1678
|
// src/models/vacuum/consumables.ts
|
|
1574
1679
|
var VACUUM_CONSUMABLES = [
|
|
1575
1680
|
{ key: "main-brush", label: "Main Brush", life: { siid: 9, piid: 2 }, reset: { siid: 9, aiid: 1 } },
|
|
@@ -2886,6 +2991,63 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
2886
2991
|
const next = encodeAiFeatureWrite(this.aiDetectionRaw, feature, value);
|
|
2887
2992
|
return this.setProperty({ ...VACUUM_PROP.AI_DETECTION, value: next });
|
|
2888
2993
|
}
|
|
2994
|
+
// -- auto-switch settings -----------------------------------------------
|
|
2995
|
+
/**
|
|
2996
|
+
* The raw `AUTO_SWITCH_SETTINGS` value (siid 4 piid 50) — a JSON string packing
|
|
2997
|
+
* every secondary toggle/setting — or `null` when not yet observed. Prefer the
|
|
2998
|
+
* decoded {@link autoSwitchProperty} / {@link supportedAutoSwitchKeys} surface.
|
|
2999
|
+
*/
|
|
3000
|
+
get autoSwitchRaw() {
|
|
3001
|
+
const v = this.getProperty(
|
|
3002
|
+
VACUUM_PROP.AUTO_SWITCH_SETTINGS.siid,
|
|
3003
|
+
VACUUM_PROP.AUTO_SWITCH_SETTINGS.piid
|
|
3004
|
+
)?.value;
|
|
3005
|
+
return typeof v === "string" ? v : null;
|
|
3006
|
+
}
|
|
3007
|
+
/** Whether this model reports the packed auto-switch bundle at all. */
|
|
3008
|
+
get hasAutoSwitchSettings() {
|
|
3009
|
+
return this.autoSwitchRaw !== null;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* The auto-switch settings this model reports, decoded from the packed value.
|
|
3013
|
+
* Presence-driven (a key appears iff the payload carries it) — mirrors
|
|
3014
|
+
* Tasshack `auto_switch_data`.
|
|
3015
|
+
*/
|
|
3016
|
+
get supportedAutoSwitchKeys() {
|
|
3017
|
+
return supportedAutoSwitchKeys(this.autoSwitchRaw);
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Read ONE auto-switch setting's int value, decoded from the packed
|
|
3021
|
+
* `AUTO_SWITCH_SETTINGS` payload. `null` when the value is unobserved or the
|
|
3022
|
+
* key is not present. The value is an opaque int (boolean 0/1, a small enum, or
|
|
3023
|
+
* a `-1`/`-n` "not applicable" sentinel) — the caller interprets it.
|
|
3024
|
+
*/
|
|
3025
|
+
autoSwitchProperty(key2) {
|
|
3026
|
+
return decodeAutoSwitch(this.autoSwitchRaw, key2);
|
|
3027
|
+
}
|
|
3028
|
+
/**
|
|
3029
|
+
* Seed {@link autoSwitchRaw} from the CLOUD SHADOW (the last value the robot
|
|
3030
|
+
* pushed for `AUTO_SWITCH_SETTINGS`, siid 4 piid 50) WITHOUT waking it. Like the
|
|
3031
|
+
* AI bundle these are STATIC settings the robot rarely re-pushes over MQTT, so a
|
|
3032
|
+
* fresh connect to an idle robot has no value cached — call this on activate to
|
|
3033
|
+
* surface the current settings. Returns the resolved raw value (`null` when the
|
|
3034
|
+
* shadow carries none yet).
|
|
3035
|
+
*/
|
|
3036
|
+
async refreshAutoSwitch() {
|
|
3037
|
+
await this.refreshCachedProperties([VACUUM_PROP.AUTO_SWITCH_SETTINGS]);
|
|
3038
|
+
return this.autoSwitchRaw;
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Set ONE auto-switch setting. Mirrors Tasshack `set_auto_switch_property`: a
|
|
3042
|
+
* single-key `{"k":<key>,"v":<int>}` write the device merges server-side (the
|
|
3043
|
+
* other settings are preserved without a read-modify-write). Rejects when the
|
|
3044
|
+
* model does not report the bundle.
|
|
3045
|
+
*/
|
|
3046
|
+
async setAutoSwitchProperty(key2, value) {
|
|
3047
|
+
this.#requireCap(this.hasAutoSwitchSettings, "setAutoSwitchProperty", "auto-switch settings");
|
|
3048
|
+
const next = encodeAutoSwitchWrite(key2, value);
|
|
3049
|
+
return this.setProperty({ ...VACUUM_PROP.AUTO_SWITCH_SETTINGS, value: next });
|
|
3050
|
+
}
|
|
2889
3051
|
// -- command helpers ----------------------------------------------------
|
|
2890
3052
|
#resolveCleanOpts(opts) {
|
|
2891
3053
|
const repeats = Math.max(1, Math.trunc(opts.repeats ?? 1));
|
|
@@ -4800,6 +4962,7 @@ function createClientDumper(client, options) {
|
|
|
4800
4962
|
export {
|
|
4801
4963
|
AI_FEATURE_BIT,
|
|
4802
4964
|
AI_FEATURE_JSON_KEY,
|
|
4965
|
+
AUTO_SWITCH_JSON_KEY,
|
|
4803
4966
|
BaseDevice,
|
|
4804
4967
|
ChargingStatus,
|
|
4805
4968
|
CleaningMode,
|
|
@@ -4832,12 +4995,16 @@ export {
|
|
|
4832
4995
|
createClientDumper,
|
|
4833
4996
|
createDumper,
|
|
4834
4997
|
decodeAiFeature,
|
|
4998
|
+
decodeAutoSwitch,
|
|
4999
|
+
decodeAutoSwitchAll,
|
|
4835
5000
|
encodeAiFeatureWrite,
|
|
5001
|
+
encodeAutoSwitchWrite,
|
|
4836
5002
|
getMowerCapabilities,
|
|
4837
5003
|
getVacuumCapabilities,
|
|
4838
5004
|
isDreameConsumableKey,
|
|
4839
5005
|
renderMowerSvg,
|
|
4840
5006
|
renderVacuumPng,
|
|
4841
|
-
resolveCapabilities
|
|
5007
|
+
resolveCapabilities,
|
|
5008
|
+
supportedAutoSwitchKeys
|
|
4842
5009
|
};
|
|
4843
5010
|
//# sourceMappingURL=index.js.map
|