@camstack/addon-provider-unifi 0.2.70 → 0.2.72

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
@@ -5406,6 +5406,12 @@ Object.fromEntries([
5406
5406
  icon: "move",
5407
5407
  order: 40
5408
5408
  },
5409
+ {
5410
+ id: "navigation",
5411
+ label: "Navigation",
5412
+ icon: "compass",
5413
+ order: 41
5414
+ },
5409
5415
  {
5410
5416
  id: "consumables",
5411
5417
  label: "Consumables",
@@ -28964,6 +28970,287 @@ var ptzAutotrackCapability = {
28964
28970
  */
28965
28971
  durability: "session"
28966
28972
  };
28973
+ /**
28974
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28975
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28976
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28977
+ *
28978
+ * Why a NEW cap rather than overloading `ptz`:
28979
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28980
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28981
+ * The two are different physical models: PTZ is absolute-position + presets,
28982
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28983
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28984
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28985
+ * the reverse:
28986
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28987
+ * / `getOptions`), and
28988
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28989
+ * robot camera shows up in the existing PTZ control path without every
28990
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28991
+ * not here (see the addon design note):
28992
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28993
+ * ptz.stop() → navigation.stop()
28994
+ * ptz.goHome() → navigation.runAction('goHome')
28995
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28996
+ * ptz.goToPreset(id) → navigation.runAction(id)
28997
+ *
28998
+ * ## Continuous drive
28999
+ *
29000
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29001
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29002
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29003
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29004
+ * coalesce them. The UI owns the cadence.
29005
+ *
29006
+ * ## The action dictionary
29007
+ *
29008
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29009
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29010
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29011
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29012
+ * vendor-specific list. `kind: 'action'` entries are triggered with
29013
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29014
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
29015
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29016
+ *
29017
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29018
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29019
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
29020
+ * every device handle. A future nodedreame publish adds a typed
29021
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29022
+ * provider can then swap the raw calls for the typed methods with no change to
29023
+ * THIS contract.
29024
+ */
29025
+ /**
29026
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29027
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29028
+ * halts it.
29029
+ *
29030
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
29031
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29032
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29033
+ * vector by it (drivers without proportional drive ignore it).
29034
+ *
29035
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29036
+ * axis alone; an all-undefined nudge is a no-op.
29037
+ */
29038
+ var NavigationMoveCommandSchema = object({
29039
+ pan: number().min(-1).max(1).optional(),
29040
+ tilt: number().min(-1).max(1).optional(),
29041
+ speed: number().min(0).max(1).optional()
29042
+ });
29043
+ /**
29044
+ * The enumerated discrete actions a navigation-capable robot can perform via
29045
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29046
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
29047
+ * `playSound` (see the `sound` dictionary entries).
29048
+ */
29049
+ var NavigationActionIdSchema = _enum([
29050
+ "goHome",
29051
+ "locate",
29052
+ "spotClean",
29053
+ "findPet",
29054
+ "personFollow",
29055
+ "stop",
29056
+ "startClean",
29057
+ "pauseClean",
29058
+ "dockWash",
29059
+ "autoEmpty",
29060
+ "flashOn",
29061
+ "flashOff"
29062
+ ]);
29063
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29064
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
29065
+ /**
29066
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29067
+ * native panel and the PTZ mimic render as a button.
29068
+ *
29069
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29070
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29071
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
29072
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29073
+ * - `label` — operator-facing English label.
29074
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29075
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29076
+ * PTZ render ONLY enabled entries. Data-driven: the provider
29077
+ * flips it from config, never by editing code.
29078
+ */
29079
+ var NavigationActionEntrySchema = object({
29080
+ id: string(),
29081
+ kind: NavigationEntryKindSchema,
29082
+ label: string(),
29083
+ icon: string(),
29084
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29085
+ soundId: number().int().optional(),
29086
+ /** Per-device feature flag — render this entry only when true. */
29087
+ enabled: boolean()
29088
+ });
29089
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
29090
+ var NavigationPointSchema = object({
29091
+ x: number(),
29092
+ y: number()
29093
+ });
29094
+ /**
29095
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29096
+ * The cap reports which are enabled so the UI / PTZ render only the controls
29097
+ * that are turned on for THIS device. Data-driven: the provider derives these
29098
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29099
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29100
+ * that are not dictionary entries.
29101
+ *
29102
+ * - `move` / `stop` — the momentary drive joystick.
29103
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29104
+ * map-coordinate plumbing is wired.
29105
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29106
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29107
+ * - `light` — the on/off fill-light toggle (works anytime).
29108
+ * - `lightMode` — the auto/manual selector + manual level slider (a
29109
+ * camera-service control; needs an active stream).
29110
+ */
29111
+ var NavigationFeaturesSchema = object({
29112
+ move: boolean(),
29113
+ stop: boolean(),
29114
+ goToPoint: boolean(),
29115
+ runAction: boolean(),
29116
+ playSound: boolean(),
29117
+ light: boolean(),
29118
+ lightMode: boolean()
29119
+ });
29120
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29121
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
29122
+ /**
29123
+ * Live navigation state so the UI can reflect what the robot is doing:
29124
+ * - `mode` — coarse activity (idle / cleaning / following / …).
29125
+ * - `following` — person/pet follow is currently armed.
29126
+ * - `flash` — the on-camera fill light is on.
29127
+ * - `lightMode` — auto vs manual fill-light mode.
29128
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
29129
+ * `lightMode === 'manual'`.
29130
+ */
29131
+ var NavigationStatusSchema = object({
29132
+ mode: _enum([
29133
+ "idle",
29134
+ "cleaning",
29135
+ "spot",
29136
+ "following",
29137
+ "goto",
29138
+ "returning",
29139
+ "paused",
29140
+ "unknown"
29141
+ ]),
29142
+ following: boolean(),
29143
+ flash: boolean(),
29144
+ lightMode: NavigationLightModeSchema,
29145
+ lightLevel: number().min(40).max(100),
29146
+ /** Ms epoch when the slice was last updated. */
29147
+ lastChangedAt: number()
29148
+ });
29149
+ /**
29150
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29151
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
29152
+ * convention.
29153
+ */
29154
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29155
+ var navigationCapability = {
29156
+ name: "navigation",
29157
+ scope: "device",
29158
+ deviceNative: true,
29159
+ mode: "singleton",
29160
+ deviceTypes: [DeviceType.Camera],
29161
+ deviceConfig: { ui: {
29162
+ kind: "widget",
29163
+ widgetId: "host/navigation-panel",
29164
+ tab: "navigation",
29165
+ topTab: true,
29166
+ label: "Navigation",
29167
+ order: 0
29168
+ } },
29169
+ methods: {
29170
+ /**
29171
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
29172
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29173
+ * path) works for any authenticated user, not admin-only. The UI sends
29174
+ * these at ~1 Hz while a control is held; the provider forwards each one to
29175
+ * a single drive write WITHOUT debouncing.
29176
+ */
29177
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29178
+ /** Halt all motion immediately (zero drive vector). */
29179
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29180
+ /** Send the robot to a point on its live map. */
29181
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29182
+ /**
29183
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
29184
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29185
+ */
29186
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29187
+ /**
29188
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29189
+ * unsupported action ids are rejected by the provider.
29190
+ */
29191
+ runAction: method(object({
29192
+ deviceId: number(),
29193
+ actionId: NavigationActionIdSchema
29194
+ }), _void(), { kind: "mutation" }),
29195
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29196
+ playSound: method(object({
29197
+ deviceId: number(),
29198
+ soundId: number().int()
29199
+ }), _void(), { kind: "mutation" }),
29200
+ /**
29201
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29202
+ * works anytime, no active stream required).
29203
+ */
29204
+ setLightOn: method(object({
29205
+ deviceId: number(),
29206
+ on: boolean()
29207
+ }), _void(), { kind: "mutation" }),
29208
+ /**
29209
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29210
+ * initial `level`. The auto/manual + level control is a CAMERA-service
29211
+ * action that generally needs an active camera stream/monitor session — the
29212
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
29213
+ */
29214
+ setLightMode: method(object({
29215
+ deviceId: number(),
29216
+ mode: NavigationLightModeSchema,
29217
+ level: number().min(40).max(100).optional()
29218
+ }), _void(), { kind: "mutation" }),
29219
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29220
+ setLightLevel: method(object({
29221
+ deviceId: number(),
29222
+ level: number().min(40).max(100)
29223
+ }), _void(), { kind: "mutation" }),
29224
+ /**
29225
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
29226
+ * controls the UI shows (the per-entry flags for the dictionary come back on
29227
+ * `listActions`).
29228
+ */
29229
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29230
+ },
29231
+ events: { onStatusChanged: { data: object({
29232
+ deviceId: number(),
29233
+ status: NavigationStatusSchema
29234
+ }) } },
29235
+ status: {
29236
+ schema: NavigationStatusSchema,
29237
+ kind: "push"
29238
+ },
29239
+ /**
29240
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29241
+ * for live mode / follow / flash changes.
29242
+ */
29243
+ runtimeState: NavigationRuntimeStateSchema,
29244
+ /**
29245
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
29246
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
29247
+ * that. The live handle re-publishes on connect.
29248
+ *
29249
+ * See `RuntimeStateDurability`. Enforced by
29250
+ * `scripts/check-runtime-state-durability.ts`.
29251
+ */
29252
+ durability: "session"
29253
+ };
28967
29254
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
28968
29255
  kind: "mutation",
28969
29256
  auth: "admin"
@@ -32239,6 +32526,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
32239
32526
  motionTrigger: motionTriggerCapability,
32240
32527
  motionZones: motionZonesCapability,
32241
32528
  nativeObjectDetection: nativeObjectDetectionCapability,
32529
+ navigation: navigationCapability,
32242
32530
  networkLink: networkLinkCapability,
32243
32531
  notifier: notifierCapability,
32244
32532
  numericSensor: numericSensorCapability,
@@ -36093,6 +36381,66 @@ Object.freeze({
36093
36381
  addonId: null,
36094
36382
  access: "create"
36095
36383
  },
36384
+ "navigation.getFeatures": {
36385
+ capName: "navigation",
36386
+ capScope: "device",
36387
+ addonId: null,
36388
+ access: "view"
36389
+ },
36390
+ "navigation.goToPoint": {
36391
+ capName: "navigation",
36392
+ capScope: "device",
36393
+ addonId: null,
36394
+ access: "create"
36395
+ },
36396
+ "navigation.listActions": {
36397
+ capName: "navigation",
36398
+ capScope: "device",
36399
+ addonId: null,
36400
+ access: "view"
36401
+ },
36402
+ "navigation.move": {
36403
+ capName: "navigation",
36404
+ capScope: "device",
36405
+ addonId: null,
36406
+ access: "create"
36407
+ },
36408
+ "navigation.playSound": {
36409
+ capName: "navigation",
36410
+ capScope: "device",
36411
+ addonId: null,
36412
+ access: "create"
36413
+ },
36414
+ "navigation.runAction": {
36415
+ capName: "navigation",
36416
+ capScope: "device",
36417
+ addonId: null,
36418
+ access: "create"
36419
+ },
36420
+ "navigation.setLightLevel": {
36421
+ capName: "navigation",
36422
+ capScope: "device",
36423
+ addonId: null,
36424
+ access: "create"
36425
+ },
36426
+ "navigation.setLightMode": {
36427
+ capName: "navigation",
36428
+ capScope: "device",
36429
+ addonId: null,
36430
+ access: "create"
36431
+ },
36432
+ "navigation.setLightOn": {
36433
+ capName: "navigation",
36434
+ capScope: "device",
36435
+ addonId: null,
36436
+ access: "create"
36437
+ },
36438
+ "navigation.stop": {
36439
+ capName: "navigation",
36440
+ capScope: "device",
36441
+ addonId: null,
36442
+ access: "create"
36443
+ },
36096
36444
  "networkAccess.getEndpoint": {
36097
36445
  capName: "network-access",
36098
36446
  capScope: "system",
@@ -40188,6 +40536,56 @@ Object.freeze({
40188
40536
  form: "single",
40189
40537
  optional: false
40190
40538
  }],
40539
+ "navigation.getFeatures": [{
40540
+ name: "deviceId",
40541
+ form: "single",
40542
+ optional: false
40543
+ }],
40544
+ "navigation.goToPoint": [{
40545
+ name: "deviceId",
40546
+ form: "single",
40547
+ optional: false
40548
+ }],
40549
+ "navigation.listActions": [{
40550
+ name: "deviceId",
40551
+ form: "single",
40552
+ optional: false
40553
+ }],
40554
+ "navigation.move": [{
40555
+ name: "deviceId",
40556
+ form: "single",
40557
+ optional: false
40558
+ }],
40559
+ "navigation.playSound": [{
40560
+ name: "deviceId",
40561
+ form: "single",
40562
+ optional: false
40563
+ }],
40564
+ "navigation.runAction": [{
40565
+ name: "deviceId",
40566
+ form: "single",
40567
+ optional: false
40568
+ }],
40569
+ "navigation.setLightLevel": [{
40570
+ name: "deviceId",
40571
+ form: "single",
40572
+ optional: false
40573
+ }],
40574
+ "navigation.setLightMode": [{
40575
+ name: "deviceId",
40576
+ form: "single",
40577
+ optional: false
40578
+ }],
40579
+ "navigation.setLightOn": [{
40580
+ name: "deviceId",
40581
+ form: "single",
40582
+ optional: false
40583
+ }],
40584
+ "navigation.stop": [{
40585
+ name: "deviceId",
40586
+ form: "single",
40587
+ optional: false
40588
+ }],
40191
40589
  "networkQuality.getDeviceStats": [{
40192
40590
  name: "deviceId",
40193
40591
  form: "single",
package/dist/addon.mjs CHANGED
@@ -5405,6 +5405,12 @@ Object.fromEntries([
5405
5405
  icon: "move",
5406
5406
  order: 40
5407
5407
  },
5408
+ {
5409
+ id: "navigation",
5410
+ label: "Navigation",
5411
+ icon: "compass",
5412
+ order: 41
5413
+ },
5408
5414
  {
5409
5415
  id: "consumables",
5410
5416
  label: "Consumables",
@@ -28963,6 +28969,287 @@ var ptzAutotrackCapability = {
28963
28969
  */
28964
28970
  durability: "session"
28965
28971
  };
28972
+ /**
28973
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28974
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28975
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28976
+ *
28977
+ * Why a NEW cap rather than overloading `ptz`:
28978
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28979
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28980
+ * The two are different physical models: PTZ is absolute-position + presets,
28981
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28982
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28983
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28984
+ * the reverse:
28985
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28986
+ * / `getOptions`), and
28987
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28988
+ * robot camera shows up in the existing PTZ control path without every
28989
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28990
+ * not here (see the addon design note):
28991
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28992
+ * ptz.stop() → navigation.stop()
28993
+ * ptz.goHome() → navigation.runAction('goHome')
28994
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28995
+ * ptz.goToPreset(id) → navigation.runAction(id)
28996
+ *
28997
+ * ## Continuous drive
28998
+ *
28999
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29000
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29001
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29002
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29003
+ * coalesce them. The UI owns the cadence.
29004
+ *
29005
+ * ## The action dictionary
29006
+ *
29007
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29008
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29009
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29010
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29011
+ * vendor-specific list. `kind: 'action'` entries are triggered with
29012
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29013
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
29014
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29015
+ *
29016
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29017
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29018
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
29019
+ * every device handle. A future nodedreame publish adds a typed
29020
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29021
+ * provider can then swap the raw calls for the typed methods with no change to
29022
+ * THIS contract.
29023
+ */
29024
+ /**
29025
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29026
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29027
+ * halts it.
29028
+ *
29029
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
29030
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29031
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29032
+ * vector by it (drivers without proportional drive ignore it).
29033
+ *
29034
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29035
+ * axis alone; an all-undefined nudge is a no-op.
29036
+ */
29037
+ var NavigationMoveCommandSchema = object({
29038
+ pan: number().min(-1).max(1).optional(),
29039
+ tilt: number().min(-1).max(1).optional(),
29040
+ speed: number().min(0).max(1).optional()
29041
+ });
29042
+ /**
29043
+ * The enumerated discrete actions a navigation-capable robot can perform via
29044
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29045
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
29046
+ * `playSound` (see the `sound` dictionary entries).
29047
+ */
29048
+ var NavigationActionIdSchema = _enum([
29049
+ "goHome",
29050
+ "locate",
29051
+ "spotClean",
29052
+ "findPet",
29053
+ "personFollow",
29054
+ "stop",
29055
+ "startClean",
29056
+ "pauseClean",
29057
+ "dockWash",
29058
+ "autoEmpty",
29059
+ "flashOn",
29060
+ "flashOff"
29061
+ ]);
29062
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29063
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
29064
+ /**
29065
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29066
+ * native panel and the PTZ mimic render as a button.
29067
+ *
29068
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29069
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29070
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
29071
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29072
+ * - `label` — operator-facing English label.
29073
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29074
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29075
+ * PTZ render ONLY enabled entries. Data-driven: the provider
29076
+ * flips it from config, never by editing code.
29077
+ */
29078
+ var NavigationActionEntrySchema = object({
29079
+ id: string(),
29080
+ kind: NavigationEntryKindSchema,
29081
+ label: string(),
29082
+ icon: string(),
29083
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29084
+ soundId: number().int().optional(),
29085
+ /** Per-device feature flag — render this entry only when true. */
29086
+ enabled: boolean()
29087
+ });
29088
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
29089
+ var NavigationPointSchema = object({
29090
+ x: number(),
29091
+ y: number()
29092
+ });
29093
+ /**
29094
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29095
+ * The cap reports which are enabled so the UI / PTZ render only the controls
29096
+ * that are turned on for THIS device. Data-driven: the provider derives these
29097
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29098
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29099
+ * that are not dictionary entries.
29100
+ *
29101
+ * - `move` / `stop` — the momentary drive joystick.
29102
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29103
+ * map-coordinate plumbing is wired.
29104
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29105
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29106
+ * - `light` — the on/off fill-light toggle (works anytime).
29107
+ * - `lightMode` — the auto/manual selector + manual level slider (a
29108
+ * camera-service control; needs an active stream).
29109
+ */
29110
+ var NavigationFeaturesSchema = object({
29111
+ move: boolean(),
29112
+ stop: boolean(),
29113
+ goToPoint: boolean(),
29114
+ runAction: boolean(),
29115
+ playSound: boolean(),
29116
+ light: boolean(),
29117
+ lightMode: boolean()
29118
+ });
29119
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29120
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
29121
+ /**
29122
+ * Live navigation state so the UI can reflect what the robot is doing:
29123
+ * - `mode` — coarse activity (idle / cleaning / following / …).
29124
+ * - `following` — person/pet follow is currently armed.
29125
+ * - `flash` — the on-camera fill light is on.
29126
+ * - `lightMode` — auto vs manual fill-light mode.
29127
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
29128
+ * `lightMode === 'manual'`.
29129
+ */
29130
+ var NavigationStatusSchema = object({
29131
+ mode: _enum([
29132
+ "idle",
29133
+ "cleaning",
29134
+ "spot",
29135
+ "following",
29136
+ "goto",
29137
+ "returning",
29138
+ "paused",
29139
+ "unknown"
29140
+ ]),
29141
+ following: boolean(),
29142
+ flash: boolean(),
29143
+ lightMode: NavigationLightModeSchema,
29144
+ lightLevel: number().min(40).max(100),
29145
+ /** Ms epoch when the slice was last updated. */
29146
+ lastChangedAt: number()
29147
+ });
29148
+ /**
29149
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29150
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
29151
+ * convention.
29152
+ */
29153
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29154
+ var navigationCapability = {
29155
+ name: "navigation",
29156
+ scope: "device",
29157
+ deviceNative: true,
29158
+ mode: "singleton",
29159
+ deviceTypes: [DeviceType.Camera],
29160
+ deviceConfig: { ui: {
29161
+ kind: "widget",
29162
+ widgetId: "host/navigation-panel",
29163
+ tab: "navigation",
29164
+ topTab: true,
29165
+ label: "Navigation",
29166
+ order: 0
29167
+ } },
29168
+ methods: {
29169
+ /**
29170
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
29171
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29172
+ * path) works for any authenticated user, not admin-only. The UI sends
29173
+ * these at ~1 Hz while a control is held; the provider forwards each one to
29174
+ * a single drive write WITHOUT debouncing.
29175
+ */
29176
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29177
+ /** Halt all motion immediately (zero drive vector). */
29178
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29179
+ /** Send the robot to a point on its live map. */
29180
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29181
+ /**
29182
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
29183
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29184
+ */
29185
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29186
+ /**
29187
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29188
+ * unsupported action ids are rejected by the provider.
29189
+ */
29190
+ runAction: method(object({
29191
+ deviceId: number(),
29192
+ actionId: NavigationActionIdSchema
29193
+ }), _void(), { kind: "mutation" }),
29194
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29195
+ playSound: method(object({
29196
+ deviceId: number(),
29197
+ soundId: number().int()
29198
+ }), _void(), { kind: "mutation" }),
29199
+ /**
29200
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29201
+ * works anytime, no active stream required).
29202
+ */
29203
+ setLightOn: method(object({
29204
+ deviceId: number(),
29205
+ on: boolean()
29206
+ }), _void(), { kind: "mutation" }),
29207
+ /**
29208
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29209
+ * initial `level`. The auto/manual + level control is a CAMERA-service
29210
+ * action that generally needs an active camera stream/monitor session — the
29211
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
29212
+ */
29213
+ setLightMode: method(object({
29214
+ deviceId: number(),
29215
+ mode: NavigationLightModeSchema,
29216
+ level: number().min(40).max(100).optional()
29217
+ }), _void(), { kind: "mutation" }),
29218
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29219
+ setLightLevel: method(object({
29220
+ deviceId: number(),
29221
+ level: number().min(40).max(100)
29222
+ }), _void(), { kind: "mutation" }),
29223
+ /**
29224
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
29225
+ * controls the UI shows (the per-entry flags for the dictionary come back on
29226
+ * `listActions`).
29227
+ */
29228
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29229
+ },
29230
+ events: { onStatusChanged: { data: object({
29231
+ deviceId: number(),
29232
+ status: NavigationStatusSchema
29233
+ }) } },
29234
+ status: {
29235
+ schema: NavigationStatusSchema,
29236
+ kind: "push"
29237
+ },
29238
+ /**
29239
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29240
+ * for live mode / follow / flash changes.
29241
+ */
29242
+ runtimeState: NavigationRuntimeStateSchema,
29243
+ /**
29244
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
29245
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
29246
+ * that. The live handle re-publishes on connect.
29247
+ *
29248
+ * See `RuntimeStateDurability`. Enforced by
29249
+ * `scripts/check-runtime-state-durability.ts`.
29250
+ */
29251
+ durability: "session"
29252
+ };
28966
29253
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
28967
29254
  kind: "mutation",
28968
29255
  auth: "admin"
@@ -32238,6 +32525,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
32238
32525
  motionTrigger: motionTriggerCapability,
32239
32526
  motionZones: motionZonesCapability,
32240
32527
  nativeObjectDetection: nativeObjectDetectionCapability,
32528
+ navigation: navigationCapability,
32241
32529
  networkLink: networkLinkCapability,
32242
32530
  notifier: notifierCapability,
32243
32531
  numericSensor: numericSensorCapability,
@@ -36092,6 +36380,66 @@ Object.freeze({
36092
36380
  addonId: null,
36093
36381
  access: "create"
36094
36382
  },
36383
+ "navigation.getFeatures": {
36384
+ capName: "navigation",
36385
+ capScope: "device",
36386
+ addonId: null,
36387
+ access: "view"
36388
+ },
36389
+ "navigation.goToPoint": {
36390
+ capName: "navigation",
36391
+ capScope: "device",
36392
+ addonId: null,
36393
+ access: "create"
36394
+ },
36395
+ "navigation.listActions": {
36396
+ capName: "navigation",
36397
+ capScope: "device",
36398
+ addonId: null,
36399
+ access: "view"
36400
+ },
36401
+ "navigation.move": {
36402
+ capName: "navigation",
36403
+ capScope: "device",
36404
+ addonId: null,
36405
+ access: "create"
36406
+ },
36407
+ "navigation.playSound": {
36408
+ capName: "navigation",
36409
+ capScope: "device",
36410
+ addonId: null,
36411
+ access: "create"
36412
+ },
36413
+ "navigation.runAction": {
36414
+ capName: "navigation",
36415
+ capScope: "device",
36416
+ addonId: null,
36417
+ access: "create"
36418
+ },
36419
+ "navigation.setLightLevel": {
36420
+ capName: "navigation",
36421
+ capScope: "device",
36422
+ addonId: null,
36423
+ access: "create"
36424
+ },
36425
+ "navigation.setLightMode": {
36426
+ capName: "navigation",
36427
+ capScope: "device",
36428
+ addonId: null,
36429
+ access: "create"
36430
+ },
36431
+ "navigation.setLightOn": {
36432
+ capName: "navigation",
36433
+ capScope: "device",
36434
+ addonId: null,
36435
+ access: "create"
36436
+ },
36437
+ "navigation.stop": {
36438
+ capName: "navigation",
36439
+ capScope: "device",
36440
+ addonId: null,
36441
+ access: "create"
36442
+ },
36095
36443
  "networkAccess.getEndpoint": {
36096
36444
  capName: "network-access",
36097
36445
  capScope: "system",
@@ -40187,6 +40535,56 @@ Object.freeze({
40187
40535
  form: "single",
40188
40536
  optional: false
40189
40537
  }],
40538
+ "navigation.getFeatures": [{
40539
+ name: "deviceId",
40540
+ form: "single",
40541
+ optional: false
40542
+ }],
40543
+ "navigation.goToPoint": [{
40544
+ name: "deviceId",
40545
+ form: "single",
40546
+ optional: false
40547
+ }],
40548
+ "navigation.listActions": [{
40549
+ name: "deviceId",
40550
+ form: "single",
40551
+ optional: false
40552
+ }],
40553
+ "navigation.move": [{
40554
+ name: "deviceId",
40555
+ form: "single",
40556
+ optional: false
40557
+ }],
40558
+ "navigation.playSound": [{
40559
+ name: "deviceId",
40560
+ form: "single",
40561
+ optional: false
40562
+ }],
40563
+ "navigation.runAction": [{
40564
+ name: "deviceId",
40565
+ form: "single",
40566
+ optional: false
40567
+ }],
40568
+ "navigation.setLightLevel": [{
40569
+ name: "deviceId",
40570
+ form: "single",
40571
+ optional: false
40572
+ }],
40573
+ "navigation.setLightMode": [{
40574
+ name: "deviceId",
40575
+ form: "single",
40576
+ optional: false
40577
+ }],
40578
+ "navigation.setLightOn": [{
40579
+ name: "deviceId",
40580
+ form: "single",
40581
+ optional: false
40582
+ }],
40583
+ "navigation.stop": [{
40584
+ name: "deviceId",
40585
+ form: "single",
40586
+ optional: false
40587
+ }],
40190
40588
  "networkQuality.getDeviceStats": [{
40191
40589
  name: "deviceId",
40192
40590
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-unifi",
3
- "version": "0.2.70",
3
+ "version": "0.2.72",
4
4
  "description": "UniFi Network controller device-provider addon for CamStack — local-controller infra switches/APs (as containers) + network-client presence. NO cameras/Protect.",
5
5
  "keywords": [
6
6
  "camstack",