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