@apocaliss92/nodedreame 1.8.1 → 1.10.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.d.cts CHANGED
@@ -1220,17 +1220,42 @@ interface VacuumMap {
1220
1220
  * Raster PNG renderer for a decoded `VacuumMap`.
1221
1221
  *
1222
1222
  * node-dreame ships only the structured model (no image); this is NEW. We paint
1223
- * one pixel per grid cell (× an optional integer upscale `scale`) from the
1224
- * run-length `layers`, later layers painting over earlier ones. The background
1225
- * is transparent. Per-segment colours come from a deterministic golden-angle
1226
- * palette so the same room id always renders the same hue.
1223
+ * the run-length `layers` (floor / segments / carpet / walls) one pixel per grid
1224
+ * cell (× an optional integer upscale `scale`), then composite the world-frame
1225
+ * overlays on top: restricted areas (no-go / no-mop), virtual walls, the cleaning
1226
+ * path polylines, AI obstacles, the charger, and the robot (body + heading). A
1227
+ * `colorScheme` picks the palette and every overlay is independently toggleable,
1228
+ * mirroring how the Home Assistant integration exposes map customization.
1229
+ *
1230
+ * Coordinate transform: every overlay coordinate is mm in the world frame.
1231
+ * `dimensions.left` / `.top` are the world-mm of pixel (0,0) and `.gridSize` is
1232
+ * mm-per-pixel, so `px = (worldX - left) / gridSize` (then × `scale`). Row 0 is
1233
+ * the top edge — no Y flip.
1227
1234
  *
1228
1235
  * Pure: only `pngjs` + arithmetic. No casts.
1229
1236
  */
1230
1237
 
1238
+ /** A named map palette. Mirrors the HA integration's `color_scheme` choices. */
1239
+ type MapColorScheme = 'dreame-light' | 'dreame-dark' | 'mijia-light' | 'tasshack';
1231
1240
  interface RenderVacuumPngOptions {
1232
1241
  /** Integer upscale factor (nearest-neighbour). Default 1. */
1233
1242
  scale?: number;
1243
+ /** Palette. Default `'dreame-light'`. */
1244
+ colorScheme?: MapColorScheme;
1245
+ /** Draw the cleaning/mopping path polylines. Default true. */
1246
+ showPath?: boolean;
1247
+ /** Draw the robot marker (body + heading). Default true. */
1248
+ showRobot?: boolean;
1249
+ /** Draw the charger / dock marker. Default true. */
1250
+ showCharger?: boolean;
1251
+ /** Draw no-go / no-mop restricted areas. Default true. */
1252
+ showNoGo?: boolean;
1253
+ /** Draw user-defined virtual walls. Default true. */
1254
+ showVirtualWalls?: boolean;
1255
+ /** Draw AI-detected obstacle markers. Default true. */
1256
+ showObstacles?: boolean;
1257
+ /** Draw the segment id as a tiny label at each room centroid. Default false. */
1258
+ showSegmentLabels?: boolean;
1234
1259
  }
1235
1260
  declare function renderVacuumPng(map: VacuumMap, opts?: RenderVacuumPngOptions): Buffer;
1236
1261
 
@@ -1566,6 +1591,22 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
1566
1591
  * `applyVacuumPFrame` merge primitive ships separately for that work.
1567
1592
  */
1568
1593
  getMap(input: VacuumGetMapInput): Promise<VacuumMap>;
1594
+ /** Drop the P-frame merge base so the next I-frame re-seeds the stream. */
1595
+ resetMapStream(): void;
1596
+ /**
1597
+ * Fetch the latest advertised map frame and fold it into a continuously
1598
+ * updating map. An I-frame (re)seeds the merge base and renders standalone; a
1599
+ * P-frame is merged onto the base via {@link applyVacuumPFrame} so the live
1600
+ * grid stays COMPLETE (a P-frame decoded standalone is only byte-deltas). On an
1601
+ * out-of-order P-frame or a map-id change the base is dropped and `null`
1602
+ * returned — the next I-frame re-seeds. Returns `null` when no frame is
1603
+ * advertised yet, or a P-frame arrives before any I-frame.
1604
+ *
1605
+ * Caches {@link lastMap} and emits `'map'` exactly like {@link getMap}, so a
1606
+ * map-watching consumer (e.g. the camstack map child) gets a fresh complete
1607
+ * frame on every push during a live clean.
1608
+ */
1609
+ fetchLatestMapStreaming(opts?: Omit<VacuumGetMapInput, 'filename'>): Promise<VacuumMap | null>;
1569
1610
  /** Props worth seeding on start() / polling — exported for the facade. */
1570
1611
  static readonly DEFAULT_PROPS: readonly [{
1571
1612
  readonly siid: 2;
@@ -2407,4 +2448,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
2407
2448
  */
2408
2449
  declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
2409
2450
 
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 };
2451
+ 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 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
@@ -1220,17 +1220,42 @@ interface VacuumMap {
1220
1220
  * Raster PNG renderer for a decoded `VacuumMap`.
1221
1221
  *
1222
1222
  * node-dreame ships only the structured model (no image); this is NEW. We paint
1223
- * one pixel per grid cell (× an optional integer upscale `scale`) from the
1224
- * run-length `layers`, later layers painting over earlier ones. The background
1225
- * is transparent. Per-segment colours come from a deterministic golden-angle
1226
- * palette so the same room id always renders the same hue.
1223
+ * the run-length `layers` (floor / segments / carpet / walls) one pixel per grid
1224
+ * cell (× an optional integer upscale `scale`), then composite the world-frame
1225
+ * overlays on top: restricted areas (no-go / no-mop), virtual walls, the cleaning
1226
+ * path polylines, AI obstacles, the charger, and the robot (body + heading). A
1227
+ * `colorScheme` picks the palette and every overlay is independently toggleable,
1228
+ * mirroring how the Home Assistant integration exposes map customization.
1229
+ *
1230
+ * Coordinate transform: every overlay coordinate is mm in the world frame.
1231
+ * `dimensions.left` / `.top` are the world-mm of pixel (0,0) and `.gridSize` is
1232
+ * mm-per-pixel, so `px = (worldX - left) / gridSize` (then × `scale`). Row 0 is
1233
+ * the top edge — no Y flip.
1227
1234
  *
1228
1235
  * Pure: only `pngjs` + arithmetic. No casts.
1229
1236
  */
1230
1237
 
1238
+ /** A named map palette. Mirrors the HA integration's `color_scheme` choices. */
1239
+ type MapColorScheme = 'dreame-light' | 'dreame-dark' | 'mijia-light' | 'tasshack';
1231
1240
  interface RenderVacuumPngOptions {
1232
1241
  /** Integer upscale factor (nearest-neighbour). Default 1. */
1233
1242
  scale?: number;
1243
+ /** Palette. Default `'dreame-light'`. */
1244
+ colorScheme?: MapColorScheme;
1245
+ /** Draw the cleaning/mopping path polylines. Default true. */
1246
+ showPath?: boolean;
1247
+ /** Draw the robot marker (body + heading). Default true. */
1248
+ showRobot?: boolean;
1249
+ /** Draw the charger / dock marker. Default true. */
1250
+ showCharger?: boolean;
1251
+ /** Draw no-go / no-mop restricted areas. Default true. */
1252
+ showNoGo?: boolean;
1253
+ /** Draw user-defined virtual walls. Default true. */
1254
+ showVirtualWalls?: boolean;
1255
+ /** Draw AI-detected obstacle markers. Default true. */
1256
+ showObstacles?: boolean;
1257
+ /** Draw the segment id as a tiny label at each room centroid. Default false. */
1258
+ showSegmentLabels?: boolean;
1234
1259
  }
1235
1260
  declare function renderVacuumPng(map: VacuumMap, opts?: RenderVacuumPngOptions): Buffer;
1236
1261
 
@@ -1566,6 +1591,22 @@ declare class VacuumDevice extends BaseDevice<VacuumDeviceEvents> {
1566
1591
  * `applyVacuumPFrame` merge primitive ships separately for that work.
1567
1592
  */
1568
1593
  getMap(input: VacuumGetMapInput): Promise<VacuumMap>;
1594
+ /** Drop the P-frame merge base so the next I-frame re-seeds the stream. */
1595
+ resetMapStream(): void;
1596
+ /**
1597
+ * Fetch the latest advertised map frame and fold it into a continuously
1598
+ * updating map. An I-frame (re)seeds the merge base and renders standalone; a
1599
+ * P-frame is merged onto the base via {@link applyVacuumPFrame} so the live
1600
+ * grid stays COMPLETE (a P-frame decoded standalone is only byte-deltas). On an
1601
+ * out-of-order P-frame or a map-id change the base is dropped and `null`
1602
+ * returned — the next I-frame re-seeds. Returns `null` when no frame is
1603
+ * advertised yet, or a P-frame arrives before any I-frame.
1604
+ *
1605
+ * Caches {@link lastMap} and emits `'map'` exactly like {@link getMap}, so a
1606
+ * map-watching consumer (e.g. the camstack map child) gets a fresh complete
1607
+ * frame on every push during a live clean.
1608
+ */
1609
+ fetchLatestMapStreaming(opts?: Omit<VacuumGetMapInput, 'filename'>): Promise<VacuumMap | null>;
1569
1610
  /** Props worth seeding on start() / polling — exported for the facade. */
1570
1611
  static readonly DEFAULT_PROPS: readonly [{
1571
1612
  readonly siid: 2;
@@ -2407,4 +2448,4 @@ declare function createDumper(target: DumperDevice, options?: DumperOptions): Du
2407
2448
  */
2408
2449
  declare function createClientDumper(client: Nodreame, options?: DumperOptions): Dumper[];
2409
2450
 
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 };
2451
+ 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 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 };