@camstack/addon-provider-homeassistant 1.2.86 → 1.2.87

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/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-lHF9qIyU.js");
2
+ const require_dist = require("./dist-BmfTJtD2.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_zlib = require("node:zlib");
5
5
  //#region src/ha-device-source.ts
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-l3fKSOoz.mjs";
1
+ import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-G7mZomBW.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
4
4
  //#region src/ha-device-source.ts
@@ -29424,6 +29424,287 @@ var ptzAutotrackCapability = {
29424
29424
  */
29425
29425
  durability: "session"
29426
29426
  };
29427
+ /**
29428
+ * `navigation` — a device-scoped capability that natively expresses the FULL
29429
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
29430
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
29431
+ *
29432
+ * Why a NEW cap rather than overloading `ptz`:
29433
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29434
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29435
+ * The two are different physical models: PTZ is absolute-position + presets,
29436
+ * navigation is momentary drive nudges + discrete robot ACTIONS
29437
+ * (dock / spot-clean / follow-pet / go-to-point / …).
29438
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29439
+ * the reverse:
29440
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
29441
+ * / `getOptions`), and
29442
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29443
+ * robot camera shows up in the existing PTZ control path without every
29444
+ * PTZ provider learning about robots. The mapping lives in the adapter,
29445
+ * not here (see the addon design note):
29446
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29447
+ * ptz.stop() → navigation.stop()
29448
+ * ptz.goHome() → navigation.runAction('goHome')
29449
+ * ptz.getPresets() → navigation.listActions() (id→preset)
29450
+ * ptz.goToPreset(id) → navigation.runAction(id)
29451
+ *
29452
+ * ## Continuous drive
29453
+ *
29454
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29455
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29456
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29457
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29458
+ * coalesce them. The UI owns the cadence.
29459
+ *
29460
+ * ## The action dictionary
29461
+ *
29462
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29463
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29464
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29465
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29466
+ * vendor-specific list. `kind: 'action'` entries are triggered with
29467
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29468
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
29469
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29470
+ *
29471
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29472
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29473
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
29474
+ * every device handle. A future nodedreame publish adds a typed
29475
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29476
+ * provider can then swap the raw calls for the typed methods with no change to
29477
+ * THIS contract.
29478
+ */
29479
+ /**
29480
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29481
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29482
+ * halts it.
29483
+ *
29484
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
29485
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29486
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29487
+ * vector by it (drivers without proportional drive ignore it).
29488
+ *
29489
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29490
+ * axis alone; an all-undefined nudge is a no-op.
29491
+ */
29492
+ var NavigationMoveCommandSchema = object({
29493
+ pan: number().min(-1).max(1).optional(),
29494
+ tilt: number().min(-1).max(1).optional(),
29495
+ speed: number().min(0).max(1).optional()
29496
+ });
29497
+ /**
29498
+ * The enumerated discrete actions a navigation-capable robot can perform via
29499
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29500
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
29501
+ * `playSound` (see the `sound` dictionary entries).
29502
+ */
29503
+ var NavigationActionIdSchema = _enum([
29504
+ "goHome",
29505
+ "locate",
29506
+ "spotClean",
29507
+ "findPet",
29508
+ "personFollow",
29509
+ "stop",
29510
+ "startClean",
29511
+ "pauseClean",
29512
+ "dockWash",
29513
+ "autoEmpty",
29514
+ "flashOn",
29515
+ "flashOff"
29516
+ ]);
29517
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29518
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
29519
+ /**
29520
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29521
+ * native panel and the PTZ mimic render as a button.
29522
+ *
29523
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29524
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29525
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
29526
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29527
+ * - `label` — operator-facing English label.
29528
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29529
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29530
+ * PTZ render ONLY enabled entries. Data-driven: the provider
29531
+ * flips it from config, never by editing code.
29532
+ */
29533
+ var NavigationActionEntrySchema = object({
29534
+ id: string(),
29535
+ kind: NavigationEntryKindSchema,
29536
+ label: string(),
29537
+ icon: string(),
29538
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29539
+ soundId: number().int().optional(),
29540
+ /** Per-device feature flag — render this entry only when true. */
29541
+ enabled: boolean()
29542
+ });
29543
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
29544
+ var NavigationPointSchema = object({
29545
+ x: number(),
29546
+ y: number()
29547
+ });
29548
+ /**
29549
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29550
+ * The cap reports which are enabled so the UI / PTZ render only the controls
29551
+ * that are turned on for THIS device. Data-driven: the provider derives these
29552
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29553
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29554
+ * that are not dictionary entries.
29555
+ *
29556
+ * - `move` / `stop` — the momentary drive joystick.
29557
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29558
+ * map-coordinate plumbing is wired.
29559
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29560
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29561
+ * - `light` — the on/off fill-light toggle (works anytime).
29562
+ * - `lightMode` — the auto/manual selector + manual level slider (a
29563
+ * camera-service control; needs an active stream).
29564
+ */
29565
+ var NavigationFeaturesSchema = object({
29566
+ move: boolean(),
29567
+ stop: boolean(),
29568
+ goToPoint: boolean(),
29569
+ runAction: boolean(),
29570
+ playSound: boolean(),
29571
+ light: boolean(),
29572
+ lightMode: boolean()
29573
+ });
29574
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29575
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
29576
+ /**
29577
+ * Live navigation state so the UI can reflect what the robot is doing:
29578
+ * - `mode` — coarse activity (idle / cleaning / following / …).
29579
+ * - `following` — person/pet follow is currently armed.
29580
+ * - `flash` — the on-camera fill light is on.
29581
+ * - `lightMode` — auto vs manual fill-light mode.
29582
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
29583
+ * `lightMode === 'manual'`.
29584
+ */
29585
+ var NavigationStatusSchema = object({
29586
+ mode: _enum([
29587
+ "idle",
29588
+ "cleaning",
29589
+ "spot",
29590
+ "following",
29591
+ "goto",
29592
+ "returning",
29593
+ "paused",
29594
+ "unknown"
29595
+ ]),
29596
+ following: boolean(),
29597
+ flash: boolean(),
29598
+ lightMode: NavigationLightModeSchema,
29599
+ lightLevel: number().min(40).max(100),
29600
+ /** Ms epoch when the slice was last updated. */
29601
+ lastChangedAt: number()
29602
+ });
29603
+ /**
29604
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29605
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
29606
+ * convention.
29607
+ */
29608
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29609
+ var navigationCapability = {
29610
+ name: "navigation",
29611
+ scope: "device",
29612
+ deviceNative: true,
29613
+ mode: "singleton",
29614
+ deviceTypes: [DeviceType.Camera],
29615
+ deviceConfig: { ui: {
29616
+ kind: "widget",
29617
+ widgetId: "host/navigation-panel",
29618
+ tab: "navigation",
29619
+ topTab: true,
29620
+ label: "Navigation",
29621
+ order: 0
29622
+ } },
29623
+ methods: {
29624
+ /**
29625
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
29626
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29627
+ * path) works for any authenticated user, not admin-only. The UI sends
29628
+ * these at ~1 Hz while a control is held; the provider forwards each one to
29629
+ * a single drive write WITHOUT debouncing.
29630
+ */
29631
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29632
+ /** Halt all motion immediately (zero drive vector). */
29633
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29634
+ /** Send the robot to a point on its live map. */
29635
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29636
+ /**
29637
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
29638
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29639
+ */
29640
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29641
+ /**
29642
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29643
+ * unsupported action ids are rejected by the provider.
29644
+ */
29645
+ runAction: method(object({
29646
+ deviceId: number(),
29647
+ actionId: NavigationActionIdSchema
29648
+ }), _void(), { kind: "mutation" }),
29649
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29650
+ playSound: method(object({
29651
+ deviceId: number(),
29652
+ soundId: number().int()
29653
+ }), _void(), { kind: "mutation" }),
29654
+ /**
29655
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29656
+ * works anytime, no active stream required).
29657
+ */
29658
+ setLightOn: method(object({
29659
+ deviceId: number(),
29660
+ on: boolean()
29661
+ }), _void(), { kind: "mutation" }),
29662
+ /**
29663
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29664
+ * initial `level`. The auto/manual + level control is a CAMERA-service
29665
+ * action that generally needs an active camera stream/monitor session — the
29666
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
29667
+ */
29668
+ setLightMode: method(object({
29669
+ deviceId: number(),
29670
+ mode: NavigationLightModeSchema,
29671
+ level: number().min(40).max(100).optional()
29672
+ }), _void(), { kind: "mutation" }),
29673
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29674
+ setLightLevel: method(object({
29675
+ deviceId: number(),
29676
+ level: number().min(40).max(100)
29677
+ }), _void(), { kind: "mutation" }),
29678
+ /**
29679
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
29680
+ * controls the UI shows (the per-entry flags for the dictionary come back on
29681
+ * `listActions`).
29682
+ */
29683
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29684
+ },
29685
+ events: { onStatusChanged: { data: object({
29686
+ deviceId: number(),
29687
+ status: NavigationStatusSchema
29688
+ }) } },
29689
+ status: {
29690
+ schema: NavigationStatusSchema,
29691
+ kind: "push"
29692
+ },
29693
+ /**
29694
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29695
+ * for live mode / follow / flash changes.
29696
+ */
29697
+ runtimeState: NavigationRuntimeStateSchema,
29698
+ /**
29699
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
29700
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
29701
+ * that. The live handle re-publishes on connect.
29702
+ *
29703
+ * See `RuntimeStateDurability`. Enforced by
29704
+ * `scripts/check-runtime-state-durability.ts`.
29705
+ */
29706
+ durability: "session"
29707
+ };
29427
29708
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29428
29709
  kind: "mutation",
29429
29710
  auth: "admin"
@@ -32699,6 +32980,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
32699
32980
  motionTrigger: motionTriggerCapability,
32700
32981
  motionZones: motionZonesCapability,
32701
32982
  nativeObjectDetection: nativeObjectDetectionCapability,
32983
+ navigation: navigationCapability,
32702
32984
  networkLink: networkLinkCapability,
32703
32985
  notifier: notifierCapability,
32704
32986
  numericSensor: numericSensorCapability,
@@ -36553,6 +36835,66 @@ Object.freeze({
36553
36835
  addonId: null,
36554
36836
  access: "create"
36555
36837
  },
36838
+ "navigation.getFeatures": {
36839
+ capName: "navigation",
36840
+ capScope: "device",
36841
+ addonId: null,
36842
+ access: "view"
36843
+ },
36844
+ "navigation.goToPoint": {
36845
+ capName: "navigation",
36846
+ capScope: "device",
36847
+ addonId: null,
36848
+ access: "create"
36849
+ },
36850
+ "navigation.listActions": {
36851
+ capName: "navigation",
36852
+ capScope: "device",
36853
+ addonId: null,
36854
+ access: "view"
36855
+ },
36856
+ "navigation.move": {
36857
+ capName: "navigation",
36858
+ capScope: "device",
36859
+ addonId: null,
36860
+ access: "create"
36861
+ },
36862
+ "navigation.playSound": {
36863
+ capName: "navigation",
36864
+ capScope: "device",
36865
+ addonId: null,
36866
+ access: "create"
36867
+ },
36868
+ "navigation.runAction": {
36869
+ capName: "navigation",
36870
+ capScope: "device",
36871
+ addonId: null,
36872
+ access: "create"
36873
+ },
36874
+ "navigation.setLightLevel": {
36875
+ capName: "navigation",
36876
+ capScope: "device",
36877
+ addonId: null,
36878
+ access: "create"
36879
+ },
36880
+ "navigation.setLightMode": {
36881
+ capName: "navigation",
36882
+ capScope: "device",
36883
+ addonId: null,
36884
+ access: "create"
36885
+ },
36886
+ "navigation.setLightOn": {
36887
+ capName: "navigation",
36888
+ capScope: "device",
36889
+ addonId: null,
36890
+ access: "create"
36891
+ },
36892
+ "navigation.stop": {
36893
+ capName: "navigation",
36894
+ capScope: "device",
36895
+ addonId: null,
36896
+ access: "create"
36897
+ },
36556
36898
  "networkAccess.getEndpoint": {
36557
36899
  capName: "network-access",
36558
36900
  capScope: "system",
@@ -40648,6 +40990,56 @@ Object.freeze({
40648
40990
  form: "single",
40649
40991
  optional: false
40650
40992
  }],
40993
+ "navigation.getFeatures": [{
40994
+ name: "deviceId",
40995
+ form: "single",
40996
+ optional: false
40997
+ }],
40998
+ "navigation.goToPoint": [{
40999
+ name: "deviceId",
41000
+ form: "single",
41001
+ optional: false
41002
+ }],
41003
+ "navigation.listActions": [{
41004
+ name: "deviceId",
41005
+ form: "single",
41006
+ optional: false
41007
+ }],
41008
+ "navigation.move": [{
41009
+ name: "deviceId",
41010
+ form: "single",
41011
+ optional: false
41012
+ }],
41013
+ "navigation.playSound": [{
41014
+ name: "deviceId",
41015
+ form: "single",
41016
+ optional: false
41017
+ }],
41018
+ "navigation.runAction": [{
41019
+ name: "deviceId",
41020
+ form: "single",
41021
+ optional: false
41022
+ }],
41023
+ "navigation.setLightLevel": [{
41024
+ name: "deviceId",
41025
+ form: "single",
41026
+ optional: false
41027
+ }],
41028
+ "navigation.setLightMode": [{
41029
+ name: "deviceId",
41030
+ form: "single",
41031
+ optional: false
41032
+ }],
41033
+ "navigation.setLightOn": [{
41034
+ name: "deviceId",
41035
+ form: "single",
41036
+ optional: false
41037
+ }],
41038
+ "navigation.stop": [{
41039
+ name: "deviceId",
41040
+ form: "single",
41041
+ optional: false
41042
+ }],
40651
41043
  "networkQuality.getDeviceStats": [{
40652
41044
  name: "deviceId",
40653
41045
  form: "single",
@@ -29424,6 +29424,287 @@ var ptzAutotrackCapability = {
29424
29424
  */
29425
29425
  durability: "session"
29426
29426
  };
29427
+ /**
29428
+ * `navigation` — a device-scoped capability that natively expresses the FULL
29429
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
29430
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
29431
+ *
29432
+ * Why a NEW cap rather than overloading `ptz`:
29433
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29434
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29435
+ * The two are different physical models: PTZ is absolute-position + presets,
29436
+ * navigation is momentary drive nudges + discrete robot ACTIONS
29437
+ * (dock / spot-clean / follow-pet / go-to-point / …).
29438
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29439
+ * the reverse:
29440
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
29441
+ * / `getOptions`), and
29442
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29443
+ * robot camera shows up in the existing PTZ control path without every
29444
+ * PTZ provider learning about robots. The mapping lives in the adapter,
29445
+ * not here (see the addon design note):
29446
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29447
+ * ptz.stop() → navigation.stop()
29448
+ * ptz.goHome() → navigation.runAction('goHome')
29449
+ * ptz.getPresets() → navigation.listActions() (id→preset)
29450
+ * ptz.goToPreset(id) → navigation.runAction(id)
29451
+ *
29452
+ * ## Continuous drive
29453
+ *
29454
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29455
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29456
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29457
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29458
+ * coalesce them. The UI owns the cadence.
29459
+ *
29460
+ * ## The action dictionary
29461
+ *
29462
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29463
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29464
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29465
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29466
+ * vendor-specific list. `kind: 'action'` entries are triggered with
29467
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29468
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
29469
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29470
+ *
29471
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29472
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29473
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
29474
+ * every device handle. A future nodedreame publish adds a typed
29475
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29476
+ * provider can then swap the raw calls for the typed methods with no change to
29477
+ * THIS contract.
29478
+ */
29479
+ /**
29480
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29481
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29482
+ * halts it.
29483
+ *
29484
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
29485
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29486
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29487
+ * vector by it (drivers without proportional drive ignore it).
29488
+ *
29489
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29490
+ * axis alone; an all-undefined nudge is a no-op.
29491
+ */
29492
+ var NavigationMoveCommandSchema = object({
29493
+ pan: number().min(-1).max(1).optional(),
29494
+ tilt: number().min(-1).max(1).optional(),
29495
+ speed: number().min(0).max(1).optional()
29496
+ });
29497
+ /**
29498
+ * The enumerated discrete actions a navigation-capable robot can perform via
29499
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29500
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
29501
+ * `playSound` (see the `sound` dictionary entries).
29502
+ */
29503
+ var NavigationActionIdSchema = _enum([
29504
+ "goHome",
29505
+ "locate",
29506
+ "spotClean",
29507
+ "findPet",
29508
+ "personFollow",
29509
+ "stop",
29510
+ "startClean",
29511
+ "pauseClean",
29512
+ "dockWash",
29513
+ "autoEmpty",
29514
+ "flashOn",
29515
+ "flashOff"
29516
+ ]);
29517
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29518
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
29519
+ /**
29520
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29521
+ * native panel and the PTZ mimic render as a button.
29522
+ *
29523
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29524
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29525
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
29526
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29527
+ * - `label` — operator-facing English label.
29528
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29529
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29530
+ * PTZ render ONLY enabled entries. Data-driven: the provider
29531
+ * flips it from config, never by editing code.
29532
+ */
29533
+ var NavigationActionEntrySchema = object({
29534
+ id: string(),
29535
+ kind: NavigationEntryKindSchema,
29536
+ label: string(),
29537
+ icon: string(),
29538
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29539
+ soundId: number().int().optional(),
29540
+ /** Per-device feature flag — render this entry only when true. */
29541
+ enabled: boolean()
29542
+ });
29543
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
29544
+ var NavigationPointSchema = object({
29545
+ x: number(),
29546
+ y: number()
29547
+ });
29548
+ /**
29549
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29550
+ * The cap reports which are enabled so the UI / PTZ render only the controls
29551
+ * that are turned on for THIS device. Data-driven: the provider derives these
29552
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29553
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29554
+ * that are not dictionary entries.
29555
+ *
29556
+ * - `move` / `stop` — the momentary drive joystick.
29557
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29558
+ * map-coordinate plumbing is wired.
29559
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29560
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29561
+ * - `light` — the on/off fill-light toggle (works anytime).
29562
+ * - `lightMode` — the auto/manual selector + manual level slider (a
29563
+ * camera-service control; needs an active stream).
29564
+ */
29565
+ var NavigationFeaturesSchema = object({
29566
+ move: boolean(),
29567
+ stop: boolean(),
29568
+ goToPoint: boolean(),
29569
+ runAction: boolean(),
29570
+ playSound: boolean(),
29571
+ light: boolean(),
29572
+ lightMode: boolean()
29573
+ });
29574
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29575
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
29576
+ /**
29577
+ * Live navigation state so the UI can reflect what the robot is doing:
29578
+ * - `mode` — coarse activity (idle / cleaning / following / …).
29579
+ * - `following` — person/pet follow is currently armed.
29580
+ * - `flash` — the on-camera fill light is on.
29581
+ * - `lightMode` — auto vs manual fill-light mode.
29582
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
29583
+ * `lightMode === 'manual'`.
29584
+ */
29585
+ var NavigationStatusSchema = object({
29586
+ mode: _enum([
29587
+ "idle",
29588
+ "cleaning",
29589
+ "spot",
29590
+ "following",
29591
+ "goto",
29592
+ "returning",
29593
+ "paused",
29594
+ "unknown"
29595
+ ]),
29596
+ following: boolean(),
29597
+ flash: boolean(),
29598
+ lightMode: NavigationLightModeSchema,
29599
+ lightLevel: number().min(40).max(100),
29600
+ /** Ms epoch when the slice was last updated. */
29601
+ lastChangedAt: number()
29602
+ });
29603
+ /**
29604
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29605
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
29606
+ * convention.
29607
+ */
29608
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29609
+ var navigationCapability = {
29610
+ name: "navigation",
29611
+ scope: "device",
29612
+ deviceNative: true,
29613
+ mode: "singleton",
29614
+ deviceTypes: [DeviceType.Camera],
29615
+ deviceConfig: { ui: {
29616
+ kind: "widget",
29617
+ widgetId: "host/navigation-panel",
29618
+ tab: "navigation",
29619
+ topTab: true,
29620
+ label: "Navigation",
29621
+ order: 0
29622
+ } },
29623
+ methods: {
29624
+ /**
29625
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
29626
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29627
+ * path) works for any authenticated user, not admin-only. The UI sends
29628
+ * these at ~1 Hz while a control is held; the provider forwards each one to
29629
+ * a single drive write WITHOUT debouncing.
29630
+ */
29631
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29632
+ /** Halt all motion immediately (zero drive vector). */
29633
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29634
+ /** Send the robot to a point on its live map. */
29635
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29636
+ /**
29637
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
29638
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29639
+ */
29640
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29641
+ /**
29642
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29643
+ * unsupported action ids are rejected by the provider.
29644
+ */
29645
+ runAction: method(object({
29646
+ deviceId: number(),
29647
+ actionId: NavigationActionIdSchema
29648
+ }), _void(), { kind: "mutation" }),
29649
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29650
+ playSound: method(object({
29651
+ deviceId: number(),
29652
+ soundId: number().int()
29653
+ }), _void(), { kind: "mutation" }),
29654
+ /**
29655
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29656
+ * works anytime, no active stream required).
29657
+ */
29658
+ setLightOn: method(object({
29659
+ deviceId: number(),
29660
+ on: boolean()
29661
+ }), _void(), { kind: "mutation" }),
29662
+ /**
29663
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29664
+ * initial `level`. The auto/manual + level control is a CAMERA-service
29665
+ * action that generally needs an active camera stream/monitor session — the
29666
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
29667
+ */
29668
+ setLightMode: method(object({
29669
+ deviceId: number(),
29670
+ mode: NavigationLightModeSchema,
29671
+ level: number().min(40).max(100).optional()
29672
+ }), _void(), { kind: "mutation" }),
29673
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29674
+ setLightLevel: method(object({
29675
+ deviceId: number(),
29676
+ level: number().min(40).max(100)
29677
+ }), _void(), { kind: "mutation" }),
29678
+ /**
29679
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
29680
+ * controls the UI shows (the per-entry flags for the dictionary come back on
29681
+ * `listActions`).
29682
+ */
29683
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29684
+ },
29685
+ events: { onStatusChanged: { data: object({
29686
+ deviceId: number(),
29687
+ status: NavigationStatusSchema
29688
+ }) } },
29689
+ status: {
29690
+ schema: NavigationStatusSchema,
29691
+ kind: "push"
29692
+ },
29693
+ /**
29694
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29695
+ * for live mode / follow / flash changes.
29696
+ */
29697
+ runtimeState: NavigationRuntimeStateSchema,
29698
+ /**
29699
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
29700
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
29701
+ * that. The live handle re-publishes on connect.
29702
+ *
29703
+ * See `RuntimeStateDurability`. Enforced by
29704
+ * `scripts/check-runtime-state-durability.ts`.
29705
+ */
29706
+ durability: "session"
29707
+ };
29427
29708
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29428
29709
  kind: "mutation",
29429
29710
  auth: "admin"
@@ -32699,6 +32980,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
32699
32980
  motionTrigger: motionTriggerCapability,
32700
32981
  motionZones: motionZonesCapability,
32701
32982
  nativeObjectDetection: nativeObjectDetectionCapability,
32983
+ navigation: navigationCapability,
32702
32984
  networkLink: networkLinkCapability,
32703
32985
  notifier: notifierCapability,
32704
32986
  numericSensor: numericSensorCapability,
@@ -36553,6 +36835,66 @@ Object.freeze({
36553
36835
  addonId: null,
36554
36836
  access: "create"
36555
36837
  },
36838
+ "navigation.getFeatures": {
36839
+ capName: "navigation",
36840
+ capScope: "device",
36841
+ addonId: null,
36842
+ access: "view"
36843
+ },
36844
+ "navigation.goToPoint": {
36845
+ capName: "navigation",
36846
+ capScope: "device",
36847
+ addonId: null,
36848
+ access: "create"
36849
+ },
36850
+ "navigation.listActions": {
36851
+ capName: "navigation",
36852
+ capScope: "device",
36853
+ addonId: null,
36854
+ access: "view"
36855
+ },
36856
+ "navigation.move": {
36857
+ capName: "navigation",
36858
+ capScope: "device",
36859
+ addonId: null,
36860
+ access: "create"
36861
+ },
36862
+ "navigation.playSound": {
36863
+ capName: "navigation",
36864
+ capScope: "device",
36865
+ addonId: null,
36866
+ access: "create"
36867
+ },
36868
+ "navigation.runAction": {
36869
+ capName: "navigation",
36870
+ capScope: "device",
36871
+ addonId: null,
36872
+ access: "create"
36873
+ },
36874
+ "navigation.setLightLevel": {
36875
+ capName: "navigation",
36876
+ capScope: "device",
36877
+ addonId: null,
36878
+ access: "create"
36879
+ },
36880
+ "navigation.setLightMode": {
36881
+ capName: "navigation",
36882
+ capScope: "device",
36883
+ addonId: null,
36884
+ access: "create"
36885
+ },
36886
+ "navigation.setLightOn": {
36887
+ capName: "navigation",
36888
+ capScope: "device",
36889
+ addonId: null,
36890
+ access: "create"
36891
+ },
36892
+ "navigation.stop": {
36893
+ capName: "navigation",
36894
+ capScope: "device",
36895
+ addonId: null,
36896
+ access: "create"
36897
+ },
36556
36898
  "networkAccess.getEndpoint": {
36557
36899
  capName: "network-access",
36558
36900
  capScope: "system",
@@ -40648,6 +40990,56 @@ Object.freeze({
40648
40990
  form: "single",
40649
40991
  optional: false
40650
40992
  }],
40993
+ "navigation.getFeatures": [{
40994
+ name: "deviceId",
40995
+ form: "single",
40996
+ optional: false
40997
+ }],
40998
+ "navigation.goToPoint": [{
40999
+ name: "deviceId",
41000
+ form: "single",
41001
+ optional: false
41002
+ }],
41003
+ "navigation.listActions": [{
41004
+ name: "deviceId",
41005
+ form: "single",
41006
+ optional: false
41007
+ }],
41008
+ "navigation.move": [{
41009
+ name: "deviceId",
41010
+ form: "single",
41011
+ optional: false
41012
+ }],
41013
+ "navigation.playSound": [{
41014
+ name: "deviceId",
41015
+ form: "single",
41016
+ optional: false
41017
+ }],
41018
+ "navigation.runAction": [{
41019
+ name: "deviceId",
41020
+ form: "single",
41021
+ optional: false
41022
+ }],
41023
+ "navigation.setLightLevel": [{
41024
+ name: "deviceId",
41025
+ form: "single",
41026
+ optional: false
41027
+ }],
41028
+ "navigation.setLightMode": [{
41029
+ name: "deviceId",
41030
+ form: "single",
41031
+ optional: false
41032
+ }],
41033
+ "navigation.setLightOn": [{
41034
+ name: "deviceId",
41035
+ form: "single",
41036
+ optional: false
41037
+ }],
41038
+ "navigation.stop": [{
41039
+ name: "deviceId",
41040
+ form: "single",
41041
+ optional: false
41042
+ }],
40651
41043
  "networkQuality.getDeviceStats": [{
40652
41044
  name: "deviceId",
40653
41045
  form: "single",
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  //#endregion
6
- const require_dist = require("../dist-lHF9qIyU.js");
6
+ const require_dist = require("../dist-BmfTJtD2.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  //#region src/ha-export/topics.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-l3fKSOoz.mjs";
1
+ import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-G7mZomBW.mjs";
2
2
  import { createHmac, timingSafeEqual } from "node:crypto";
3
3
  //#region src/ha-export/topics.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.86",
3
+ "version": "1.2.87",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",