@camstack/addon-provider-reolink 1.2.102 → 1.2.103
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 +520 -385
- package/dist/addon.mjs +520 -385
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import * as net2 from "net";
|
|
|
20
20
|
import netImpl from "net";
|
|
21
21
|
import { mkdir } from "fs/promises";
|
|
22
22
|
import os from "node:os";
|
|
23
|
-
//#region ../types/dist/event-category-
|
|
23
|
+
//#region ../types/dist/event-category-CnLqLOKs.mjs
|
|
24
24
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
25
25
|
EventCategory["SystemBoot"] = "system.boot";
|
|
26
26
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -215,6 +215,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
215
215
|
EventCategory["ProcessCrashed"] = "process.crashed";
|
|
216
216
|
EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
|
|
217
217
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
218
|
+
/**
|
|
219
|
+
* The SET of storage locations changed — one was created, edited, enabled,
|
|
220
|
+
* disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
|
|
221
|
+
*
|
|
222
|
+
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
223
|
+
* it must also converge on its own periodic path, because a dropped event
|
|
224
|
+
* must not leave a node writing to yesterday's disk set forever. It exists
|
|
225
|
+
* because there was NO signal at all — an operator who added a second
|
|
226
|
+
* recordings disk in the admin UI got nothing, and the recorder kept its
|
|
227
|
+
* resolved locations until something else happened to re-resolve them
|
|
228
|
+
* (D387). Payload `StorageLocationsChangedPayload`.
|
|
229
|
+
*/
|
|
230
|
+
EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
|
|
218
231
|
EventCategory["RecordingStarted"] = "recording.started";
|
|
219
232
|
EventCategory["RecordingStopped"] = "recording.stopped";
|
|
220
233
|
EventCategory["RecordingError"] = "recording.error";
|
|
@@ -8569,6 +8582,21 @@ var StorageCleanupJobSchema = object({
|
|
|
8569
8582
|
});
|
|
8570
8583
|
var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
|
|
8571
8584
|
/**
|
|
8585
|
+
* The one typed state of a storage location. Authoritative Zod schema — the TS
|
|
8586
|
+
* alias below is `z.infer<>` of it, never a second spelling.
|
|
8587
|
+
*/
|
|
8588
|
+
var StorageLocationModeSchema = _enum([
|
|
8589
|
+
"active",
|
|
8590
|
+
"readonly",
|
|
8591
|
+
"drain",
|
|
8592
|
+
"disabled"
|
|
8593
|
+
]);
|
|
8594
|
+
_enum([
|
|
8595
|
+
"normal",
|
|
8596
|
+
"never",
|
|
8597
|
+
"drain"
|
|
8598
|
+
]);
|
|
8599
|
+
/**
|
|
8572
8600
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
8573
8601
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
8574
8602
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -8634,6 +8662,21 @@ var StorageLocationSchema = object({
|
|
|
8634
8662
|
* stops existing rather than being re-derived on every read.
|
|
8635
8663
|
*/
|
|
8636
8664
|
enabled: boolean().optional(),
|
|
8665
|
+
/**
|
|
8666
|
+
* THE state of this location (D385), and the only authority on what may be
|
|
8667
|
+
* written, read or evicted here. Interpreted in exactly one place —
|
|
8668
|
+
* `storage-location-mode.ts` — which also folds the legacy
|
|
8669
|
+
* `enabled` / `config.readOnly` pair into a mode so an old row is never
|
|
8670
|
+
* ambiguous.
|
|
8671
|
+
*
|
|
8672
|
+
* OPTIONAL only for the wire and for rows written before D385: absence is
|
|
8673
|
+
* resolved by `resolveLocationMode`, and the orchestrator stamps every
|
|
8674
|
+
* unstamped row ONCE at hydrate so absence stops existing rather than being
|
|
8675
|
+
* re-derived on every read. `enabled` survives one release as a DERIVED
|
|
8676
|
+
* mirror (`mode === 'active'`); `withLocationMode` is the only writer of
|
|
8677
|
+
* either, so the two cannot disagree.
|
|
8678
|
+
*/
|
|
8679
|
+
mode: StorageLocationModeSchema.optional(),
|
|
8637
8680
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
8638
8681
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
8639
8682
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -8641,11 +8684,46 @@ var StorageLocationSchema = object({
|
|
|
8641
8684
|
totalBytes: number(),
|
|
8642
8685
|
availableBytes: number()
|
|
8643
8686
|
}).nullable().optional(),
|
|
8687
|
+
/**
|
|
8688
|
+
* How much of that volume CamStack ITSELF holds on this location (D388) —
|
|
8689
|
+
* COMPUTED at read time from the `storage-occupancy` providers' own figures,
|
|
8690
|
+
* never persisted, never a filesystem walk.
|
|
8691
|
+
*
|
|
8692
|
+
* **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
|
|
8693
|
+
* location yet — nobody stores here, the owning addon is down, or the first
|
|
8694
|
+
* refresh has not completed. A UI must omit the segment rather than draw it
|
|
8695
|
+
* at zero, which would claim we occupy nothing (D315). It is an OBJECT and
|
|
8696
|
+
* not a bare number precisely so that a `?? 0` on the consuming side has to
|
|
8697
|
+
* be spelled out loud instead of appearing by accident.
|
|
8698
|
+
*
|
|
8699
|
+
* `measuredAtMs` is the OLDEST contributing measurement, so it is honest
|
|
8700
|
+
* about the whole figure rather than about its freshest part.
|
|
8701
|
+
*/
|
|
8702
|
+
owned: object({
|
|
8703
|
+
bytes: number().int().nonnegative(),
|
|
8704
|
+
measuredAtMs: number().int().nonnegative()
|
|
8705
|
+
}).optional(),
|
|
8644
8706
|
createdAt: number(),
|
|
8645
8707
|
updatedAt: number()
|
|
8646
8708
|
});
|
|
8647
8709
|
object({ isDefault: boolean().optional() });
|
|
8648
8710
|
/**
|
|
8711
|
+
* How far a `drain` has got (D386) — the read a UI renders, and nothing more.
|
|
8712
|
+
*
|
|
8713
|
+
* `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
|
|
8714
|
+
* OBSERVED and is `null` when it has observed none. Never a fabricated date: a
|
|
8715
|
+
* drain with no observed growth has no honest ETA, and inventing one is how an
|
|
8716
|
+
* operator learns not to believe the screen.
|
|
8717
|
+
*/
|
|
8718
|
+
var StorageDrainProgressSchema = object({
|
|
8719
|
+
locationId: string(),
|
|
8720
|
+
startedAtMs: number(),
|
|
8721
|
+
startBytes: number(),
|
|
8722
|
+
bytesRemaining: number(),
|
|
8723
|
+
drained: boolean(),
|
|
8724
|
+
estimatedEmptyAtMs: number().nullable()
|
|
8725
|
+
});
|
|
8726
|
+
/**
|
|
8649
8727
|
* Reference accepted by consumer-facing `api.storage.*` calls.
|
|
8650
8728
|
* Either:
|
|
8651
8729
|
* - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
|
|
@@ -22684,7 +22762,7 @@ method(object({
|
|
|
22684
22762
|
}), _void(), {
|
|
22685
22763
|
kind: "mutation",
|
|
22686
22764
|
auth: "admin"
|
|
22687
|
-
}), method(object({ id: string() }), object({
|
|
22765
|
+
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
22688
22766
|
ok: boolean(),
|
|
22689
22767
|
error: string().optional()
|
|
22690
22768
|
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
@@ -22754,6 +22832,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
|
|
|
22754
22832
|
kind: "mutation",
|
|
22755
22833
|
auth: "admin"
|
|
22756
22834
|
}), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
|
|
22835
|
+
/**
|
|
22836
|
+
* `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
|
|
22837
|
+
* location (D388).
|
|
22838
|
+
*
|
|
22839
|
+
* ## Why this is not `storage-evictable`
|
|
22840
|
+
*
|
|
22841
|
+
* `storage-evictable.getEvictableUsage` looks like the same question and is
|
|
22842
|
+
* not, in two ways that both matter and both bite hardest on the locations an
|
|
22843
|
+
* operator most wants a figure for:
|
|
22844
|
+
*
|
|
22845
|
+
* - it reports the whole eviction DOMAIN, not the location. `recordings:default`
|
|
22846
|
+
* and `recordingsLow:default` deliberately share one root and evict as one
|
|
22847
|
+
* oldest-first pool, so both answer with the SAME combined total. As an
|
|
22848
|
+
* occupancy figure that double-counts the disk.
|
|
22849
|
+
* - it reports ZERO for a location whose eviction policy is `never` (D385) —
|
|
22850
|
+
* a `readonly` or `disabled` disk. Those are exactly the disks an operator
|
|
22851
|
+
* is retiring and staring at.
|
|
22852
|
+
*
|
|
22853
|
+
* So this is its own contract with its own quantity, and the quantity is
|
|
22854
|
+
* OCCUPIED: every byte the addon holds on that location, whether or not it
|
|
22855
|
+
* would ever be willing to delete it. A provider that can only answer
|
|
22856
|
+
* "evictable" must not register here — a number that silently means different
|
|
22857
|
+
* things per class is worse than no number.
|
|
22858
|
+
*
|
|
22859
|
+
* ## Absence is an answer
|
|
22860
|
+
*
|
|
22861
|
+
* A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
|
|
22862
|
+
* stamps `StorageLocation.owned` only for locations it has a report for, and
|
|
22863
|
+
* the field is an OBJECT rather than a bare number so that a `?? 0` on the
|
|
22864
|
+
* consuming side has to be written out loud instead of appearing by accident.
|
|
22865
|
+
*
|
|
22866
|
+
* `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
|
|
22867
|
+
* a public client surface. Clients read the stamped `StorageLocation.owned`.
|
|
22868
|
+
*/
|
|
22869
|
+
/** One provider's occupancy answer for one location. */
|
|
22870
|
+
var StorageOccupancyReportSchema = object({
|
|
22871
|
+
locationId: string(),
|
|
22872
|
+
/** Bytes this provider holds on THAT location — not its eviction domain, and
|
|
22873
|
+
* not net of what it is willing to delete. */
|
|
22874
|
+
ownedBytes: number().int().nonnegative(),
|
|
22875
|
+
/** When the provider last actually measured this. The orchestrator carries it
|
|
22876
|
+
* through so a UI can say how old the figure is instead of implying "now". */
|
|
22877
|
+
measuredAtMs: number().int().nonnegative()
|
|
22878
|
+
});
|
|
22879
|
+
method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
|
|
22757
22880
|
var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
22758
22881
|
providerId: string().min(1),
|
|
22759
22882
|
displayName: string().min(1),
|
|
@@ -24589,108 +24712,6 @@ onStatusChanged: { data: object({
|
|
|
24589
24712
|
volatileStateFields: ["lastUpdated"]
|
|
24590
24713
|
};
|
|
24591
24714
|
/**
|
|
24592
|
-
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
24593
|
-
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
24594
|
-
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
24595
|
-
* one Home Assistant projection.
|
|
24596
|
-
*/
|
|
24597
|
-
var NetworkLinkStatusSchema = object({
|
|
24598
|
-
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
24599
|
-
type: _enum([
|
|
24600
|
-
"wifi",
|
|
24601
|
-
"ethernet",
|
|
24602
|
-
"cellular",
|
|
24603
|
-
"unknown"
|
|
24604
|
-
]),
|
|
24605
|
-
/**
|
|
24606
|
-
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
24607
|
-
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
24608
|
-
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
24609
|
-
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
24610
|
-
* SKIP a null rather than coerce it.
|
|
24611
|
-
*/
|
|
24612
|
-
signalPercent: number().min(0).max(100).nullable(),
|
|
24613
|
-
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
24614
|
-
rssiDbm: number().optional(),
|
|
24615
|
-
/** Network name of a wireless link, when the firmware reports it. */
|
|
24616
|
-
ssid: string().optional(),
|
|
24617
|
-
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
24618
|
-
lastUpdated: number()
|
|
24619
|
-
});
|
|
24620
|
-
/** The slice a provider seeds before its first read: nothing is known yet. */
|
|
24621
|
-
var NETWORK_LINK_UNKNOWN = {
|
|
24622
|
-
type: "unknown",
|
|
24623
|
-
signalPercent: null,
|
|
24624
|
-
lastUpdated: 0
|
|
24625
|
-
};
|
|
24626
|
-
/**
|
|
24627
|
-
* Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
|
|
24628
|
-
* Out-of-range or non-finite input is not a reading: `null`.
|
|
24629
|
-
*/
|
|
24630
|
-
function signalPercentFromBars(bars, maxBars) {
|
|
24631
|
-
if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
|
|
24632
|
-
if (bars < 0 || bars > maxBars) return null;
|
|
24633
|
-
return Math.round(bars / maxBars * 100);
|
|
24634
|
-
}
|
|
24635
|
-
/**
|
|
24636
|
-
* Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
|
|
24637
|
-
* below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
|
|
24638
|
-
* positive input is not an RSSI: `null`.
|
|
24639
|
-
*/
|
|
24640
|
-
function signalPercentFromRssi(rssiDbm) {
|
|
24641
|
-
if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
|
|
24642
|
-
return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
|
|
24643
|
-
}
|
|
24644
|
-
var networkLinkCapability = {
|
|
24645
|
-
name: "network-link",
|
|
24646
|
-
scope: "device",
|
|
24647
|
-
deviceNative: true,
|
|
24648
|
-
mode: "singleton",
|
|
24649
|
-
deviceTypes: [
|
|
24650
|
-
DeviceType.Camera,
|
|
24651
|
-
DeviceType.Sensor,
|
|
24652
|
-
DeviceType.Button,
|
|
24653
|
-
DeviceType.Switch,
|
|
24654
|
-
DeviceType.Light,
|
|
24655
|
-
DeviceType.Lock,
|
|
24656
|
-
DeviceType.Siren
|
|
24657
|
-
],
|
|
24658
|
-
methods: {},
|
|
24659
|
-
events: {
|
|
24660
|
-
/**
|
|
24661
|
-
* Emitted whenever the cached status changes (a link switch, a signal
|
|
24662
|
-
* reading that moved). Mirrored on the parent chain by the
|
|
24663
|
-
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
24664
|
-
*/
|
|
24665
|
-
onStatusChanged: { data: object({
|
|
24666
|
-
deviceId: number(),
|
|
24667
|
-
status: NetworkLinkStatusSchema
|
|
24668
|
-
}) } },
|
|
24669
|
-
status: {
|
|
24670
|
-
schema: NetworkLinkStatusSchema,
|
|
24671
|
-
kind: "push",
|
|
24672
|
-
empty: NETWORK_LINK_UNKNOWN
|
|
24673
|
-
},
|
|
24674
|
-
/**
|
|
24675
|
-
* Runtime-state slice — every provider stores the same shape under
|
|
24676
|
-
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
24677
|
-
* Home Assistant projector regardless of the driver.
|
|
24678
|
-
*/
|
|
24679
|
-
runtimeState: NetworkLinkStatusSchema,
|
|
24680
|
-
/**
|
|
24681
|
-
* Runtime-state durability: **restored** — a link reading is slow to
|
|
24682
|
-
* change and a sleeping battery camera may not report for hours; the
|
|
24683
|
-
* restored slice is what the badge shows until the next read.
|
|
24684
|
-
*
|
|
24685
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
24686
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
24687
|
-
*/
|
|
24688
|
-
durability: "restored",
|
|
24689
|
-
/** Clock fields: written, but excluded from the compare that decides
|
|
24690
|
-
* whether persisting is worth a SQLite commit. */
|
|
24691
|
-
volatileStateFields: ["lastUpdated"]
|
|
24692
|
-
};
|
|
24693
|
-
/**
|
|
24694
24715
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
24695
24716
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
24696
24717
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -28220,6 +28241,389 @@ var nativeObjectDetectionCapability = {
|
|
|
28220
28241
|
volatileStateFields: ["lastFetchedAt"]
|
|
28221
28242
|
};
|
|
28222
28243
|
/**
|
|
28244
|
+
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
28245
|
+
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
28246
|
+
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
28247
|
+
*
|
|
28248
|
+
* Why a NEW cap rather than overloading `ptz`:
|
|
28249
|
+
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
28250
|
+
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
28251
|
+
* The two are different physical models: PTZ is absolute-position + presets,
|
|
28252
|
+
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
28253
|
+
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
28254
|
+
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
28255
|
+
* the reverse:
|
|
28256
|
+
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
28257
|
+
* / `getOptions`), and
|
|
28258
|
+
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
28259
|
+
* robot camera shows up in the existing PTZ control path without every
|
|
28260
|
+
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
28261
|
+
* not here (see the addon design note):
|
|
28262
|
+
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
28263
|
+
* ptz.stop() → navigation.stop()
|
|
28264
|
+
* ptz.goHome() → navigation.runAction('goHome')
|
|
28265
|
+
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
28266
|
+
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
28267
|
+
*
|
|
28268
|
+
* ## Continuous drive
|
|
28269
|
+
*
|
|
28270
|
+
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
28271
|
+
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
28272
|
+
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
28273
|
+
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
28274
|
+
* coalesce them. The UI owns the cadence.
|
|
28275
|
+
*
|
|
28276
|
+
* ## The action dictionary
|
|
28277
|
+
*
|
|
28278
|
+
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
28279
|
+
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
28280
|
+
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
28281
|
+
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
28282
|
+
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
28283
|
+
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
28284
|
+
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
28285
|
+
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
28286
|
+
*
|
|
28287
|
+
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
28288
|
+
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
28289
|
+
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
28290
|
+
* every device handle. A future nodedreame publish adds a typed
|
|
28291
|
+
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
28292
|
+
* provider can then swap the raw calls for the typed methods with no change to
|
|
28293
|
+
* THIS contract.
|
|
28294
|
+
*/
|
|
28295
|
+
/**
|
|
28296
|
+
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
28297
|
+
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
28298
|
+
* halts it.
|
|
28299
|
+
*
|
|
28300
|
+
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
28301
|
+
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
28302
|
+
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
28303
|
+
* vector by it (drivers without proportional drive ignore it).
|
|
28304
|
+
*
|
|
28305
|
+
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
28306
|
+
* axis alone; an all-undefined nudge is a no-op.
|
|
28307
|
+
*/
|
|
28308
|
+
var NavigationMoveCommandSchema = object({
|
|
28309
|
+
pan: number().min(-1).max(1).optional(),
|
|
28310
|
+
tilt: number().min(-1).max(1).optional(),
|
|
28311
|
+
speed: number().min(0).max(1).optional()
|
|
28312
|
+
});
|
|
28313
|
+
/**
|
|
28314
|
+
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
28315
|
+
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
28316
|
+
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
28317
|
+
* `playSound` (see the `sound` dictionary entries).
|
|
28318
|
+
*/
|
|
28319
|
+
var NavigationActionIdSchema = _enum([
|
|
28320
|
+
"goHome",
|
|
28321
|
+
"locate",
|
|
28322
|
+
"spotClean",
|
|
28323
|
+
"findPet",
|
|
28324
|
+
"personFollow",
|
|
28325
|
+
"stop",
|
|
28326
|
+
"startClean",
|
|
28327
|
+
"pauseClean",
|
|
28328
|
+
"dockWash",
|
|
28329
|
+
"autoEmpty",
|
|
28330
|
+
"flashOn",
|
|
28331
|
+
"flashOff"
|
|
28332
|
+
]);
|
|
28333
|
+
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
28334
|
+
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
28335
|
+
/**
|
|
28336
|
+
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
28337
|
+
* native panel and the PTZ mimic render as a button.
|
|
28338
|
+
*
|
|
28339
|
+
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
28340
|
+
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
28341
|
+
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
28342
|
+
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
28343
|
+
* - `label` — operator-facing English label.
|
|
28344
|
+
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
28345
|
+
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
28346
|
+
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
28347
|
+
* flips it from config, never by editing code.
|
|
28348
|
+
*/
|
|
28349
|
+
var NavigationActionEntrySchema = object({
|
|
28350
|
+
id: string(),
|
|
28351
|
+
kind: NavigationEntryKindSchema,
|
|
28352
|
+
label: string(),
|
|
28353
|
+
icon: string(),
|
|
28354
|
+
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
28355
|
+
soundId: number().int().optional(),
|
|
28356
|
+
/** Per-device feature flag — render this entry only when true. */
|
|
28357
|
+
enabled: boolean()
|
|
28358
|
+
});
|
|
28359
|
+
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
28360
|
+
var NavigationPointSchema = object({
|
|
28361
|
+
x: number(),
|
|
28362
|
+
y: number()
|
|
28363
|
+
});
|
|
28364
|
+
/**
|
|
28365
|
+
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
28366
|
+
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
28367
|
+
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
28368
|
+
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
28369
|
+
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
28370
|
+
* that are not dictionary entries.
|
|
28371
|
+
*
|
|
28372
|
+
* - `move` / `stop` — the momentary drive joystick.
|
|
28373
|
+
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
28374
|
+
* map-coordinate plumbing is wired.
|
|
28375
|
+
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
28376
|
+
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
28377
|
+
* - `light` — the on/off fill-light toggle (works anytime).
|
|
28378
|
+
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
28379
|
+
* camera-service control; needs an active stream).
|
|
28380
|
+
*/
|
|
28381
|
+
var NavigationFeaturesSchema = object({
|
|
28382
|
+
move: boolean(),
|
|
28383
|
+
stop: boolean(),
|
|
28384
|
+
goToPoint: boolean(),
|
|
28385
|
+
runAction: boolean(),
|
|
28386
|
+
playSound: boolean(),
|
|
28387
|
+
light: boolean(),
|
|
28388
|
+
lightMode: boolean()
|
|
28389
|
+
});
|
|
28390
|
+
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
28391
|
+
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
28392
|
+
/**
|
|
28393
|
+
* Live navigation state so the UI can reflect what the robot is doing:
|
|
28394
|
+
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
28395
|
+
* - `following` — person/pet follow is currently armed.
|
|
28396
|
+
* - `flash` — the on-camera fill light is on.
|
|
28397
|
+
* - `lightMode` — auto vs manual fill-light mode.
|
|
28398
|
+
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
28399
|
+
* `lightMode === 'manual'`.
|
|
28400
|
+
*/
|
|
28401
|
+
var NavigationStatusSchema = object({
|
|
28402
|
+
mode: _enum([
|
|
28403
|
+
"idle",
|
|
28404
|
+
"cleaning",
|
|
28405
|
+
"spot",
|
|
28406
|
+
"following",
|
|
28407
|
+
"goto",
|
|
28408
|
+
"returning",
|
|
28409
|
+
"paused",
|
|
28410
|
+
"unknown"
|
|
28411
|
+
]),
|
|
28412
|
+
following: boolean(),
|
|
28413
|
+
flash: boolean(),
|
|
28414
|
+
lightMode: NavigationLightModeSchema,
|
|
28415
|
+
lightLevel: number().min(40).max(100),
|
|
28416
|
+
/** Ms epoch when the slice was last updated. */
|
|
28417
|
+
lastChangedAt: number()
|
|
28418
|
+
});
|
|
28419
|
+
/**
|
|
28420
|
+
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
28421
|
+
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
28422
|
+
* convention.
|
|
28423
|
+
*/
|
|
28424
|
+
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
28425
|
+
var navigationCapability = {
|
|
28426
|
+
name: "navigation",
|
|
28427
|
+
scope: "device",
|
|
28428
|
+
deviceNative: true,
|
|
28429
|
+
mode: "singleton",
|
|
28430
|
+
deviceTypes: [DeviceType.Camera],
|
|
28431
|
+
deviceConfig: { ui: {
|
|
28432
|
+
kind: "widget",
|
|
28433
|
+
widgetId: "host/navigation-panel",
|
|
28434
|
+
tab: "navigation",
|
|
28435
|
+
topTab: true,
|
|
28436
|
+
label: "Navigation",
|
|
28437
|
+
order: 0
|
|
28438
|
+
} },
|
|
28439
|
+
methods: {
|
|
28440
|
+
/**
|
|
28441
|
+
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
28442
|
+
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
28443
|
+
* path) works for any authenticated user, not admin-only. The UI sends
|
|
28444
|
+
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
28445
|
+
* a single drive write WITHOUT debouncing.
|
|
28446
|
+
*/
|
|
28447
|
+
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
28448
|
+
/** Halt all motion immediately (zero drive vector). */
|
|
28449
|
+
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
28450
|
+
/** Send the robot to a point on its live map. */
|
|
28451
|
+
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
28452
|
+
/**
|
|
28453
|
+
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
28454
|
+
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
28455
|
+
*/
|
|
28456
|
+
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
28457
|
+
/**
|
|
28458
|
+
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
28459
|
+
* unsupported action ids are rejected by the provider.
|
|
28460
|
+
*/
|
|
28461
|
+
runAction: method(object({
|
|
28462
|
+
deviceId: number(),
|
|
28463
|
+
actionId: NavigationActionIdSchema
|
|
28464
|
+
}), _void(), { kind: "mutation" }),
|
|
28465
|
+
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
28466
|
+
playSound: method(object({
|
|
28467
|
+
deviceId: number(),
|
|
28468
|
+
soundId: number().int()
|
|
28469
|
+
}), _void(), { kind: "mutation" }),
|
|
28470
|
+
/**
|
|
28471
|
+
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
28472
|
+
* works anytime, no active stream required).
|
|
28473
|
+
*/
|
|
28474
|
+
setLightOn: method(object({
|
|
28475
|
+
deviceId: number(),
|
|
28476
|
+
on: boolean()
|
|
28477
|
+
}), _void(), { kind: "mutation" }),
|
|
28478
|
+
/**
|
|
28479
|
+
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
28480
|
+
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
28481
|
+
* action that generally needs an active camera stream/monitor session — the
|
|
28482
|
+
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
28483
|
+
*/
|
|
28484
|
+
setLightMode: method(object({
|
|
28485
|
+
deviceId: number(),
|
|
28486
|
+
mode: NavigationLightModeSchema,
|
|
28487
|
+
level: number().min(40).max(100).optional()
|
|
28488
|
+
}), _void(), { kind: "mutation" }),
|
|
28489
|
+
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
28490
|
+
setLightLevel: method(object({
|
|
28491
|
+
deviceId: number(),
|
|
28492
|
+
level: number().min(40).max(100)
|
|
28493
|
+
}), _void(), { kind: "mutation" }),
|
|
28494
|
+
/**
|
|
28495
|
+
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
28496
|
+
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
28497
|
+
* `listActions`).
|
|
28498
|
+
*/
|
|
28499
|
+
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
28500
|
+
},
|
|
28501
|
+
events: { onStatusChanged: { data: object({
|
|
28502
|
+
deviceId: number(),
|
|
28503
|
+
status: NavigationStatusSchema
|
|
28504
|
+
}) } },
|
|
28505
|
+
status: {
|
|
28506
|
+
schema: NavigationStatusSchema,
|
|
28507
|
+
kind: "push"
|
|
28508
|
+
},
|
|
28509
|
+
/**
|
|
28510
|
+
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
28511
|
+
* for live mode / follow / flash changes.
|
|
28512
|
+
*/
|
|
28513
|
+
runtimeState: NavigationRuntimeStateSchema,
|
|
28514
|
+
/**
|
|
28515
|
+
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
28516
|
+
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
28517
|
+
* that. The live handle re-publishes on connect.
|
|
28518
|
+
*
|
|
28519
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
28520
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
28521
|
+
*/
|
|
28522
|
+
durability: "session"
|
|
28523
|
+
};
|
|
28524
|
+
/**
|
|
28525
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
28526
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
28527
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
28528
|
+
* one Home Assistant projection.
|
|
28529
|
+
*/
|
|
28530
|
+
var NetworkLinkStatusSchema = object({
|
|
28531
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
28532
|
+
type: _enum([
|
|
28533
|
+
"wifi",
|
|
28534
|
+
"ethernet",
|
|
28535
|
+
"cellular",
|
|
28536
|
+
"unknown"
|
|
28537
|
+
]),
|
|
28538
|
+
/**
|
|
28539
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
28540
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
28541
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
28542
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
28543
|
+
* SKIP a null rather than coerce it.
|
|
28544
|
+
*/
|
|
28545
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
28546
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
28547
|
+
rssiDbm: number().optional(),
|
|
28548
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
28549
|
+
ssid: string().optional(),
|
|
28550
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
28551
|
+
lastUpdated: number()
|
|
28552
|
+
});
|
|
28553
|
+
/** The slice a provider seeds before its first read: nothing is known yet. */
|
|
28554
|
+
var NETWORK_LINK_UNKNOWN = {
|
|
28555
|
+
type: "unknown",
|
|
28556
|
+
signalPercent: null,
|
|
28557
|
+
lastUpdated: 0
|
|
28558
|
+
};
|
|
28559
|
+
/**
|
|
28560
|
+
* Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
|
|
28561
|
+
* Out-of-range or non-finite input is not a reading: `null`.
|
|
28562
|
+
*/
|
|
28563
|
+
function signalPercentFromBars(bars, maxBars) {
|
|
28564
|
+
if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
|
|
28565
|
+
if (bars < 0 || bars > maxBars) return null;
|
|
28566
|
+
return Math.round(bars / maxBars * 100);
|
|
28567
|
+
}
|
|
28568
|
+
/**
|
|
28569
|
+
* Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
|
|
28570
|
+
* below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
|
|
28571
|
+
* positive input is not an RSSI: `null`.
|
|
28572
|
+
*/
|
|
28573
|
+
function signalPercentFromRssi(rssiDbm) {
|
|
28574
|
+
if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
|
|
28575
|
+
return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
|
|
28576
|
+
}
|
|
28577
|
+
var networkLinkCapability = {
|
|
28578
|
+
name: "network-link",
|
|
28579
|
+
scope: "device",
|
|
28580
|
+
deviceNative: true,
|
|
28581
|
+
mode: "singleton",
|
|
28582
|
+
deviceTypes: [
|
|
28583
|
+
DeviceType.Camera,
|
|
28584
|
+
DeviceType.Sensor,
|
|
28585
|
+
DeviceType.Button,
|
|
28586
|
+
DeviceType.Switch,
|
|
28587
|
+
DeviceType.Light,
|
|
28588
|
+
DeviceType.Lock,
|
|
28589
|
+
DeviceType.Siren
|
|
28590
|
+
],
|
|
28591
|
+
methods: {},
|
|
28592
|
+
events: {
|
|
28593
|
+
/**
|
|
28594
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
28595
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
28596
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
28597
|
+
*/
|
|
28598
|
+
onStatusChanged: { data: object({
|
|
28599
|
+
deviceId: number(),
|
|
28600
|
+
status: NetworkLinkStatusSchema
|
|
28601
|
+
}) } },
|
|
28602
|
+
status: {
|
|
28603
|
+
schema: NetworkLinkStatusSchema,
|
|
28604
|
+
kind: "push",
|
|
28605
|
+
empty: NETWORK_LINK_UNKNOWN
|
|
28606
|
+
},
|
|
28607
|
+
/**
|
|
28608
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
28609
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
28610
|
+
* Home Assistant projector regardless of the driver.
|
|
28611
|
+
*/
|
|
28612
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
28613
|
+
/**
|
|
28614
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
28615
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
28616
|
+
* restored slice is what the badge shows until the next read.
|
|
28617
|
+
*
|
|
28618
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
28619
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
28620
|
+
*/
|
|
28621
|
+
durability: "restored",
|
|
28622
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
28623
|
+
* whether persisting is worth a SQLite commit. */
|
|
28624
|
+
volatileStateFields: ["lastUpdated"]
|
|
28625
|
+
};
|
|
28626
|
+
/**
|
|
28223
28627
|
* network-quality — system-scoped singleton capability tracking RTT,
|
|
28224
28628
|
* jitter, and observed/peak bandwidth per device + per client.
|
|
28225
28629
|
*
|
|
@@ -29863,287 +30267,6 @@ var ptzAutotrackCapability = {
|
|
|
29863
30267
|
durability: "session"
|
|
29864
30268
|
};
|
|
29865
30269
|
/**
|
|
29866
|
-
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
29867
|
-
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
29868
|
-
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
29869
|
-
*
|
|
29870
|
-
* Why a NEW cap rather than overloading `ptz`:
|
|
29871
|
-
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
29872
|
-
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
29873
|
-
* The two are different physical models: PTZ is absolute-position + presets,
|
|
29874
|
-
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
29875
|
-
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
29876
|
-
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
29877
|
-
* the reverse:
|
|
29878
|
-
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
29879
|
-
* / `getOptions`), and
|
|
29880
|
-
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
29881
|
-
* robot camera shows up in the existing PTZ control path without every
|
|
29882
|
-
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
29883
|
-
* not here (see the addon design note):
|
|
29884
|
-
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
29885
|
-
* ptz.stop() → navigation.stop()
|
|
29886
|
-
* ptz.goHome() → navigation.runAction('goHome')
|
|
29887
|
-
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
29888
|
-
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
29889
|
-
*
|
|
29890
|
-
* ## Continuous drive
|
|
29891
|
-
*
|
|
29892
|
-
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
29893
|
-
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
29894
|
-
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
29895
|
-
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
29896
|
-
* coalesce them. The UI owns the cadence.
|
|
29897
|
-
*
|
|
29898
|
-
* ## The action dictionary
|
|
29899
|
-
*
|
|
29900
|
-
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
29901
|
-
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
29902
|
-
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
29903
|
-
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
29904
|
-
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
29905
|
-
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
29906
|
-
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
29907
|
-
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
29908
|
-
*
|
|
29909
|
-
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
29910
|
-
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
29911
|
-
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
29912
|
-
* every device handle. A future nodedreame publish adds a typed
|
|
29913
|
-
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
29914
|
-
* provider can then swap the raw calls for the typed methods with no change to
|
|
29915
|
-
* THIS contract.
|
|
29916
|
-
*/
|
|
29917
|
-
/**
|
|
29918
|
-
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
29919
|
-
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
29920
|
-
* halts it.
|
|
29921
|
-
*
|
|
29922
|
-
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
29923
|
-
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
29924
|
-
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
29925
|
-
* vector by it (drivers without proportional drive ignore it).
|
|
29926
|
-
*
|
|
29927
|
-
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
29928
|
-
* axis alone; an all-undefined nudge is a no-op.
|
|
29929
|
-
*/
|
|
29930
|
-
var NavigationMoveCommandSchema = object({
|
|
29931
|
-
pan: number().min(-1).max(1).optional(),
|
|
29932
|
-
tilt: number().min(-1).max(1).optional(),
|
|
29933
|
-
speed: number().min(0).max(1).optional()
|
|
29934
|
-
});
|
|
29935
|
-
/**
|
|
29936
|
-
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
29937
|
-
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
29938
|
-
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
29939
|
-
* `playSound` (see the `sound` dictionary entries).
|
|
29940
|
-
*/
|
|
29941
|
-
var NavigationActionIdSchema = _enum([
|
|
29942
|
-
"goHome",
|
|
29943
|
-
"locate",
|
|
29944
|
-
"spotClean",
|
|
29945
|
-
"findPet",
|
|
29946
|
-
"personFollow",
|
|
29947
|
-
"stop",
|
|
29948
|
-
"startClean",
|
|
29949
|
-
"pauseClean",
|
|
29950
|
-
"dockWash",
|
|
29951
|
-
"autoEmpty",
|
|
29952
|
-
"flashOn",
|
|
29953
|
-
"flashOff"
|
|
29954
|
-
]);
|
|
29955
|
-
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
29956
|
-
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
29957
|
-
/**
|
|
29958
|
-
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
29959
|
-
* native panel and the PTZ mimic render as a button.
|
|
29960
|
-
*
|
|
29961
|
-
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
29962
|
-
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
29963
|
-
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
29964
|
-
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
29965
|
-
* - `label` — operator-facing English label.
|
|
29966
|
-
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
29967
|
-
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
29968
|
-
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
29969
|
-
* flips it from config, never by editing code.
|
|
29970
|
-
*/
|
|
29971
|
-
var NavigationActionEntrySchema = object({
|
|
29972
|
-
id: string(),
|
|
29973
|
-
kind: NavigationEntryKindSchema,
|
|
29974
|
-
label: string(),
|
|
29975
|
-
icon: string(),
|
|
29976
|
-
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
29977
|
-
soundId: number().int().optional(),
|
|
29978
|
-
/** Per-device feature flag — render this entry only when true. */
|
|
29979
|
-
enabled: boolean()
|
|
29980
|
-
});
|
|
29981
|
-
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
29982
|
-
var NavigationPointSchema = object({
|
|
29983
|
-
x: number(),
|
|
29984
|
-
y: number()
|
|
29985
|
-
});
|
|
29986
|
-
/**
|
|
29987
|
-
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
29988
|
-
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
29989
|
-
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
29990
|
-
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
29991
|
-
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
29992
|
-
* that are not dictionary entries.
|
|
29993
|
-
*
|
|
29994
|
-
* - `move` / `stop` — the momentary drive joystick.
|
|
29995
|
-
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
29996
|
-
* map-coordinate plumbing is wired.
|
|
29997
|
-
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
29998
|
-
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
29999
|
-
* - `light` — the on/off fill-light toggle (works anytime).
|
|
30000
|
-
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
30001
|
-
* camera-service control; needs an active stream).
|
|
30002
|
-
*/
|
|
30003
|
-
var NavigationFeaturesSchema = object({
|
|
30004
|
-
move: boolean(),
|
|
30005
|
-
stop: boolean(),
|
|
30006
|
-
goToPoint: boolean(),
|
|
30007
|
-
runAction: boolean(),
|
|
30008
|
-
playSound: boolean(),
|
|
30009
|
-
light: boolean(),
|
|
30010
|
-
lightMode: boolean()
|
|
30011
|
-
});
|
|
30012
|
-
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
30013
|
-
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
30014
|
-
/**
|
|
30015
|
-
* Live navigation state so the UI can reflect what the robot is doing:
|
|
30016
|
-
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
30017
|
-
* - `following` — person/pet follow is currently armed.
|
|
30018
|
-
* - `flash` — the on-camera fill light is on.
|
|
30019
|
-
* - `lightMode` — auto vs manual fill-light mode.
|
|
30020
|
-
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
30021
|
-
* `lightMode === 'manual'`.
|
|
30022
|
-
*/
|
|
30023
|
-
var NavigationStatusSchema = object({
|
|
30024
|
-
mode: _enum([
|
|
30025
|
-
"idle",
|
|
30026
|
-
"cleaning",
|
|
30027
|
-
"spot",
|
|
30028
|
-
"following",
|
|
30029
|
-
"goto",
|
|
30030
|
-
"returning",
|
|
30031
|
-
"paused",
|
|
30032
|
-
"unknown"
|
|
30033
|
-
]),
|
|
30034
|
-
following: boolean(),
|
|
30035
|
-
flash: boolean(),
|
|
30036
|
-
lightMode: NavigationLightModeSchema,
|
|
30037
|
-
lightLevel: number().min(40).max(100),
|
|
30038
|
-
/** Ms epoch when the slice was last updated. */
|
|
30039
|
-
lastChangedAt: number()
|
|
30040
|
-
});
|
|
30041
|
-
/**
|
|
30042
|
-
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
30043
|
-
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
30044
|
-
* convention.
|
|
30045
|
-
*/
|
|
30046
|
-
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
30047
|
-
var navigationCapability = {
|
|
30048
|
-
name: "navigation",
|
|
30049
|
-
scope: "device",
|
|
30050
|
-
deviceNative: true,
|
|
30051
|
-
mode: "singleton",
|
|
30052
|
-
deviceTypes: [DeviceType.Camera],
|
|
30053
|
-
deviceConfig: { ui: {
|
|
30054
|
-
kind: "widget",
|
|
30055
|
-
widgetId: "host/navigation-panel",
|
|
30056
|
-
tab: "navigation",
|
|
30057
|
-
topTab: true,
|
|
30058
|
-
label: "Navigation",
|
|
30059
|
-
order: 0
|
|
30060
|
-
} },
|
|
30061
|
-
methods: {
|
|
30062
|
-
/**
|
|
30063
|
-
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
30064
|
-
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
30065
|
-
* path) works for any authenticated user, not admin-only. The UI sends
|
|
30066
|
-
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
30067
|
-
* a single drive write WITHOUT debouncing.
|
|
30068
|
-
*/
|
|
30069
|
-
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
30070
|
-
/** Halt all motion immediately (zero drive vector). */
|
|
30071
|
-
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
30072
|
-
/** Send the robot to a point on its live map. */
|
|
30073
|
-
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
30074
|
-
/**
|
|
30075
|
-
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
30076
|
-
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
30077
|
-
*/
|
|
30078
|
-
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
30079
|
-
/**
|
|
30080
|
-
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
30081
|
-
* unsupported action ids are rejected by the provider.
|
|
30082
|
-
*/
|
|
30083
|
-
runAction: method(object({
|
|
30084
|
-
deviceId: number(),
|
|
30085
|
-
actionId: NavigationActionIdSchema
|
|
30086
|
-
}), _void(), { kind: "mutation" }),
|
|
30087
|
-
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
30088
|
-
playSound: method(object({
|
|
30089
|
-
deviceId: number(),
|
|
30090
|
-
soundId: number().int()
|
|
30091
|
-
}), _void(), { kind: "mutation" }),
|
|
30092
|
-
/**
|
|
30093
|
-
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
30094
|
-
* works anytime, no active stream required).
|
|
30095
|
-
*/
|
|
30096
|
-
setLightOn: method(object({
|
|
30097
|
-
deviceId: number(),
|
|
30098
|
-
on: boolean()
|
|
30099
|
-
}), _void(), { kind: "mutation" }),
|
|
30100
|
-
/**
|
|
30101
|
-
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
30102
|
-
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
30103
|
-
* action that generally needs an active camera stream/monitor session — the
|
|
30104
|
-
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
30105
|
-
*/
|
|
30106
|
-
setLightMode: method(object({
|
|
30107
|
-
deviceId: number(),
|
|
30108
|
-
mode: NavigationLightModeSchema,
|
|
30109
|
-
level: number().min(40).max(100).optional()
|
|
30110
|
-
}), _void(), { kind: "mutation" }),
|
|
30111
|
-
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
30112
|
-
setLightLevel: method(object({
|
|
30113
|
-
deviceId: number(),
|
|
30114
|
-
level: number().min(40).max(100)
|
|
30115
|
-
}), _void(), { kind: "mutation" }),
|
|
30116
|
-
/**
|
|
30117
|
-
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
30118
|
-
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
30119
|
-
* `listActions`).
|
|
30120
|
-
*/
|
|
30121
|
-
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
30122
|
-
},
|
|
30123
|
-
events: { onStatusChanged: { data: object({
|
|
30124
|
-
deviceId: number(),
|
|
30125
|
-
status: NavigationStatusSchema
|
|
30126
|
-
}) } },
|
|
30127
|
-
status: {
|
|
30128
|
-
schema: NavigationStatusSchema,
|
|
30129
|
-
kind: "push"
|
|
30130
|
-
},
|
|
30131
|
-
/**
|
|
30132
|
-
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
30133
|
-
* for live mode / follow / flash changes.
|
|
30134
|
-
*/
|
|
30135
|
-
runtimeState: NavigationRuntimeStateSchema,
|
|
30136
|
-
/**
|
|
30137
|
-
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
30138
|
-
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
30139
|
-
* that. The live handle re-publishes on connect.
|
|
30140
|
-
*
|
|
30141
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
30142
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
30143
|
-
*/
|
|
30144
|
-
durability: "session"
|
|
30145
|
-
};
|
|
30146
|
-
/**
|
|
30147
30270
|
* reboot — device-scoped capability for "soft" device reboots (firmware
|
|
30148
30271
|
* reboot via vendor protocol; cameras, NVRs, doorbells). Surfaces a
|
|
30149
30272
|
* single mutation so the UI can offer a confirm-and-reboot button for
|
|
@@ -40006,6 +40129,12 @@ Object.freeze({
|
|
|
40006
40129
|
addonId: null,
|
|
40007
40130
|
access: "view"
|
|
40008
40131
|
},
|
|
40132
|
+
"storage.listDrainProgress": {
|
|
40133
|
+
capName: "storage",
|
|
40134
|
+
capScope: "system",
|
|
40135
|
+
addonId: null,
|
|
40136
|
+
access: "view"
|
|
40137
|
+
},
|
|
40009
40138
|
"storage.listLocationDeclarations": {
|
|
40010
40139
|
capName: "storage",
|
|
40011
40140
|
capScope: "system",
|
|
@@ -40150,6 +40279,12 @@ Object.freeze({
|
|
|
40150
40279
|
addonId: null,
|
|
40151
40280
|
access: "view"
|
|
40152
40281
|
},
|
|
40282
|
+
"storageOccupancy.getOccupancy": {
|
|
40283
|
+
capName: "storage-occupancy",
|
|
40284
|
+
capScope: "system",
|
|
40285
|
+
addonId: null,
|
|
40286
|
+
access: "view"
|
|
40287
|
+
},
|
|
40153
40288
|
"storageProvider.abortUpload": {
|
|
40154
40289
|
capName: "storage-provider",
|
|
40155
40290
|
capScope: "system",
|