@apocaliss92/nodedreame 1.11.1 → 1.11.3
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 +108 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +106 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1849,6 +1849,31 @@ declare function extractMowerConsumableValues(result: unknown): number[] | null;
|
|
|
1849
1849
|
* maintenance) with remaining %. Returns null on a malformed response.
|
|
1850
1850
|
*/
|
|
1851
1851
|
declare function parseMowerConsumables(result: unknown): readonly MowerConsumableReading[] | null;
|
|
1852
|
+
/** Decoded mowing task sub-state (heartbeat byte 13), or null when no mowing
|
|
1853
|
+
* session is in progress. Ported from antondaubert/dreame-mower
|
|
1854
|
+
* `property_misc.py` Property11Handler. */
|
|
1855
|
+
type MowerTaskSubState = 'idle' | 'starting' | 'mowing' | 'paused' | 'finished' | 'failed' | 'exit' | 'returning-to-dock';
|
|
1856
|
+
/** Ordered sub-state table; the heartbeat encodes `subState = base + index`. */
|
|
1857
|
+
declare const MOWER_TASK_SUBSTATES: readonly MowerTaskSubState[];
|
|
1858
|
+
/** Typed heartbeat decode: battery byte, main-state, and (when mowing) the task
|
|
1859
|
+
* sub-state. */
|
|
1860
|
+
interface MowerHeartbeat {
|
|
1861
|
+
/** Raw battery byte (byte 11) — percent with a charging flag in the high bits. */
|
|
1862
|
+
readonly rawBattery: number;
|
|
1863
|
+
/** `(byte12 & 0x0F) - 1`; 4 = mowing. */
|
|
1864
|
+
readonly mainState: number;
|
|
1865
|
+
/** Raw sub-state byte (byte 13). */
|
|
1866
|
+
readonly subStateRaw: number;
|
|
1867
|
+
/** Decoded sub-state when a mowing session is active, else null. */
|
|
1868
|
+
readonly taskSubState: MowerTaskSubState | null;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Decode the 20-byte HEARTBEAT (1:1) blob. Returns null when the payload is not a
|
|
1872
|
+
* well-formed heartbeat (wrong length / missing 0xCE sentinels). The task
|
|
1873
|
+
* sub-state is only meaningful while `mainState === 4` (mowing); in any other
|
|
1874
|
+
* main state there is no active mowing task (returns `taskSubState: null`).
|
|
1875
|
+
*/
|
|
1876
|
+
declare function parseMowerHeartbeat(value: unknown): MowerHeartbeat | null;
|
|
1852
1877
|
|
|
1853
1878
|
/**
|
|
1854
1879
|
* Per-model mower capability records + a resolver adapting the rich record into
|
|
@@ -2053,6 +2078,14 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2053
2078
|
* code — which still surfaces as the raw number via {@link faultRaw}.
|
|
2054
2079
|
*/
|
|
2055
2080
|
get fault(): MowerFault | null;
|
|
2081
|
+
/**
|
|
2082
|
+
* Live mowing task sub-state decoded from the HEARTBEAT (1:1) blob —
|
|
2083
|
+
* idle/starting/mowing/paused/finished/failed/exit/returning-to-dock — or null
|
|
2084
|
+
* when no mowing session is in progress (or the heartbeat is absent). This is
|
|
2085
|
+
* the donor's "current task" sensor; the heartbeat is push-only (the mower does
|
|
2086
|
+
* not answer live reads), so it tracks the device while it is actively mowing.
|
|
2087
|
+
*/
|
|
2088
|
+
get taskSubState(): MowerTaskSubState | null;
|
|
2056
2089
|
/** Parsed scheduling task descriptor (2:50), or null. */
|
|
2057
2090
|
get task(): MowerTaskDescriptor | null;
|
|
2058
2091
|
/**
|
|
@@ -2135,6 +2168,9 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2135
2168
|
mapSvg(opts?: RenderMowerSvgOptions): Promise<string>;
|
|
2136
2169
|
/** Props worth seeding on start() / polling — exported for the facade. */
|
|
2137
2170
|
static readonly DEFAULT_PROPS: readonly [{
|
|
2171
|
+
readonly siid: 1;
|
|
2172
|
+
readonly piid: 1;
|
|
2173
|
+
}, {
|
|
2138
2174
|
readonly siid: 2;
|
|
2139
2175
|
readonly piid: 1;
|
|
2140
2176
|
}, {
|
|
@@ -2493,4 +2529,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2493
2529
|
*/
|
|
2494
2530
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2495
2531
|
|
|
2496
|
-
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 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 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, parseMowerConsumables, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
|
2532
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1849,6 +1849,31 @@ declare function extractMowerConsumableValues(result: unknown): number[] | null;
|
|
|
1849
1849
|
* maintenance) with remaining %. Returns null on a malformed response.
|
|
1850
1850
|
*/
|
|
1851
1851
|
declare function parseMowerConsumables(result: unknown): readonly MowerConsumableReading[] | null;
|
|
1852
|
+
/** Decoded mowing task sub-state (heartbeat byte 13), or null when no mowing
|
|
1853
|
+
* session is in progress. Ported from antondaubert/dreame-mower
|
|
1854
|
+
* `property_misc.py` Property11Handler. */
|
|
1855
|
+
type MowerTaskSubState = 'idle' | 'starting' | 'mowing' | 'paused' | 'finished' | 'failed' | 'exit' | 'returning-to-dock';
|
|
1856
|
+
/** Ordered sub-state table; the heartbeat encodes `subState = base + index`. */
|
|
1857
|
+
declare const MOWER_TASK_SUBSTATES: readonly MowerTaskSubState[];
|
|
1858
|
+
/** Typed heartbeat decode: battery byte, main-state, and (when mowing) the task
|
|
1859
|
+
* sub-state. */
|
|
1860
|
+
interface MowerHeartbeat {
|
|
1861
|
+
/** Raw battery byte (byte 11) — percent with a charging flag in the high bits. */
|
|
1862
|
+
readonly rawBattery: number;
|
|
1863
|
+
/** `(byte12 & 0x0F) - 1`; 4 = mowing. */
|
|
1864
|
+
readonly mainState: number;
|
|
1865
|
+
/** Raw sub-state byte (byte 13). */
|
|
1866
|
+
readonly subStateRaw: number;
|
|
1867
|
+
/** Decoded sub-state when a mowing session is active, else null. */
|
|
1868
|
+
readonly taskSubState: MowerTaskSubState | null;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Decode the 20-byte HEARTBEAT (1:1) blob. Returns null when the payload is not a
|
|
1872
|
+
* well-formed heartbeat (wrong length / missing 0xCE sentinels). The task
|
|
1873
|
+
* sub-state is only meaningful while `mainState === 4` (mowing); in any other
|
|
1874
|
+
* main state there is no active mowing task (returns `taskSubState: null`).
|
|
1875
|
+
*/
|
|
1876
|
+
declare function parseMowerHeartbeat(value: unknown): MowerHeartbeat | null;
|
|
1852
1877
|
|
|
1853
1878
|
/**
|
|
1854
1879
|
* Per-model mower capability records + a resolver adapting the rich record into
|
|
@@ -2053,6 +2078,14 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2053
2078
|
* code — which still surfaces as the raw number via {@link faultRaw}.
|
|
2054
2079
|
*/
|
|
2055
2080
|
get fault(): MowerFault | null;
|
|
2081
|
+
/**
|
|
2082
|
+
* Live mowing task sub-state decoded from the HEARTBEAT (1:1) blob —
|
|
2083
|
+
* idle/starting/mowing/paused/finished/failed/exit/returning-to-dock — or null
|
|
2084
|
+
* when no mowing session is in progress (or the heartbeat is absent). This is
|
|
2085
|
+
* the donor's "current task" sensor; the heartbeat is push-only (the mower does
|
|
2086
|
+
* not answer live reads), so it tracks the device while it is actively mowing.
|
|
2087
|
+
*/
|
|
2088
|
+
get taskSubState(): MowerTaskSubState | null;
|
|
2056
2089
|
/** Parsed scheduling task descriptor (2:50), or null. */
|
|
2057
2090
|
get task(): MowerTaskDescriptor | null;
|
|
2058
2091
|
/**
|
|
@@ -2135,6 +2168,9 @@ declare class MowerDevice extends BaseDevice {
|
|
|
2135
2168
|
mapSvg(opts?: RenderMowerSvgOptions): Promise<string>;
|
|
2136
2169
|
/** Props worth seeding on start() / polling — exported for the facade. */
|
|
2137
2170
|
static readonly DEFAULT_PROPS: readonly [{
|
|
2171
|
+
readonly siid: 1;
|
|
2172
|
+
readonly piid: 1;
|
|
2173
|
+
}, {
|
|
2138
2174
|
readonly siid: 2;
|
|
2139
2175
|
readonly piid: 1;
|
|
2140
2176
|
}, {
|
|
@@ -2493,4 +2529,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
|
|
|
2493
2529
|
*/
|
|
2494
2530
|
declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
|
|
2495
2531
|
|
|
2496
|
-
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 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 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, extractMowerConsumableValues, getMowerCapabilities, getVacuumCapabilities, isDreameConsumableKey, mowerConsumableIndex, parseMowerConsumables, renderMowerSvg, renderVacuumPng, resolveCapabilities, supportedAutoSwitchKeys };
|
|
2532
|
+
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 };
|
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.3";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -58,8 +58,11 @@ function buildRlcHeader(region, lang, country) {
|
|
|
58
58
|
function randomMqttClientId() {
|
|
59
59
|
return "p_" + randomBytes(8).toString("hex");
|
|
60
60
|
}
|
|
61
|
+
var MAX_REQUEST_ID = 16777215;
|
|
62
|
+
var nextRequestId = Math.floor(Math.random() * 100) + 1;
|
|
61
63
|
function randomRequestId() {
|
|
62
|
-
|
|
64
|
+
nextRequestId = nextRequestId >= MAX_REQUEST_ID ? 1 : nextRequestId + 1;
|
|
65
|
+
return nextRequestId;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
// src/auth/config.ts
|
|
@@ -258,7 +261,7 @@ var OAuthTokenResponseSchema = z.object({
|
|
|
258
261
|
error: z.string().optional(),
|
|
259
262
|
error_description: z.string().optional(),
|
|
260
263
|
code: z.number().optional(),
|
|
261
|
-
msg: z.string().
|
|
264
|
+
msg: z.string().nullish()
|
|
262
265
|
}).passthrough();
|
|
263
266
|
var RawDeviceSchema = z.object({
|
|
264
267
|
did: z.union([z.string(), z.number()]).optional(),
|
|
@@ -273,7 +276,7 @@ var RawDeviceSchema = z.object({
|
|
|
273
276
|
}).passthrough();
|
|
274
277
|
var DeviceListResponseSchema = z.object({
|
|
275
278
|
code: z.number().optional(),
|
|
276
|
-
msg: z.string().
|
|
279
|
+
msg: z.string().nullish(),
|
|
277
280
|
data: z.object({
|
|
278
281
|
page: z.object({ records: z.array(RawDeviceSchema).optional() }).partial().optional(),
|
|
279
282
|
records: z.array(RawDeviceSchema).optional()
|
|
@@ -293,12 +296,12 @@ var CachedPropEntrySchema = z.object({
|
|
|
293
296
|
}).passthrough();
|
|
294
297
|
var CachedPropsResponseSchema = z.object({
|
|
295
298
|
code: z.number().optional(),
|
|
296
|
-
msg: z.string().
|
|
299
|
+
msg: z.string().nullish(),
|
|
297
300
|
data: z.array(CachedPropEntrySchema).optional()
|
|
298
301
|
}).passthrough();
|
|
299
302
|
var SendCommandResponseSchema = z.object({
|
|
300
303
|
code: z.number().optional(),
|
|
301
|
-
msg: z.string().
|
|
304
|
+
msg: z.string().nullish(),
|
|
302
305
|
data: z.object({ result: z.unknown().optional() }).passthrough().optional(),
|
|
303
306
|
result: z.unknown().optional()
|
|
304
307
|
}).passthrough();
|
|
@@ -1575,7 +1578,9 @@ function encodeAiFeatureWrite(raw, feature, value) {
|
|
|
1575
1578
|
if (typeof raw === "number") {
|
|
1576
1579
|
const bit = AI_FEATURE_BIT[feature];
|
|
1577
1580
|
if (bit === void 0) {
|
|
1578
|
-
throw new Error(
|
|
1581
|
+
throw new Error(
|
|
1582
|
+
`encodeAiFeatureWrite: feature "${feature}" has no int-bitmask representation`
|
|
1583
|
+
);
|
|
1579
1584
|
}
|
|
1580
1585
|
return value ? raw | bit : raw & ~bit;
|
|
1581
1586
|
}
|
|
@@ -1692,18 +1697,53 @@ function encodeAutoSwitchWrite(key2, value) {
|
|
|
1692
1697
|
|
|
1693
1698
|
// src/models/vacuum/consumables.ts
|
|
1694
1699
|
var VACUUM_CONSUMABLES = [
|
|
1695
|
-
{
|
|
1696
|
-
|
|
1700
|
+
{
|
|
1701
|
+
key: "main-brush",
|
|
1702
|
+
label: "Main Brush",
|
|
1703
|
+
life: { siid: 9, piid: 2 },
|
|
1704
|
+
reset: { siid: 9, aiid: 1 }
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
key: "side-brush",
|
|
1708
|
+
label: "Side Brush",
|
|
1709
|
+
life: { siid: 10, piid: 2 },
|
|
1710
|
+
reset: { siid: 10, aiid: 1 }
|
|
1711
|
+
},
|
|
1697
1712
|
{ key: "filter", label: "Filter", life: { siid: 11, piid: 1 }, reset: { siid: 11, aiid: 1 } },
|
|
1698
1713
|
{ key: "sensor", label: "Sensor", life: { siid: 16, piid: 1 }, reset: { siid: 16, aiid: 1 } },
|
|
1699
|
-
{
|
|
1714
|
+
{
|
|
1715
|
+
key: "tank-filter",
|
|
1716
|
+
label: "Tank Filter",
|
|
1717
|
+
life: { siid: 17, piid: 1 },
|
|
1718
|
+
reset: { siid: 17, aiid: 1 }
|
|
1719
|
+
},
|
|
1700
1720
|
{ key: "mop-pad", label: "Mop Pad", life: { siid: 18, piid: 1 }, reset: { siid: 18, aiid: 1 } },
|
|
1701
|
-
{
|
|
1702
|
-
|
|
1721
|
+
{
|
|
1722
|
+
key: "silver-ion",
|
|
1723
|
+
label: "Silver-ion",
|
|
1724
|
+
life: { siid: 19, piid: 2 },
|
|
1725
|
+
reset: { siid: 19, aiid: 1 }
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
key: "detergent",
|
|
1729
|
+
label: "Detergent",
|
|
1730
|
+
life: { siid: 20, piid: 1 },
|
|
1731
|
+
reset: { siid: 20, aiid: 1 }
|
|
1732
|
+
},
|
|
1703
1733
|
{ key: "squeegee", label: "Squeegee", life: { siid: 24, piid: 1 }, reset: { siid: 24, aiid: 1 } },
|
|
1704
|
-
{
|
|
1734
|
+
{
|
|
1735
|
+
key: "deodorizer",
|
|
1736
|
+
label: "Deodorizer",
|
|
1737
|
+
life: { siid: 29, piid: 2 },
|
|
1738
|
+
reset: { siid: 29, aiid: 1 }
|
|
1739
|
+
},
|
|
1705
1740
|
{ key: "wheel", label: "Wheel", life: { siid: 30, piid: 2 }, reset: { siid: 30, aiid: 1 } },
|
|
1706
|
-
{
|
|
1741
|
+
{
|
|
1742
|
+
key: "scale-inhibitor",
|
|
1743
|
+
label: "Scale Inhibitor",
|
|
1744
|
+
life: { siid: 31, piid: 2 },
|
|
1745
|
+
reset: { siid: 31, aiid: 1 }
|
|
1746
|
+
},
|
|
1707
1747
|
{ key: "dust-bag", label: "Dust Bag", life: { siid: 27, piid: 17 }, reset: null }
|
|
1708
1748
|
];
|
|
1709
1749
|
function consumableSpec(key2) {
|
|
@@ -3818,6 +3858,9 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
3818
3858
|
|
|
3819
3859
|
// src/models/mower/properties.ts
|
|
3820
3860
|
var MOWER_PROP = {
|
|
3861
|
+
/** VERIFIED-by-donor — 20-byte heartbeat (sentinel 0xCE at [0]/[19]); byte 11
|
|
3862
|
+
* battery, byte 12 main-state, byte 13 task sub-state. See parseHeartbeat. */
|
|
3863
|
+
HEARTBEAT: { siid: 1, piid: 1 },
|
|
3821
3864
|
/** VERIFIED-by-donor — pose + coverage telemetry (binary). P4 uses progress % only. */
|
|
3822
3865
|
POSE_COVERAGE: { siid: 1, piid: 4 },
|
|
3823
3866
|
/** VERIFIED-by-donor — MowerStatus (DeviceStatus). */
|
|
@@ -4167,6 +4210,39 @@ function parseMowerConsumables(result) {
|
|
|
4167
4210
|
};
|
|
4168
4211
|
});
|
|
4169
4212
|
}
|
|
4213
|
+
var MOWER_TASK_SUBSTATES = [
|
|
4214
|
+
"idle",
|
|
4215
|
+
"starting",
|
|
4216
|
+
"mowing",
|
|
4217
|
+
"paused",
|
|
4218
|
+
"finished",
|
|
4219
|
+
"failed",
|
|
4220
|
+
"exit",
|
|
4221
|
+
"returning-to-dock"
|
|
4222
|
+
];
|
|
4223
|
+
var HEARTBEAT_SENTINEL = 206;
|
|
4224
|
+
var HEARTBEAT_SUBSTATE_BASE = 33;
|
|
4225
|
+
var HEARTBEAT_MAIN_STATE_MOWING = 4;
|
|
4226
|
+
function parseMowerHeartbeat(value) {
|
|
4227
|
+
if (!Array.isArray(value) || value.length < 14) {
|
|
4228
|
+
return null;
|
|
4229
|
+
}
|
|
4230
|
+
const bytes = [];
|
|
4231
|
+
for (const b of value) {
|
|
4232
|
+
if (typeof b !== "number") {
|
|
4233
|
+
return null;
|
|
4234
|
+
}
|
|
4235
|
+
bytes.push(b);
|
|
4236
|
+
}
|
|
4237
|
+
if (bytes[0] !== HEARTBEAT_SENTINEL || bytes[bytes.length - 1] !== HEARTBEAT_SENTINEL) {
|
|
4238
|
+
return null;
|
|
4239
|
+
}
|
|
4240
|
+
const rawBattery = bytes[11] ?? 0;
|
|
4241
|
+
const mainState = ((bytes[12] ?? 0) & 15) - 1;
|
|
4242
|
+
const subStateRaw = bytes[13] ?? 0;
|
|
4243
|
+
const taskSubState = mainState === HEARTBEAT_MAIN_STATE_MOWING ? MOWER_TASK_SUBSTATES[subStateRaw - HEARTBEAT_SUBSTATE_BASE] ?? null : null;
|
|
4244
|
+
return { rawBattery, mainState, subStateRaw, taskSubState };
|
|
4245
|
+
}
|
|
4170
4246
|
|
|
4171
4247
|
// src/models/mower/capabilities.ts
|
|
4172
4248
|
var FALLBACK2 = {
|
|
@@ -4840,6 +4916,19 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
4840
4916
|
get fault() {
|
|
4841
4917
|
return FAULT(this.faultRaw);
|
|
4842
4918
|
}
|
|
4919
|
+
/**
|
|
4920
|
+
* Live mowing task sub-state decoded from the HEARTBEAT (1:1) blob —
|
|
4921
|
+
* idle/starting/mowing/paused/finished/failed/exit/returning-to-dock — or null
|
|
4922
|
+
* when no mowing session is in progress (or the heartbeat is absent). This is
|
|
4923
|
+
* the donor's "current task" sensor; the heartbeat is push-only (the mower does
|
|
4924
|
+
* not answer live reads), so it tracks the device while it is actively mowing.
|
|
4925
|
+
*/
|
|
4926
|
+
get taskSubState() {
|
|
4927
|
+
const hb = parseMowerHeartbeat(
|
|
4928
|
+
this.getProperty(MOWER_PROP.HEARTBEAT.siid, MOWER_PROP.HEARTBEAT.piid)?.value
|
|
4929
|
+
);
|
|
4930
|
+
return hb?.taskSubState ?? null;
|
|
4931
|
+
}
|
|
4843
4932
|
/** Parsed scheduling task descriptor (2:50), or null. */
|
|
4844
4933
|
get task() {
|
|
4845
4934
|
return parseTaskDescriptor(
|
|
@@ -5031,6 +5120,7 @@ var MowerDevice = class _MowerDevice extends BaseDevice {
|
|
|
5031
5120
|
}
|
|
5032
5121
|
/** Props worth seeding on start() / polling — exported for the facade. */
|
|
5033
5122
|
static DEFAULT_PROPS = [
|
|
5123
|
+
MOWER_PROP.HEARTBEAT,
|
|
5034
5124
|
MOWER_PROP.STATUS,
|
|
5035
5125
|
MOWER_PROP.DEVICE_CODE,
|
|
5036
5126
|
MOWER_PROP.BATTERY,
|
|
@@ -5658,6 +5748,7 @@ export {
|
|
|
5658
5748
|
DreameTransportError,
|
|
5659
5749
|
LIBRARY_NAME,
|
|
5660
5750
|
MODEL_CAPABILITIES2 as MOWER_MODEL_CAPABILITIES,
|
|
5751
|
+
MOWER_TASK_SUBSTATES,
|
|
5661
5752
|
MiotError,
|
|
5662
5753
|
MiotState,
|
|
5663
5754
|
MowerCapabilityResolver,
|
|
@@ -5689,6 +5780,7 @@ export {
|
|
|
5689
5780
|
isDreameConsumableKey,
|
|
5690
5781
|
mowerConsumableIndex,
|
|
5691
5782
|
parseMowerConsumables,
|
|
5783
|
+
parseMowerHeartbeat,
|
|
5692
5784
|
renderMowerSvg,
|
|
5693
5785
|
renderVacuumPng,
|
|
5694
5786
|
resolveCapabilities,
|