@apocaliss92/nodedreame 1.11.5 → 1.11.9
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 +209 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +207 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1815,6 +1815,14 @@ declare enum MowerFault {
|
|
|
1815
1815
|
PauseTimeoutReturning = 72,// INFO
|
|
1816
1816
|
TopCoverOpen = 73
|
|
1817
1817
|
}
|
|
1818
|
+
/** Severity class of a mower DEVICE_CODE (2:2 / {@link MowerFault}). */
|
|
1819
|
+
type MowerFaultSeverity = 'info' | 'warning' | 'error';
|
|
1820
|
+
/**
|
|
1821
|
+
* Classify a mower device-code by severity, matching the INFO/WARNING/ERROR
|
|
1822
|
+
* annotations on {@link MowerFault}. Most codes are status/INFO (e.g. 50
|
|
1823
|
+
* TaskStart); only a subset are actionable. Unknown codes default to `info`.
|
|
1824
|
+
*/
|
|
1825
|
+
declare function mowerFaultSeverity(code: number | null): MowerFaultSeverity;
|
|
1818
1826
|
|
|
1819
1827
|
/**
|
|
1820
1828
|
* Cast-free mower decoders. Re-exports the shared numeric primitives, and adds
|
|
@@ -1891,6 +1899,28 @@ interface MowerHeartbeat {
|
|
|
1891
1899
|
* main state there is no active mowing task (returns `taskSubState: null`).
|
|
1892
1900
|
*/
|
|
1893
1901
|
declare function parseMowerHeartbeat(value: unknown): MowerHeartbeat | null;
|
|
1902
|
+
/** Decoded mowing-progress signal from the POSE_COVERAGE (1:4) `task` block. */
|
|
1903
|
+
interface MowerMowingProgress {
|
|
1904
|
+
/** 0..100 — overall mowing completion. */
|
|
1905
|
+
readonly progressPercent: number;
|
|
1906
|
+
/** Already-finished area in m². */
|
|
1907
|
+
readonly currentAreaSqm: number;
|
|
1908
|
+
/** Total target area in m². */
|
|
1909
|
+
readonly totalAreaSqm: number;
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Locate the 10-byte `task` block inside a POSE_COVERAGE (1:4) frame and decode
|
|
1913
|
+
* the mowing progress. Frame shapes (ported from antondaubert/dreame-mower
|
|
1914
|
+
* `pose_coverage.py`):
|
|
1915
|
+
* - sentinel-framed `[CE] pose(6) trace(15) task(10) [CE]` (33B) / `…task(10) trace2(11) [CE]` (44B)
|
|
1916
|
+
* → task at offset 22;
|
|
1917
|
+
* - alt `task(10) [CE] [+trace]` (no leading sentinel, ≥11B) → task at offset 0.
|
|
1918
|
+
* The 22B `[CE] pose trace` and 13B `[CE] pose extra` shapes carry NO task → null.
|
|
1919
|
+
*
|
|
1920
|
+
* `task` layout: `[2:4] percent u16LE (value×100) [4:7] total u24LE (centi-m²)
|
|
1921
|
+
* [7:10] finished u24LE (centi-m²)`.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function parseMowingProgress(value: unknown): MowerMowingProgress | null;
|
|
1894
1924
|
|
|
1895
1925
|
/**
|
|
1896
1926
|
* Per-model mower capability records + a resolver adapting the rich record into
|
|
@@ -2110,6 +2140,17 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2110
2140
|
* This is the P4 progress surface; the byte-accurate pose-track % is P5.
|
|
2111
2141
|
*/
|
|
2112
2142
|
get coverageTargetPct(): number | null;
|
|
2143
|
+
/**
|
|
2144
|
+
* Live mowing PROGRESS decoded from the POSE_COVERAGE (1:4) task block —
|
|
2145
|
+
* `{progressPercent, currentAreaSqm, totalAreaSqm}` — or null when 1:4 carries
|
|
2146
|
+
* no task block (idle / pose-only frame). This is the byte-accurate progress
|
|
2147
|
+
* the Dreamehome app shows (vs {@link coverageTargetPct}, the task TARGET).
|
|
2148
|
+
*/
|
|
2149
|
+
get mowingProgress(): MowerMowingProgress | null;
|
|
2150
|
+
/** Mowing completion percent (0..100) from {@link mowingProgress}, or null. */
|
|
2151
|
+
get mowingProgressPct(): number | null;
|
|
2152
|
+
/** Severity of the current DEVICE_CODE (2:2) — info / warning / error. */
|
|
2153
|
+
get faultSeverity(): MowerFaultSeverity;
|
|
2113
2154
|
/** Parsed per-zone control status (2:56), or null. */
|
|
2114
2155
|
get controlStatus(): MowerControlState | null;
|
|
2115
2156
|
get controlAction(): MowerControlAction | null;
|
|
@@ -2137,6 +2178,14 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2137
2178
|
startMowingEdges(contourIds: number[][]): Promise<unknown>;
|
|
2138
2179
|
/** Spot mowing (2:50 o:103). */
|
|
2139
2180
|
startMowingSpots(spotAreaIds: number[]): Promise<unknown>;
|
|
2181
|
+
/**
|
|
2182
|
+
* Switch the mower's ACTIVE map (2:50 o:200). Takes a map *id* (as carried by
|
|
2183
|
+
* {@link MowerMap.availableMaps}/`currentMapId`) and resolves it to the
|
|
2184
|
+
* firmware's map *index* via the last-fetched map; falls back to treating the
|
|
2185
|
+
* id as the index when no map has been fetched yet. Mirrors the donor
|
|
2186
|
+
* `set_current_map`. Capability-gated on `canMap`.
|
|
2187
|
+
*/
|
|
2188
|
+
setCurrentMap(mapId: number): Promise<unknown>;
|
|
2140
2189
|
/**
|
|
2141
2190
|
* Read the raw CMS consumable counters `[blade, brush, robot]` (minutes used),
|
|
2142
2191
|
* via the SCHEDULING_TASK (2:50) custom-action getter `{m:'g',t:'CMS'}`. This
|
|
@@ -2187,6 +2236,9 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2187
2236
|
static readonly DEFAULT_PROPS: readonly [{
|
|
2188
2237
|
readonly siid: 1;
|
|
2189
2238
|
readonly piid: 1;
|
|
2239
|
+
}, {
|
|
2240
|
+
readonly siid: 1;
|
|
2241
|
+
readonly piid: 4;
|
|
2190
2242
|
}, {
|
|
2191
2243
|
readonly siid: 2;
|
|
2192
2244
|
readonly piid: 1;
|
|
@@ -2546,4 +2598,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2546
2598
|
*/
|
|
2547
2599
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2548
2600
|
|
|
2549
|
-
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, MOWER_TASK_SUBSTATES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapColorScheme, 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 MowerConsumableKey, type MowerConsumableReading, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerHeartbeat, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerTaskSubState, 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, parseMowerConsumables, parseMowerHeartbeat, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
|
2601
|
+
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, MOWER_TASK_SUBSTATES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapColorScheme, 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 MowerConsumableKey, type MowerConsumableReading, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerFaultSeverity, type MowerHeartbeat, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerMowingProgress, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerTaskSubState, 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, mowerFaultSeverity, parseMowerConsumables, parseMowerHeartbeat, parseMowingProgress, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -1815,6 +1815,14 @@ declare enum MowerFault {
|
|
|
1815
1815
|
PauseTimeoutReturning = 72,// INFO
|
|
1816
1816
|
TopCoverOpen = 73
|
|
1817
1817
|
}
|
|
1818
|
+
/** Severity class of a mower DEVICE_CODE (2:2 / {@link MowerFault}). */
|
|
1819
|
+
type MowerFaultSeverity = 'info' | 'warning' | 'error';
|
|
1820
|
+
/**
|
|
1821
|
+
* Classify a mower device-code by severity, matching the INFO/WARNING/ERROR
|
|
1822
|
+
* annotations on {@link MowerFault}. Most codes are status/INFO (e.g. 50
|
|
1823
|
+
* TaskStart); only a subset are actionable. Unknown codes default to `info`.
|
|
1824
|
+
*/
|
|
1825
|
+
declare function mowerFaultSeverity(code: number | null): MowerFaultSeverity;
|
|
1818
1826
|
|
|
1819
1827
|
/**
|
|
1820
1828
|
* Cast-free mower decoders. Re-exports the shared numeric primitives, and adds
|
|
@@ -1891,6 +1899,28 @@ interface MowerHeartbeat {
|
|
|
1891
1899
|
* main state there is no active mowing task (returns `taskSubState: null`).
|
|
1892
1900
|
*/
|
|
1893
1901
|
declare function parseMowerHeartbeat(value: unknown): MowerHeartbeat | null;
|
|
1902
|
+
/** Decoded mowing-progress signal from the POSE_COVERAGE (1:4) `task` block. */
|
|
1903
|
+
interface MowerMowingProgress {
|
|
1904
|
+
/** 0..100 — overall mowing completion. */
|
|
1905
|
+
readonly progressPercent: number;
|
|
1906
|
+
/** Already-finished area in m². */
|
|
1907
|
+
readonly currentAreaSqm: number;
|
|
1908
|
+
/** Total target area in m². */
|
|
1909
|
+
readonly totalAreaSqm: number;
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Locate the 10-byte `task` block inside a POSE_COVERAGE (1:4) frame and decode
|
|
1913
|
+
* the mowing progress. Frame shapes (ported from antondaubert/dreame-mower
|
|
1914
|
+
* `pose_coverage.py`):
|
|
1915
|
+
* - sentinel-framed `[CE] pose(6) trace(15) task(10) [CE]` (33B) / `…task(10) trace2(11) [CE]` (44B)
|
|
1916
|
+
* → task at offset 22;
|
|
1917
|
+
* - alt `task(10) [CE] [+trace]` (no leading sentinel, ≥11B) → task at offset 0.
|
|
1918
|
+
* The 22B `[CE] pose trace` and 13B `[CE] pose extra` shapes carry NO task → null.
|
|
1919
|
+
*
|
|
1920
|
+
* `task` layout: `[2:4] percent u16LE (value×100) [4:7] total u24LE (centi-m²)
|
|
1921
|
+
* [7:10] finished u24LE (centi-m²)`.
|
|
1922
|
+
*/
|
|
1923
|
+
declare function parseMowingProgress(value: unknown): MowerMowingProgress | null;
|
|
1894
1924
|
|
|
1895
1925
|
/**
|
|
1896
1926
|
* Per-model mower capability records + a resolver adapting the rich record into
|
|
@@ -2110,6 +2140,17 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2110
2140
|
* This is the P4 progress surface; the byte-accurate pose-track % is P5.
|
|
2111
2141
|
*/
|
|
2112
2142
|
get coverageTargetPct(): number | null;
|
|
2143
|
+
/**
|
|
2144
|
+
* Live mowing PROGRESS decoded from the POSE_COVERAGE (1:4) task block —
|
|
2145
|
+
* `{progressPercent, currentAreaSqm, totalAreaSqm}` — or null when 1:4 carries
|
|
2146
|
+
* no task block (idle / pose-only frame). This is the byte-accurate progress
|
|
2147
|
+
* the Dreamehome app shows (vs {@link coverageTargetPct}, the task TARGET).
|
|
2148
|
+
*/
|
|
2149
|
+
get mowingProgress(): MowerMowingProgress | null;
|
|
2150
|
+
/** Mowing completion percent (0..100) from {@link mowingProgress}, or null. */
|
|
2151
|
+
get mowingProgressPct(): number | null;
|
|
2152
|
+
/** Severity of the current DEVICE_CODE (2:2) — info / warning / error. */
|
|
2153
|
+
get faultSeverity(): MowerFaultSeverity;
|
|
2113
2154
|
/** Parsed per-zone control status (2:56), or null. */
|
|
2114
2155
|
get controlStatus(): MowerControlState | null;
|
|
2115
2156
|
get controlAction(): MowerControlAction | null;
|
|
@@ -2137,6 +2178,14 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2137
2178
|
startMowingEdges(contourIds: number[][]): Promise<unknown>;
|
|
2138
2179
|
/** Spot mowing (2:50 o:103). */
|
|
2139
2180
|
startMowingSpots(spotAreaIds: number[]): Promise<unknown>;
|
|
2181
|
+
/**
|
|
2182
|
+
* Switch the mower's ACTIVE map (2:50 o:200). Takes a map *id* (as carried by
|
|
2183
|
+
* {@link MowerMap.availableMaps}/`currentMapId`) and resolves it to the
|
|
2184
|
+
* firmware's map *index* via the last-fetched map; falls back to treating the
|
|
2185
|
+
* id as the index when no map has been fetched yet. Mirrors the donor
|
|
2186
|
+
* `set_current_map`. Capability-gated on `canMap`.
|
|
2187
|
+
*/
|
|
2188
|
+
setCurrentMap(mapId: number): Promise<unknown>;
|
|
2140
2189
|
/**
|
|
2141
2190
|
* Read the raw CMS consumable counters `[blade, brush, robot]` (minutes used),
|
|
2142
2191
|
* via the SCHEDULING_TASK (2:50) custom-action getter `{m:'g',t:'CMS'}`. This
|
|
@@ -2187,6 +2236,9 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2187
2236
|
static readonly DEFAULT_PROPS: readonly [{
|
|
2188
2237
|
readonly siid: 1;
|
|
2189
2238
|
readonly piid: 1;
|
|
2239
|
+
}, {
|
|
2240
|
+
readonly siid: 1;
|
|
2241
|
+
readonly piid: 4;
|
|
2190
2242
|
}, {
|
|
2191
2243
|
readonly siid: 2;
|
|
2192
2244
|
readonly piid: 1;
|
|
@@ -2546,4 +2598,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2546
2598
|
*/
|
|
2547
2599
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2548
2600
|
|
|
2549
|
-
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, MOWER_TASK_SUBSTATES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapColorScheme, 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 MowerConsumableKey, type MowerConsumableReading, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerHeartbeat, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerTaskSubState, 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, parseMowerConsumables, parseMowerHeartbeat, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
|
2601
|
+
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, MOWER_TASK_SUBSTATES, type MapBoundingBox, type MapCleanedAreaOverlay, type MapColorScheme, 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 MowerConsumableKey, type MowerConsumableReading, type MowerContour, MowerControlAction, type MowerControlState, MowerDevice, type MowerDeviceInput, MowerFault, type MowerFaultSeverity, type MowerHeartbeat, type MowerMap, type MowerMapBoundary, type MowerMowPath, type MowerMowingProgress, type MowerPathEntry, type MowerPoint, type MowerSpotArea, MowerStatus, type MowerTaskDescriptor, MowerTaskStatus, type MowerTaskSubState, 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, mowerFaultSeverity, parseMowerConsumables, parseMowerHeartbeat, parseMowingProgress, 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.11.
|
|
3
|
+
var LIBRARY_VERSION = "1.11.9";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -299,6 +299,11 @@ var CachedPropsResponseSchema = z.object({
|
|
|
299
299
|
msg: z.string().nullish(),
|
|
300
300
|
data: z.array(CachedPropEntrySchema).optional()
|
|
301
301
|
}).passthrough();
|
|
302
|
+
var BatchDeviceDataResponseSchema = z.object({
|
|
303
|
+
code: z.number().optional(),
|
|
304
|
+
msg: z.string().nullish(),
|
|
305
|
+
data: z.record(z.string(), z.unknown()).optional()
|
|
306
|
+
}).passthrough();
|
|
302
307
|
var SendCommandResponseSchema = z.object({
|
|
303
308
|
code: z.number().optional(),
|
|
304
309
|
msg: z.string().nullish(),
|
|
@@ -559,6 +564,29 @@ async function callAction(base, action, opts = {}) {
|
|
|
559
564
|
const res = await sendCommand({ ...base, ...opts, method: "action", params });
|
|
560
565
|
return res.data?.result ?? res.result ?? res;
|
|
561
566
|
}
|
|
567
|
+
async function getBatchDeviceDatas(base, props, opts = {}) {
|
|
568
|
+
const ctx = base.ctx ?? RequestContext.from({ ...base, host: base.apiHost });
|
|
569
|
+
const signal = opts.signal ?? base.signal;
|
|
570
|
+
const timeoutMs = opts.timeoutMs ?? base.timeoutMs;
|
|
571
|
+
const raw = await httpPostJsonBody({
|
|
572
|
+
ctx,
|
|
573
|
+
path: "/dreame-user-iot/iotuserdata/getDeviceData",
|
|
574
|
+
accessToken: base.session.accessToken,
|
|
575
|
+
body: { did: base.did, model: props },
|
|
576
|
+
context: "batch device data",
|
|
577
|
+
...signal !== void 0 ? { signal } : {},
|
|
578
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {}
|
|
579
|
+
});
|
|
580
|
+
const parsed = BatchDeviceDataResponseSchema.parse(raw);
|
|
581
|
+
if (parsed.code !== void 0 && parsed.code !== 0) {
|
|
582
|
+
throw new DreameApiError(
|
|
583
|
+
`batch device data rejected: code=${parsed.code} msg=${parsed.msg ?? "?"}`,
|
|
584
|
+
200,
|
|
585
|
+
parsed
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
return parsed.data ?? {};
|
|
589
|
+
}
|
|
562
590
|
function extractResultArray(res, context) {
|
|
563
591
|
const raw = Array.isArray(res.data?.result) ? res.data.result : Array.isArray(res.result) ? res.result : null;
|
|
564
592
|
if (raw === null) {
|
|
@@ -2063,6 +2091,43 @@ function parseFrame(inflated) {
|
|
|
2063
2091
|
return { header, tail };
|
|
2064
2092
|
}
|
|
2065
2093
|
|
|
2094
|
+
// src/models/vacuum/map/segment-types.ts
|
|
2095
|
+
var SEGMENT_TYPE_CODE_TO_NAME = {
|
|
2096
|
+
0: "Room",
|
|
2097
|
+
1: "Living Room",
|
|
2098
|
+
2: "Primary Bedroom",
|
|
2099
|
+
3: "Study",
|
|
2100
|
+
4: "Kitchen",
|
|
2101
|
+
5: "Dining Hall",
|
|
2102
|
+
6: "Bathroom",
|
|
2103
|
+
7: "Balcony",
|
|
2104
|
+
8: "Corridor",
|
|
2105
|
+
9: "Utility Room",
|
|
2106
|
+
10: "Closet",
|
|
2107
|
+
11: "Meeting Room",
|
|
2108
|
+
12: "Office",
|
|
2109
|
+
13: "Fitness Area",
|
|
2110
|
+
14: "Recreation Area",
|
|
2111
|
+
15: "Secondary Bedroom"
|
|
2112
|
+
};
|
|
2113
|
+
function safeBase64ToUtf8(s) {
|
|
2114
|
+
try {
|
|
2115
|
+
return Buffer.from(s, "base64").toString("utf8");
|
|
2116
|
+
} catch {
|
|
2117
|
+
return null;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
function resolveSegmentName(type, index, customName) {
|
|
2121
|
+
if (type !== void 0 && type !== 0 && SEGMENT_TYPE_CODE_TO_NAME[type] !== void 0) {
|
|
2122
|
+
const base = SEGMENT_TYPE_CODE_TO_NAME[type];
|
|
2123
|
+
return index !== void 0 && index > 0 ? `${base} ${index + 1}` : base;
|
|
2124
|
+
}
|
|
2125
|
+
if (typeof customName === "string" && customName.length > 0) {
|
|
2126
|
+
return safeBase64ToUtf8(customName);
|
|
2127
|
+
}
|
|
2128
|
+
return null;
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2066
2131
|
// src/models/vacuum/map/pixel-grid.ts
|
|
2067
2132
|
function classifyPixelFsm1(byte) {
|
|
2068
2133
|
if (byte === 0) {
|
|
@@ -2208,7 +2273,9 @@ function collectSegments(layers, dim, tail) {
|
|
|
2208
2273
|
};
|
|
2209
2274
|
segs.push({
|
|
2210
2275
|
id,
|
|
2211
|
-
|
|
2276
|
+
// Mirror the donor: a room-type code (≠0) yields a localized default name
|
|
2277
|
+
// (e.g. "Kitchen"), else the user's custom base64 name, else null.
|
|
2278
|
+
name: resolveSegmentName(meta?.type, meta?.index, meta?.name),
|
|
2212
2279
|
bbox,
|
|
2213
2280
|
centroid,
|
|
2214
2281
|
neighbours: meta?.nei_id ?? [],
|
|
@@ -2219,13 +2286,6 @@ function collectSegments(layers, dim, tail) {
|
|
|
2219
2286
|
}
|
|
2220
2287
|
return segs;
|
|
2221
2288
|
}
|
|
2222
|
-
function safeBase64ToUtf8(s) {
|
|
2223
|
-
try {
|
|
2224
|
-
return Buffer.from(s, "base64").toString("utf8");
|
|
2225
|
-
} catch {
|
|
2226
|
-
return null;
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
2289
|
|
|
2230
2290
|
// src/models/vacuum/map/path.ts
|
|
2231
2291
|
var PATH_TYPE_FROM_OP = {
|
|
@@ -2771,18 +2831,27 @@ function decodeVacuumMap(input, opts = {}) {
|
|
|
2771
2831
|
const pixelGrid = inflated.subarray(pixelStart, pixelEnd);
|
|
2772
2832
|
const canDecodePixels = header.frameType === "I" && pixelGrid.length === header.width * header.height;
|
|
2773
2833
|
const layers = canDecodePixels ? decodePixelGridFsm1(pixelGrid, header.width, header.height) : [];
|
|
2774
|
-
const segments = canDecodePixels ? collectSegments(layers, dimensions, tail) : [];
|
|
2775
2834
|
const paths = parsePathTr(tail.tr ?? "");
|
|
2776
2835
|
const obstacles = parseObstacles(tail.ai_obstacle ?? []);
|
|
2777
2836
|
let geometry = parseTailGeometry(tail);
|
|
2778
|
-
|
|
2837
|
+
let segTail = tail;
|
|
2838
|
+
const outerHasNames = Object.values(tail.seg_inf ?? {}).some(
|
|
2839
|
+
(m) => typeof m?.name === "string" && m.name.length > 0
|
|
2840
|
+
);
|
|
2841
|
+
if ((!isGeometryComplete(geometry) || !outerHasNames) && typeof tail.rism === "string" && tail.rism.length > 0) {
|
|
2779
2842
|
try {
|
|
2780
2843
|
const innerInflated = unwrapEnvelope(tail.rism);
|
|
2781
2844
|
const { tail: innerTail } = parseFrame(innerInflated);
|
|
2782
|
-
|
|
2845
|
+
if (!isGeometryComplete(geometry)) {
|
|
2846
|
+
geometry = coalesceGeometry(geometry, parseTailGeometry(innerTail));
|
|
2847
|
+
}
|
|
2848
|
+
if (!outerHasNames && innerTail.seg_inf) {
|
|
2849
|
+
segTail = mergeSegInfNames(tail, innerTail.seg_inf);
|
|
2850
|
+
}
|
|
2783
2851
|
} catch {
|
|
2784
2852
|
}
|
|
2785
2853
|
}
|
|
2854
|
+
const segments = canDecodePixels ? collectSegments(layers, dimensions, segTail) : [];
|
|
2786
2855
|
const cleanedArea = typeof tail.decmap === "string" ? parseCleanedAreaOverlay(tail.decmap) : null;
|
|
2787
2856
|
return {
|
|
2788
2857
|
mapId: header.mapId,
|
|
@@ -2806,6 +2875,18 @@ function applyVacuumPFrame(prev, pframe, opts = {}) {
|
|
|
2806
2875
|
const merged = typeof prev === "string" || typeof pframe === "string" ? mergePFrameEnvelope(prev, pframe, opts.prev, opts.pframe) : mergePFrame(prev, pframe);
|
|
2807
2876
|
return { buffer: merged, data: decodeVacuumMap(merged) };
|
|
2808
2877
|
}
|
|
2878
|
+
function mergeSegInfNames(tail, innerSegInf) {
|
|
2879
|
+
const outer = tail.seg_inf ?? {};
|
|
2880
|
+
const ids = /* @__PURE__ */ new Set([...Object.keys(outer), ...Object.keys(innerSegInf)]);
|
|
2881
|
+
const merged = {};
|
|
2882
|
+
for (const id of ids) {
|
|
2883
|
+
const o = outer[id] ?? {};
|
|
2884
|
+
const inner = innerSegInf[id] ?? {};
|
|
2885
|
+
const name = typeof o.name === "string" && o.name.length > 0 ? o.name : inner.name;
|
|
2886
|
+
merged[id] = { ...inner, ...o, ...name !== void 0 ? { name } : {} };
|
|
2887
|
+
}
|
|
2888
|
+
return { ...tail, seg_inf: merged };
|
|
2889
|
+
}
|
|
2809
2890
|
function mergeDimensions(header, tail) {
|
|
2810
2891
|
const left = tail.origin?.[0] ?? header.left;
|
|
2811
2892
|
const top = tail.origin?.[1] ?? header.top;
|
|
@@ -2966,8 +3047,12 @@ function renderVacuumPng(map, opts = {}) {
|
|
|
2966
3047
|
const byType = opts.colorObstaclesByType !== false;
|
|
2967
3048
|
for (const ob of map.obstacles) {
|
|
2968
3049
|
const p = worldToPx(ob.x, ob.y, dim, scale);
|
|
2969
|
-
const
|
|
2970
|
-
|
|
3050
|
+
const r = Math.max(2, scale * 2);
|
|
3051
|
+
if (byType) {
|
|
3052
|
+
drawObstacleShape(png, p.x, p.y, r, ob.type, obstacleColor(ob.type));
|
|
3053
|
+
} else {
|
|
3054
|
+
drawDiamond(png, p.x, p.y, r, pal.obstacle);
|
|
3055
|
+
}
|
|
2971
3056
|
}
|
|
2972
3057
|
}
|
|
2973
3058
|
if (opts.showCharger !== false && map.dock !== null) {
|
|
@@ -3128,6 +3213,32 @@ function obstacleColor(type) {
|
|
|
3128
3213
|
const hue = Math.abs(Math.trunc(type)) * 47 % 360;
|
|
3129
3214
|
return hsvToRgba(hue, 0.85, 0.95);
|
|
3130
3215
|
}
|
|
3216
|
+
function drawSquare(png, cx, cy, r, color) {
|
|
3217
|
+
fillRect(png, cx - r, cy - r, cx + r, cy + r, color);
|
|
3218
|
+
}
|
|
3219
|
+
function drawTriangle(png, cx, cy, r, color) {
|
|
3220
|
+
for (let dy = -r; dy <= r; dy += 1) {
|
|
3221
|
+
const w = Math.round((dy + r) / (2 * r) * r);
|
|
3222
|
+
for (let dx = -w; dx <= w; dx += 1) {
|
|
3223
|
+
setPixel(png, cx + dx, cy + dy, color);
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
function drawObstacleShape(png, cx, cy, r, type, color) {
|
|
3228
|
+
switch (Math.abs(Math.trunc(type)) % 4) {
|
|
3229
|
+
case 0:
|
|
3230
|
+
drawDiamond(png, cx, cy, r, color);
|
|
3231
|
+
return;
|
|
3232
|
+
case 1:
|
|
3233
|
+
drawSquare(png, cx, cy, r, color);
|
|
3234
|
+
return;
|
|
3235
|
+
case 2:
|
|
3236
|
+
drawTriangle(png, cx, cy, r, color);
|
|
3237
|
+
return;
|
|
3238
|
+
default:
|
|
3239
|
+
drawDisk(png, cx, cy, r, color);
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3131
3242
|
var FURNITURE_LINE = [150, 110, 200, 235];
|
|
3132
3243
|
function paintFurnitureZone(png, points, dim, scale) {
|
|
3133
3244
|
if (points.length < 2) return;
|
|
@@ -3970,7 +4081,8 @@ var TASK_OPCODE = {
|
|
|
3970
4081
|
ALL_AREA: 100,
|
|
3971
4082
|
EDGE: 101,
|
|
3972
4083
|
ZONE: 102,
|
|
3973
|
-
SPOT: 103
|
|
4084
|
+
SPOT: 103,
|
|
4085
|
+
SET_CURRENT_MAP: 200
|
|
3974
4086
|
};
|
|
3975
4087
|
function buildResumePayload() {
|
|
3976
4088
|
return { m: "a", p: 0, o: 5 };
|
|
@@ -3987,6 +4099,9 @@ function buildEdgePayload(contourIds) {
|
|
|
3987
4099
|
function buildSpotPayload(spotAreaIds) {
|
|
3988
4100
|
return { m: "a", p: 0, o: TASK_OPCODE.SPOT, d: { area: [...spotAreaIds] } };
|
|
3989
4101
|
}
|
|
4102
|
+
function buildSetCurrentMapPayload(mapIndex) {
|
|
4103
|
+
return { m: "a", p: 0, o: TASK_OPCODE.SET_CURRENT_MAP, d: { idx: mapIndex } };
|
|
4104
|
+
}
|
|
3990
4105
|
function buildGetConsumablePayload() {
|
|
3991
4106
|
return { m: "g", t: "CMS" };
|
|
3992
4107
|
}
|
|
@@ -4112,6 +4227,12 @@ var MowerFault = /* @__PURE__ */ ((MowerFault2) => {
|
|
|
4112
4227
|
MowerFault2[MowerFault2["TopCoverOpen"] = 73] = "TopCoverOpen";
|
|
4113
4228
|
return MowerFault2;
|
|
4114
4229
|
})(MowerFault || {});
|
|
4230
|
+
function mowerFaultSeverity(code) {
|
|
4231
|
+
if (code === null) return "info";
|
|
4232
|
+
if (code >= 1 && code <= 30 || code === 37 || code === 73) return "error";
|
|
4233
|
+
if (code >= 31 && code <= 36 || code >= 38 && code <= 45) return "warning";
|
|
4234
|
+
return "info";
|
|
4235
|
+
}
|
|
4115
4236
|
|
|
4116
4237
|
// src/models/mower/decode.ts
|
|
4117
4238
|
function isRecord2(v) {
|
|
@@ -4322,6 +4443,37 @@ function parseMowerHeartbeat(value) {
|
|
|
4322
4443
|
const taskSubState = mainState === HEARTBEAT_MAIN_STATE_MOWING ? MOWER_TASK_SUBSTATES[subStateRaw - HEARTBEAT_SUBSTATE_BASE] ?? null : null;
|
|
4323
4444
|
return { rawBattery, mainState, subStateRaw, taskSubState };
|
|
4324
4445
|
}
|
|
4446
|
+
var POSE_SENTINEL = 206;
|
|
4447
|
+
function poseBytes(value) {
|
|
4448
|
+
if (!Array.isArray(value)) return null;
|
|
4449
|
+
const bytes = [];
|
|
4450
|
+
for (const b of value) {
|
|
4451
|
+
if (typeof b !== "number") return null;
|
|
4452
|
+
bytes.push(b);
|
|
4453
|
+
}
|
|
4454
|
+
return bytes;
|
|
4455
|
+
}
|
|
4456
|
+
function parseMowingProgress(value) {
|
|
4457
|
+
const bytes = poseBytes(value);
|
|
4458
|
+
if (bytes === null || bytes.length < 11) return null;
|
|
4459
|
+
const last = bytes[bytes.length - 1];
|
|
4460
|
+
const head = bytes[0];
|
|
4461
|
+
let offset = null;
|
|
4462
|
+
if (head !== POSE_SENTINEL && last === POSE_SENTINEL) {
|
|
4463
|
+
offset = 0;
|
|
4464
|
+
} else if (head === POSE_SENTINEL && last === POSE_SENTINEL && bytes.length >= 33) {
|
|
4465
|
+
offset = 22;
|
|
4466
|
+
}
|
|
4467
|
+
if (offset === null || offset + 10 > bytes.length) return null;
|
|
4468
|
+
const rawPercent = (bytes[offset + 2] ?? 0) | (bytes[offset + 3] ?? 0) << 8;
|
|
4469
|
+
const total = (bytes[offset + 4] ?? 0) | (bytes[offset + 5] ?? 0) << 8 | (bytes[offset + 6] ?? 0) << 16;
|
|
4470
|
+
const finish = (bytes[offset + 7] ?? 0) | (bytes[offset + 8] ?? 0) << 8 | (bytes[offset + 9] ?? 0) << 16;
|
|
4471
|
+
return {
|
|
4472
|
+
progressPercent: rawPercent ? Math.min(100, rawPercent / 100) : 0,
|
|
4473
|
+
currentAreaSqm: finish / 100,
|
|
4474
|
+
totalAreaSqm: total / 100
|
|
4475
|
+
};
|
|
4476
|
+
}
|
|
4325
4477
|
|
|
4326
4478
|
// src/models/mower/capabilities.ts
|
|
4327
4479
|
var FALLBACK2 = {
|
|
@@ -4940,7 +5092,10 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
4940
5092
|
capabilities: input.capabilities ?? new MowerCapabilityResolver().resolve(input.device.model)
|
|
4941
5093
|
});
|
|
4942
5094
|
this.#caps = getMowerCapabilities(input.device.model);
|
|
4943
|
-
this.#fetchBatch = input.getBatchDeviceDatas ??
|
|
5095
|
+
this.#fetchBatch = input.getBatchDeviceDatas ?? ((did, props) => getBatchDeviceDatas(
|
|
5096
|
+
{ session: this.currentSession(), region: this.region, did },
|
|
5097
|
+
props
|
|
5098
|
+
));
|
|
4944
5099
|
}
|
|
4945
5100
|
/** Rich, mower-specific capability record. */
|
|
4946
5101
|
get mowerCapabilities() {
|
|
@@ -5021,6 +5176,25 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
5021
5176
|
get coverageTargetPct() {
|
|
5022
5177
|
return this.task?.coverageTarget ?? null;
|
|
5023
5178
|
}
|
|
5179
|
+
/**
|
|
5180
|
+
* Live mowing PROGRESS decoded from the POSE_COVERAGE (1:4) task block —
|
|
5181
|
+
* `{progressPercent, currentAreaSqm, totalAreaSqm}` — or null when 1:4 carries
|
|
5182
|
+
* no task block (idle / pose-only frame). This is the byte-accurate progress
|
|
5183
|
+
* the Dreamehome app shows (vs {@link coverageTargetPct}, the task TARGET).
|
|
5184
|
+
*/
|
|
5185
|
+
get mowingProgress() {
|
|
5186
|
+
return parseMowingProgress(
|
|
5187
|
+
this.getProperty(MOWER_PROP.POSE_COVERAGE.siid, MOWER_PROP.POSE_COVERAGE.piid)?.value
|
|
5188
|
+
);
|
|
5189
|
+
}
|
|
5190
|
+
/** Mowing completion percent (0..100) from {@link mowingProgress}, or null. */
|
|
5191
|
+
get mowingProgressPct() {
|
|
5192
|
+
return this.mowingProgress?.progressPercent ?? null;
|
|
5193
|
+
}
|
|
5194
|
+
/** Severity of the current DEVICE_CODE (2:2) — info / warning / error. */
|
|
5195
|
+
get faultSeverity() {
|
|
5196
|
+
return mowerFaultSeverity(this.faultRaw);
|
|
5197
|
+
}
|
|
5024
5198
|
/** Parsed per-zone control status (2:56), or null. */
|
|
5025
5199
|
get controlStatus() {
|
|
5026
5200
|
return parseControlStatus(
|
|
@@ -5100,6 +5274,20 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
5100
5274
|
}
|
|
5101
5275
|
return this.#sendTask(buildSpotPayload(spotAreaIds.map((s) => Math.trunc(s))));
|
|
5102
5276
|
}
|
|
5277
|
+
/**
|
|
5278
|
+
* Switch the mower's ACTIVE map (2:50 o:200). Takes a map *id* (as carried by
|
|
5279
|
+
* {@link MowerMap.availableMaps}/`currentMapId`) and resolves it to the
|
|
5280
|
+
* firmware's map *index* via the last-fetched map; falls back to treating the
|
|
5281
|
+
* id as the index when no map has been fetched yet. Mirrors the donor
|
|
5282
|
+
* `set_current_map`. Capability-gated on `canMap`.
|
|
5283
|
+
*/
|
|
5284
|
+
async setCurrentMap(mapId) {
|
|
5285
|
+
this.#requireCap(this.#caps.canMap, "setCurrentMap", "map switching");
|
|
5286
|
+
const id = Math.trunc(mapId);
|
|
5287
|
+
const entry = this.#lastMap?.availableMaps.find((m) => m.mapId === id);
|
|
5288
|
+
const index = entry?.mapIndex ?? id;
|
|
5289
|
+
return this.#sendTask(buildSetCurrentMapPayload(index));
|
|
5290
|
+
}
|
|
5103
5291
|
// -- CMS consumables ----------------------------------------------------
|
|
5104
5292
|
/**
|
|
5105
5293
|
* Read the raw CMS consumable counters `[blade, brush, robot]` (minutes used),
|
|
@@ -5200,6 +5388,7 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
5200
5388
|
/** Props worth seeding on start() / polling — exported for the facade. */
|
|
5201
5389
|
static DEFAULT_PROPS = [
|
|
5202
5390
|
MOWER_PROP.HEARTBEAT,
|
|
5391
|
+
MOWER_PROP.POSE_COVERAGE,
|
|
5203
5392
|
MOWER_PROP.STATUS,
|
|
5204
5393
|
MOWER_PROP.DEVICE_CODE,
|
|
5205
5394
|
MOWER_PROP.BATTERY,
|
|
@@ -5858,8 +6047,10 @@ export {
|
|
|
5858
6047
|
getVacuumCapabilities,
|
|
5859
6048
|
isDreameConsumableKey,
|
|
5860
6049
|
mowerConsumableIndex,
|
|
6050
|
+
mowerFaultSeverity,
|
|
5861
6051
|
parseMowerConsumables,
|
|
5862
6052
|
parseMowerHeartbeat,
|
|
6053
|
+
parseMowingProgress,
|
|
5863
6054
|
renderMowerSvg,
|
|
5864
6055
|
renderVacuumPng,
|
|
5865
6056
|
resolveCapabilities,
|