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