@camstack/addon-provider-homematic 1.2.80 → 1.2.81

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.
Files changed (3) hide show
  1. package/dist/addon.js +500 -365
  2. package/dist/addon.mjs +500 -365
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8,7 +8,7 @@ let http = require("http");
8
8
  let crypto$1 = require("crypto");
9
9
  let fs_promises = require("fs/promises");
10
10
  let path = require("path");
11
- //#region ../types/dist/event-category-zAv7pMUz.mjs
11
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -203,6 +203,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
203
203
  EventCategory["ProcessCrashed"] = "process.crashed";
204
204
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
205
205
  EventCategory["ProcessRestarted"] = "process.restarted";
206
+ /**
207
+ * The SET of storage locations changed — one was created, edited, enabled,
208
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
209
+ *
210
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
211
+ * it must also converge on its own periodic path, because a dropped event
212
+ * must not leave a node writing to yesterday's disk set forever. It exists
213
+ * because there was NO signal at all — an operator who added a second
214
+ * recordings disk in the admin UI got nothing, and the recorder kept its
215
+ * resolved locations until something else happened to re-resolve them
216
+ * (D387). Payload `StorageLocationsChangedPayload`.
217
+ */
218
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
206
219
  EventCategory["RecordingStarted"] = "recording.started";
207
220
  EventCategory["RecordingStopped"] = "recording.stopped";
208
221
  EventCategory["RecordingError"] = "recording.error";
@@ -8545,6 +8558,21 @@ var StorageCleanupJobSchema = object({
8545
8558
  });
8546
8559
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8547
8560
  /**
8561
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8562
+ * alias below is `z.infer<>` of it, never a second spelling.
8563
+ */
8564
+ var StorageLocationModeSchema = _enum([
8565
+ "active",
8566
+ "readonly",
8567
+ "drain",
8568
+ "disabled"
8569
+ ]);
8570
+ _enum([
8571
+ "normal",
8572
+ "never",
8573
+ "drain"
8574
+ ]);
8575
+ /**
8548
8576
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8549
8577
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8550
8578
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8610,6 +8638,21 @@ var StorageLocationSchema = object({
8610
8638
  * stops existing rather than being re-derived on every read.
8611
8639
  */
8612
8640
  enabled: boolean().optional(),
8641
+ /**
8642
+ * THE state of this location (D385), and the only authority on what may be
8643
+ * written, read or evicted here. Interpreted in exactly one place —
8644
+ * `storage-location-mode.ts` — which also folds the legacy
8645
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8646
+ * ambiguous.
8647
+ *
8648
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8649
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8650
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8651
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8652
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8653
+ * either, so the two cannot disagree.
8654
+ */
8655
+ mode: StorageLocationModeSchema.optional(),
8613
8656
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8614
8657
  * for node-local locations it can reach) — never persisted, absent when the
8615
8658
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8617,11 +8660,46 @@ var StorageLocationSchema = object({
8617
8660
  totalBytes: number(),
8618
8661
  availableBytes: number()
8619
8662
  }).nullable().optional(),
8663
+ /**
8664
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8665
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8666
+ * never persisted, never a filesystem walk.
8667
+ *
8668
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8669
+ * location yet — nobody stores here, the owning addon is down, or the first
8670
+ * refresh has not completed. A UI must omit the segment rather than draw it
8671
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8672
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8673
+ * be spelled out loud instead of appearing by accident.
8674
+ *
8675
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8676
+ * about the whole figure rather than about its freshest part.
8677
+ */
8678
+ owned: object({
8679
+ bytes: number().int().nonnegative(),
8680
+ measuredAtMs: number().int().nonnegative()
8681
+ }).optional(),
8620
8682
  createdAt: number(),
8621
8683
  updatedAt: number()
8622
8684
  });
8623
8685
  object({ isDefault: boolean().optional() });
8624
8686
  /**
8687
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8688
+ *
8689
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8690
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8691
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8692
+ * operator learns not to believe the screen.
8693
+ */
8694
+ var StorageDrainProgressSchema = object({
8695
+ locationId: string(),
8696
+ startedAtMs: number(),
8697
+ startBytes: number(),
8698
+ bytesRemaining: number(),
8699
+ drained: boolean(),
8700
+ estimatedEmptyAtMs: number().nullable()
8701
+ });
8702
+ /**
8625
8703
  * Reference accepted by consumer-facing `api.storage.*` calls.
8626
8704
  * Either:
8627
8705
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22016,7 +22094,7 @@ method(object({
22016
22094
  }), _void(), {
22017
22095
  kind: "mutation",
22018
22096
  auth: "admin"
22019
- }), method(object({ id: string() }), object({
22097
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22020
22098
  ok: boolean(),
22021
22099
  error: string().optional()
22022
22100
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22086,6 +22164,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22086
22164
  kind: "mutation",
22087
22165
  auth: "admin"
22088
22166
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22167
+ /**
22168
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22169
+ * location (D388).
22170
+ *
22171
+ * ## Why this is not `storage-evictable`
22172
+ *
22173
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22174
+ * not, in two ways that both matter and both bite hardest on the locations an
22175
+ * operator most wants a figure for:
22176
+ *
22177
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22178
+ * and `recordingsLow:default` deliberately share one root and evict as one
22179
+ * oldest-first pool, so both answer with the SAME combined total. As an
22180
+ * occupancy figure that double-counts the disk.
22181
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22182
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22183
+ * is retiring and staring at.
22184
+ *
22185
+ * So this is its own contract with its own quantity, and the quantity is
22186
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22187
+ * would ever be willing to delete it. A provider that can only answer
22188
+ * "evictable" must not register here — a number that silently means different
22189
+ * things per class is worse than no number.
22190
+ *
22191
+ * ## Absence is an answer
22192
+ *
22193
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22194
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22195
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22196
+ * consuming side has to be written out loud instead of appearing by accident.
22197
+ *
22198
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22199
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22200
+ */
22201
+ /** One provider's occupancy answer for one location. */
22202
+ var StorageOccupancyReportSchema = object({
22203
+ locationId: string(),
22204
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22205
+ * not net of what it is willing to delete. */
22206
+ ownedBytes: number().int().nonnegative(),
22207
+ /** When the provider last actually measured this. The orchestrator carries it
22208
+ * through so a UI can say how old the figure is instead of implying "now". */
22209
+ measuredAtMs: number().int().nonnegative()
22210
+ });
22211
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22089
22212
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22090
22213
  providerId: string().min(1),
22091
22214
  displayName: string().min(1),
@@ -23921,88 +24044,6 @@ onStatusChanged: { data: object({
23921
24044
  volatileStateFields: ["lastUpdated"]
23922
24045
  };
23923
24046
  /**
23924
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23925
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23926
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23927
- * one Home Assistant projection.
23928
- */
23929
- var NetworkLinkStatusSchema = object({
23930
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23931
- type: _enum([
23932
- "wifi",
23933
- "ethernet",
23934
- "cellular",
23935
- "unknown"
23936
- ]),
23937
- /**
23938
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23939
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23940
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23941
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23942
- * SKIP a null rather than coerce it.
23943
- */
23944
- signalPercent: number().min(0).max(100).nullable(),
23945
- /** Raw received signal strength in dBm, when the firmware reports one. */
23946
- rssiDbm: number().optional(),
23947
- /** Network name of a wireless link, when the firmware reports it. */
23948
- ssid: string().optional(),
23949
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23950
- lastUpdated: number()
23951
- });
23952
- var networkLinkCapability = {
23953
- name: "network-link",
23954
- scope: "device",
23955
- deviceNative: true,
23956
- mode: "singleton",
23957
- deviceTypes: [
23958
- DeviceType.Camera,
23959
- DeviceType.Sensor,
23960
- DeviceType.Button,
23961
- DeviceType.Switch,
23962
- DeviceType.Light,
23963
- DeviceType.Lock,
23964
- DeviceType.Siren
23965
- ],
23966
- methods: {},
23967
- events: {
23968
- /**
23969
- * Emitted whenever the cached status changes (a link switch, a signal
23970
- * reading that moved). Mirrored on the parent chain by the
23971
- * DeviceEventPropagator like `battery.onStatusChanged`.
23972
- */
23973
- onStatusChanged: { data: object({
23974
- deviceId: number(),
23975
- status: NetworkLinkStatusSchema
23976
- }) } },
23977
- status: {
23978
- schema: NetworkLinkStatusSchema,
23979
- kind: "push",
23980
- empty: {
23981
- type: "unknown",
23982
- signalPercent: null,
23983
- lastUpdated: 0
23984
- }
23985
- },
23986
- /**
23987
- * Runtime-state slice — every provider stores the same shape under
23988
- * `device.runtimeState['network-link']`, read once by the badge and the
23989
- * Home Assistant projector regardless of the driver.
23990
- */
23991
- runtimeState: NetworkLinkStatusSchema,
23992
- /**
23993
- * Runtime-state durability: **restored** — a link reading is slow to
23994
- * change and a sleeping battery camera may not report for hours; the
23995
- * restored slice is what the badge shows until the next read.
23996
- *
23997
- * See `RuntimeStateDurability`. Enforced by
23998
- * `scripts/check-runtime-state-durability.ts`.
23999
- */
24000
- durability: "restored",
24001
- /** Clock fields: written, but excluded from the compare that decides
24002
- * whether persisting is worth a SQLite commit. */
24003
- volatileStateFields: ["lastUpdated"]
24004
- };
24005
- /**
24006
24047
  * Generic boolean sensor — last-resort fallback when no domain-
24007
24048
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24008
24049
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27532,6 +27573,369 @@ var nativeObjectDetectionCapability = {
27532
27573
  volatileStateFields: ["lastFetchedAt"]
27533
27574
  };
27534
27575
  /**
27576
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27577
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27578
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27579
+ *
27580
+ * Why a NEW cap rather than overloading `ptz`:
27581
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27582
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27583
+ * The two are different physical models: PTZ is absolute-position + presets,
27584
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27585
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27586
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27587
+ * the reverse:
27588
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27589
+ * / `getOptions`), and
27590
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27591
+ * robot camera shows up in the existing PTZ control path without every
27592
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27593
+ * not here (see the addon design note):
27594
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27595
+ * ptz.stop() → navigation.stop()
27596
+ * ptz.goHome() → navigation.runAction('goHome')
27597
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27598
+ * ptz.goToPreset(id) → navigation.runAction(id)
27599
+ *
27600
+ * ## Continuous drive
27601
+ *
27602
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27603
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27604
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27605
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27606
+ * coalesce them. The UI owns the cadence.
27607
+ *
27608
+ * ## The action dictionary
27609
+ *
27610
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27611
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27612
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27613
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27614
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27615
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27616
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27617
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27618
+ *
27619
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27620
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27621
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27622
+ * every device handle. A future nodedreame publish adds a typed
27623
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27624
+ * provider can then swap the raw calls for the typed methods with no change to
27625
+ * THIS contract.
27626
+ */
27627
+ /**
27628
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27629
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27630
+ * halts it.
27631
+ *
27632
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27633
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27634
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27635
+ * vector by it (drivers without proportional drive ignore it).
27636
+ *
27637
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27638
+ * axis alone; an all-undefined nudge is a no-op.
27639
+ */
27640
+ var NavigationMoveCommandSchema = object({
27641
+ pan: number().min(-1).max(1).optional(),
27642
+ tilt: number().min(-1).max(1).optional(),
27643
+ speed: number().min(0).max(1).optional()
27644
+ });
27645
+ /**
27646
+ * The enumerated discrete actions a navigation-capable robot can perform via
27647
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27648
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27649
+ * `playSound` (see the `sound` dictionary entries).
27650
+ */
27651
+ var NavigationActionIdSchema = _enum([
27652
+ "goHome",
27653
+ "locate",
27654
+ "spotClean",
27655
+ "findPet",
27656
+ "personFollow",
27657
+ "stop",
27658
+ "startClean",
27659
+ "pauseClean",
27660
+ "dockWash",
27661
+ "autoEmpty",
27662
+ "flashOn",
27663
+ "flashOff"
27664
+ ]);
27665
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27666
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27667
+ /**
27668
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27669
+ * native panel and the PTZ mimic render as a button.
27670
+ *
27671
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27672
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27673
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27674
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27675
+ * - `label` — operator-facing English label.
27676
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27677
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27678
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27679
+ * flips it from config, never by editing code.
27680
+ */
27681
+ var NavigationActionEntrySchema = object({
27682
+ id: string(),
27683
+ kind: NavigationEntryKindSchema,
27684
+ label: string(),
27685
+ icon: string(),
27686
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27687
+ soundId: number().int().optional(),
27688
+ /** Per-device feature flag — render this entry only when true. */
27689
+ enabled: boolean()
27690
+ });
27691
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27692
+ var NavigationPointSchema = object({
27693
+ x: number(),
27694
+ y: number()
27695
+ });
27696
+ /**
27697
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27698
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27699
+ * that are turned on for THIS device. Data-driven: the provider derives these
27700
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27701
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27702
+ * that are not dictionary entries.
27703
+ *
27704
+ * - `move` / `stop` — the momentary drive joystick.
27705
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27706
+ * map-coordinate plumbing is wired.
27707
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27708
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27709
+ * - `light` — the on/off fill-light toggle (works anytime).
27710
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27711
+ * camera-service control; needs an active stream).
27712
+ */
27713
+ var NavigationFeaturesSchema = object({
27714
+ move: boolean(),
27715
+ stop: boolean(),
27716
+ goToPoint: boolean(),
27717
+ runAction: boolean(),
27718
+ playSound: boolean(),
27719
+ light: boolean(),
27720
+ lightMode: boolean()
27721
+ });
27722
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27723
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27724
+ /**
27725
+ * Live navigation state so the UI can reflect what the robot is doing:
27726
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27727
+ * - `following` — person/pet follow is currently armed.
27728
+ * - `flash` — the on-camera fill light is on.
27729
+ * - `lightMode` — auto vs manual fill-light mode.
27730
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27731
+ * `lightMode === 'manual'`.
27732
+ */
27733
+ var NavigationStatusSchema = object({
27734
+ mode: _enum([
27735
+ "idle",
27736
+ "cleaning",
27737
+ "spot",
27738
+ "following",
27739
+ "goto",
27740
+ "returning",
27741
+ "paused",
27742
+ "unknown"
27743
+ ]),
27744
+ following: boolean(),
27745
+ flash: boolean(),
27746
+ lightMode: NavigationLightModeSchema,
27747
+ lightLevel: number().min(40).max(100),
27748
+ /** Ms epoch when the slice was last updated. */
27749
+ lastChangedAt: number()
27750
+ });
27751
+ /**
27752
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27753
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27754
+ * convention.
27755
+ */
27756
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27757
+ var navigationCapability = {
27758
+ name: "navigation",
27759
+ scope: "device",
27760
+ deviceNative: true,
27761
+ mode: "singleton",
27762
+ deviceTypes: [DeviceType.Camera],
27763
+ deviceConfig: { ui: {
27764
+ kind: "widget",
27765
+ widgetId: "host/navigation-panel",
27766
+ tab: "navigation",
27767
+ topTab: true,
27768
+ label: "Navigation",
27769
+ order: 0
27770
+ } },
27771
+ methods: {
27772
+ /**
27773
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27774
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27775
+ * path) works for any authenticated user, not admin-only. The UI sends
27776
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27777
+ * a single drive write WITHOUT debouncing.
27778
+ */
27779
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27780
+ /** Halt all motion immediately (zero drive vector). */
27781
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27782
+ /** Send the robot to a point on its live map. */
27783
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27784
+ /**
27785
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27786
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27787
+ */
27788
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27789
+ /**
27790
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27791
+ * unsupported action ids are rejected by the provider.
27792
+ */
27793
+ runAction: method(object({
27794
+ deviceId: number(),
27795
+ actionId: NavigationActionIdSchema
27796
+ }), _void(), { kind: "mutation" }),
27797
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27798
+ playSound: method(object({
27799
+ deviceId: number(),
27800
+ soundId: number().int()
27801
+ }), _void(), { kind: "mutation" }),
27802
+ /**
27803
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27804
+ * works anytime, no active stream required).
27805
+ */
27806
+ setLightOn: method(object({
27807
+ deviceId: number(),
27808
+ on: boolean()
27809
+ }), _void(), { kind: "mutation" }),
27810
+ /**
27811
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27812
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27813
+ * action that generally needs an active camera stream/monitor session — the
27814
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27815
+ */
27816
+ setLightMode: method(object({
27817
+ deviceId: number(),
27818
+ mode: NavigationLightModeSchema,
27819
+ level: number().min(40).max(100).optional()
27820
+ }), _void(), { kind: "mutation" }),
27821
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27822
+ setLightLevel: method(object({
27823
+ deviceId: number(),
27824
+ level: number().min(40).max(100)
27825
+ }), _void(), { kind: "mutation" }),
27826
+ /**
27827
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27828
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27829
+ * `listActions`).
27830
+ */
27831
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27832
+ },
27833
+ events: { onStatusChanged: { data: object({
27834
+ deviceId: number(),
27835
+ status: NavigationStatusSchema
27836
+ }) } },
27837
+ status: {
27838
+ schema: NavigationStatusSchema,
27839
+ kind: "push"
27840
+ },
27841
+ /**
27842
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27843
+ * for live mode / follow / flash changes.
27844
+ */
27845
+ runtimeState: NavigationRuntimeStateSchema,
27846
+ /**
27847
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27848
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27849
+ * that. The live handle re-publishes on connect.
27850
+ *
27851
+ * See `RuntimeStateDurability`. Enforced by
27852
+ * `scripts/check-runtime-state-durability.ts`.
27853
+ */
27854
+ durability: "session"
27855
+ };
27856
+ /**
27857
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27858
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27859
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27860
+ * one Home Assistant projection.
27861
+ */
27862
+ var NetworkLinkStatusSchema = object({
27863
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27864
+ type: _enum([
27865
+ "wifi",
27866
+ "ethernet",
27867
+ "cellular",
27868
+ "unknown"
27869
+ ]),
27870
+ /**
27871
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27872
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27873
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27874
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27875
+ * SKIP a null rather than coerce it.
27876
+ */
27877
+ signalPercent: number().min(0).max(100).nullable(),
27878
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27879
+ rssiDbm: number().optional(),
27880
+ /** Network name of a wireless link, when the firmware reports it. */
27881
+ ssid: string().optional(),
27882
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27883
+ lastUpdated: number()
27884
+ });
27885
+ var networkLinkCapability = {
27886
+ name: "network-link",
27887
+ scope: "device",
27888
+ deviceNative: true,
27889
+ mode: "singleton",
27890
+ deviceTypes: [
27891
+ DeviceType.Camera,
27892
+ DeviceType.Sensor,
27893
+ DeviceType.Button,
27894
+ DeviceType.Switch,
27895
+ DeviceType.Light,
27896
+ DeviceType.Lock,
27897
+ DeviceType.Siren
27898
+ ],
27899
+ methods: {},
27900
+ events: {
27901
+ /**
27902
+ * Emitted whenever the cached status changes (a link switch, a signal
27903
+ * reading that moved). Mirrored on the parent chain by the
27904
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27905
+ */
27906
+ onStatusChanged: { data: object({
27907
+ deviceId: number(),
27908
+ status: NetworkLinkStatusSchema
27909
+ }) } },
27910
+ status: {
27911
+ schema: NetworkLinkStatusSchema,
27912
+ kind: "push",
27913
+ empty: {
27914
+ type: "unknown",
27915
+ signalPercent: null,
27916
+ lastUpdated: 0
27917
+ }
27918
+ },
27919
+ /**
27920
+ * Runtime-state slice — every provider stores the same shape under
27921
+ * `device.runtimeState['network-link']`, read once by the badge and the
27922
+ * Home Assistant projector regardless of the driver.
27923
+ */
27924
+ runtimeState: NetworkLinkStatusSchema,
27925
+ /**
27926
+ * Runtime-state durability: **restored** — a link reading is slow to
27927
+ * change and a sleeping battery camera may not report for hours; the
27928
+ * restored slice is what the badge shows until the next read.
27929
+ *
27930
+ * See `RuntimeStateDurability`. Enforced by
27931
+ * `scripts/check-runtime-state-durability.ts`.
27932
+ */
27933
+ durability: "restored",
27934
+ /** Clock fields: written, but excluded from the compare that decides
27935
+ * whether persisting is worth a SQLite commit. */
27936
+ volatileStateFields: ["lastUpdated"]
27937
+ };
27938
+ /**
27535
27939
  * network-quality — system-scoped singleton capability tracking RTT,
27536
27940
  * jitter, and observed/peak bandwidth per device + per client.
27537
27941
  *
@@ -29112,287 +29516,6 @@ var ptzAutotrackCapability = {
29112
29516
  */
29113
29517
  durability: "session"
29114
29518
  };
29115
- /**
29116
- * `navigation` — a device-scoped capability that natively expresses the FULL
29117
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29118
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29119
- *
29120
- * Why a NEW cap rather than overloading `ptz`:
29121
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29122
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29123
- * The two are different physical models: PTZ is absolute-position + presets,
29124
- * navigation is momentary drive nudges + discrete robot ACTIONS
29125
- * (dock / spot-clean / follow-pet / go-to-point / …).
29126
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29127
- * the reverse:
29128
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29129
- * / `getOptions`), and
29130
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29131
- * robot camera shows up in the existing PTZ control path without every
29132
- * PTZ provider learning about robots. The mapping lives in the adapter,
29133
- * not here (see the addon design note):
29134
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29135
- * ptz.stop() → navigation.stop()
29136
- * ptz.goHome() → navigation.runAction('goHome')
29137
- * ptz.getPresets() → navigation.listActions() (id→preset)
29138
- * ptz.goToPreset(id) → navigation.runAction(id)
29139
- *
29140
- * ## Continuous drive
29141
- *
29142
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29143
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29144
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29145
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29146
- * coalesce them. The UI owns the cadence.
29147
- *
29148
- * ## The action dictionary
29149
- *
29150
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29151
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29152
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29153
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29154
- * vendor-specific list. `kind: 'action'` entries are triggered with
29155
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29156
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29157
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29158
- *
29159
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29160
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29161
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29162
- * every device handle. A future nodedreame publish adds a typed
29163
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29164
- * provider can then swap the raw calls for the typed methods with no change to
29165
- * THIS contract.
29166
- */
29167
- /**
29168
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29169
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29170
- * halts it.
29171
- *
29172
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29173
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29174
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29175
- * vector by it (drivers without proportional drive ignore it).
29176
- *
29177
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29178
- * axis alone; an all-undefined nudge is a no-op.
29179
- */
29180
- var NavigationMoveCommandSchema = object({
29181
- pan: number().min(-1).max(1).optional(),
29182
- tilt: number().min(-1).max(1).optional(),
29183
- speed: number().min(0).max(1).optional()
29184
- });
29185
- /**
29186
- * The enumerated discrete actions a navigation-capable robot can perform via
29187
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29188
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29189
- * `playSound` (see the `sound` dictionary entries).
29190
- */
29191
- var NavigationActionIdSchema = _enum([
29192
- "goHome",
29193
- "locate",
29194
- "spotClean",
29195
- "findPet",
29196
- "personFollow",
29197
- "stop",
29198
- "startClean",
29199
- "pauseClean",
29200
- "dockWash",
29201
- "autoEmpty",
29202
- "flashOn",
29203
- "flashOff"
29204
- ]);
29205
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29206
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29207
- /**
29208
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29209
- * native panel and the PTZ mimic render as a button.
29210
- *
29211
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29212
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29213
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29214
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29215
- * - `label` — operator-facing English label.
29216
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29217
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29218
- * PTZ render ONLY enabled entries. Data-driven: the provider
29219
- * flips it from config, never by editing code.
29220
- */
29221
- var NavigationActionEntrySchema = object({
29222
- id: string(),
29223
- kind: NavigationEntryKindSchema,
29224
- label: string(),
29225
- icon: string(),
29226
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29227
- soundId: number().int().optional(),
29228
- /** Per-device feature flag — render this entry only when true. */
29229
- enabled: boolean()
29230
- });
29231
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29232
- var NavigationPointSchema = object({
29233
- x: number(),
29234
- y: number()
29235
- });
29236
- /**
29237
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29238
- * The cap reports which are enabled so the UI / PTZ render only the controls
29239
- * that are turned on for THIS device. Data-driven: the provider derives these
29240
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29241
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29242
- * that are not dictionary entries.
29243
- *
29244
- * - `move` / `stop` — the momentary drive joystick.
29245
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29246
- * map-coordinate plumbing is wired.
29247
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29248
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29249
- * - `light` — the on/off fill-light toggle (works anytime).
29250
- * - `lightMode` — the auto/manual selector + manual level slider (a
29251
- * camera-service control; needs an active stream).
29252
- */
29253
- var NavigationFeaturesSchema = object({
29254
- move: boolean(),
29255
- stop: boolean(),
29256
- goToPoint: boolean(),
29257
- runAction: boolean(),
29258
- playSound: boolean(),
29259
- light: boolean(),
29260
- lightMode: boolean()
29261
- });
29262
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29263
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29264
- /**
29265
- * Live navigation state so the UI can reflect what the robot is doing:
29266
- * - `mode` — coarse activity (idle / cleaning / following / …).
29267
- * - `following` — person/pet follow is currently armed.
29268
- * - `flash` — the on-camera fill light is on.
29269
- * - `lightMode` — auto vs manual fill-light mode.
29270
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29271
- * `lightMode === 'manual'`.
29272
- */
29273
- var NavigationStatusSchema = object({
29274
- mode: _enum([
29275
- "idle",
29276
- "cleaning",
29277
- "spot",
29278
- "following",
29279
- "goto",
29280
- "returning",
29281
- "paused",
29282
- "unknown"
29283
- ]),
29284
- following: boolean(),
29285
- flash: boolean(),
29286
- lightMode: NavigationLightModeSchema,
29287
- lightLevel: number().min(40).max(100),
29288
- /** Ms epoch when the slice was last updated. */
29289
- lastChangedAt: number()
29290
- });
29291
- /**
29292
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29293
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29294
- * convention.
29295
- */
29296
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29297
- var navigationCapability = {
29298
- name: "navigation",
29299
- scope: "device",
29300
- deviceNative: true,
29301
- mode: "singleton",
29302
- deviceTypes: [DeviceType.Camera],
29303
- deviceConfig: { ui: {
29304
- kind: "widget",
29305
- widgetId: "host/navigation-panel",
29306
- tab: "navigation",
29307
- topTab: true,
29308
- label: "Navigation",
29309
- order: 0
29310
- } },
29311
- methods: {
29312
- /**
29313
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29314
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29315
- * path) works for any authenticated user, not admin-only. The UI sends
29316
- * these at ~1 Hz while a control is held; the provider forwards each one to
29317
- * a single drive write WITHOUT debouncing.
29318
- */
29319
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29320
- /** Halt all motion immediately (zero drive vector). */
29321
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29322
- /** Send the robot to a point on its live map. */
29323
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29324
- /**
29325
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29326
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29327
- */
29328
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29329
- /**
29330
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29331
- * unsupported action ids are rejected by the provider.
29332
- */
29333
- runAction: method(object({
29334
- deviceId: number(),
29335
- actionId: NavigationActionIdSchema
29336
- }), _void(), { kind: "mutation" }),
29337
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29338
- playSound: method(object({
29339
- deviceId: number(),
29340
- soundId: number().int()
29341
- }), _void(), { kind: "mutation" }),
29342
- /**
29343
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29344
- * works anytime, no active stream required).
29345
- */
29346
- setLightOn: method(object({
29347
- deviceId: number(),
29348
- on: boolean()
29349
- }), _void(), { kind: "mutation" }),
29350
- /**
29351
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29352
- * initial `level`. The auto/manual + level control is a CAMERA-service
29353
- * action that generally needs an active camera stream/monitor session — the
29354
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29355
- */
29356
- setLightMode: method(object({
29357
- deviceId: number(),
29358
- mode: NavigationLightModeSchema,
29359
- level: number().min(40).max(100).optional()
29360
- }), _void(), { kind: "mutation" }),
29361
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29362
- setLightLevel: method(object({
29363
- deviceId: number(),
29364
- level: number().min(40).max(100)
29365
- }), _void(), { kind: "mutation" }),
29366
- /**
29367
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29368
- * controls the UI shows (the per-entry flags for the dictionary come back on
29369
- * `listActions`).
29370
- */
29371
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29372
- },
29373
- events: { onStatusChanged: { data: object({
29374
- deviceId: number(),
29375
- status: NavigationStatusSchema
29376
- }) } },
29377
- status: {
29378
- schema: NavigationStatusSchema,
29379
- kind: "push"
29380
- },
29381
- /**
29382
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29383
- * for live mode / follow / flash changes.
29384
- */
29385
- runtimeState: NavigationRuntimeStateSchema,
29386
- /**
29387
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29388
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29389
- * that. The live handle re-publishes on connect.
29390
- *
29391
- * See `RuntimeStateDurability`. Enforced by
29392
- * `scripts/check-runtime-state-durability.ts`.
29393
- */
29394
- durability: "session"
29395
- };
29396
29519
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29397
29520
  kind: "mutation",
29398
29521
  auth: "admin"
@@ -38855,6 +38978,12 @@ Object.freeze({
38855
38978
  addonId: null,
38856
38979
  access: "view"
38857
38980
  },
38981
+ "storage.listDrainProgress": {
38982
+ capName: "storage",
38983
+ capScope: "system",
38984
+ addonId: null,
38985
+ access: "view"
38986
+ },
38858
38987
  "storage.listLocationDeclarations": {
38859
38988
  capName: "storage",
38860
38989
  capScope: "system",
@@ -38999,6 +39128,12 @@ Object.freeze({
38999
39128
  addonId: null,
39000
39129
  access: "view"
39001
39130
  },
39131
+ "storageOccupancy.getOccupancy": {
39132
+ capName: "storage-occupancy",
39133
+ capScope: "system",
39134
+ addonId: null,
39135
+ access: "view"
39136
+ },
39002
39137
  "storageProvider.abortUpload": {
39003
39138
  capName: "storage-provider",
39004
39139
  capScope: "system",