@camstack/addon-provider-homeassistant 1.2.85 → 1.2.87
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 +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-DAyddjpR.js → dist-BmfTJtD2.js} +483 -1
- package/dist/{dist-D8MM0d_3.mjs → dist-G7mZomBW.mjs} +483 -1
- package/dist/ha-export/ha-export.addon.js +54 -1
- package/dist/ha-export/ha-export.addon.mjs +54 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-BmfTJtD2.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_zlib = require("node:zlib");
|
|
5
5
|
//#region src/ha-device-source.ts
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-
|
|
1
|
+
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-G7mZomBW.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
|
|
4
4
|
//#region src/ha-device-source.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-zAv7pMUz.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -370,6 +370,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
370
370
|
*/
|
|
371
371
|
EventCategory["BatteryOnStatusChanged"] = "battery.onStatusChanged";
|
|
372
372
|
/**
|
|
373
|
+
* Cap event fired by every device that registers the `network-link`
|
|
374
|
+
* capability. Mirrors the cap definition's `onStatusChanged`. Carries
|
|
375
|
+
* `{ deviceId, status: NetworkLinkStatus }` — a link switch or a signal
|
|
376
|
+
* reading that moved.
|
|
377
|
+
*/
|
|
378
|
+
EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
|
|
379
|
+
/**
|
|
373
380
|
* Emitted by the battery cap provider WHEN `wakeForStream` enters the
|
|
374
381
|
* "wake in progress" window — between the Baichuan wake-up issue and
|
|
375
382
|
* the camera's first dialed-back RTP packet. The stream-broker
|
|
@@ -24209,6 +24216,88 @@ onStatusChanged: { data: object({
|
|
|
24209
24216
|
volatileStateFields: ["lastUpdated"]
|
|
24210
24217
|
};
|
|
24211
24218
|
/**
|
|
24219
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
24220
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
24221
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
24222
|
+
* one Home Assistant projection.
|
|
24223
|
+
*/
|
|
24224
|
+
var NetworkLinkStatusSchema = object({
|
|
24225
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
24226
|
+
type: _enum([
|
|
24227
|
+
"wifi",
|
|
24228
|
+
"ethernet",
|
|
24229
|
+
"cellular",
|
|
24230
|
+
"unknown"
|
|
24231
|
+
]),
|
|
24232
|
+
/**
|
|
24233
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
24234
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
24235
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
24236
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
24237
|
+
* SKIP a null rather than coerce it.
|
|
24238
|
+
*/
|
|
24239
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
24240
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
24241
|
+
rssiDbm: number().optional(),
|
|
24242
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
24243
|
+
ssid: string().optional(),
|
|
24244
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
24245
|
+
lastUpdated: number()
|
|
24246
|
+
});
|
|
24247
|
+
var networkLinkCapability = {
|
|
24248
|
+
name: "network-link",
|
|
24249
|
+
scope: "device",
|
|
24250
|
+
deviceNative: true,
|
|
24251
|
+
mode: "singleton",
|
|
24252
|
+
deviceTypes: [
|
|
24253
|
+
DeviceType.Camera,
|
|
24254
|
+
DeviceType.Sensor,
|
|
24255
|
+
DeviceType.Button,
|
|
24256
|
+
DeviceType.Switch,
|
|
24257
|
+
DeviceType.Light,
|
|
24258
|
+
DeviceType.Lock,
|
|
24259
|
+
DeviceType.Siren
|
|
24260
|
+
],
|
|
24261
|
+
methods: {},
|
|
24262
|
+
events: {
|
|
24263
|
+
/**
|
|
24264
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
24265
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
24266
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
24267
|
+
*/
|
|
24268
|
+
onStatusChanged: { data: object({
|
|
24269
|
+
deviceId: number(),
|
|
24270
|
+
status: NetworkLinkStatusSchema
|
|
24271
|
+
}) } },
|
|
24272
|
+
status: {
|
|
24273
|
+
schema: NetworkLinkStatusSchema,
|
|
24274
|
+
kind: "push",
|
|
24275
|
+
empty: {
|
|
24276
|
+
type: "unknown",
|
|
24277
|
+
signalPercent: null,
|
|
24278
|
+
lastUpdated: 0
|
|
24279
|
+
}
|
|
24280
|
+
},
|
|
24281
|
+
/**
|
|
24282
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
24283
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
24284
|
+
* Home Assistant projector regardless of the driver.
|
|
24285
|
+
*/
|
|
24286
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
24287
|
+
/**
|
|
24288
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
24289
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
24290
|
+
* restored slice is what the badge shows until the next read.
|
|
24291
|
+
*
|
|
24292
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
24293
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
24294
|
+
*/
|
|
24295
|
+
durability: "restored",
|
|
24296
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
24297
|
+
* whether persisting is worth a SQLite commit. */
|
|
24298
|
+
volatileStateFields: ["lastUpdated"]
|
|
24299
|
+
};
|
|
24300
|
+
/**
|
|
24212
24301
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
24213
24302
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
24214
24303
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -29335,6 +29424,287 @@ var ptzAutotrackCapability = {
|
|
|
29335
29424
|
*/
|
|
29336
29425
|
durability: "session"
|
|
29337
29426
|
};
|
|
29427
|
+
/**
|
|
29428
|
+
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
29429
|
+
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
29430
|
+
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
29431
|
+
*
|
|
29432
|
+
* Why a NEW cap rather than overloading `ptz`:
|
|
29433
|
+
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
29434
|
+
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
29435
|
+
* The two are different physical models: PTZ is absolute-position + presets,
|
|
29436
|
+
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
29437
|
+
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
29438
|
+
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
29439
|
+
* the reverse:
|
|
29440
|
+
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
29441
|
+
* / `getOptions`), and
|
|
29442
|
+
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
29443
|
+
* robot camera shows up in the existing PTZ control path without every
|
|
29444
|
+
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
29445
|
+
* not here (see the addon design note):
|
|
29446
|
+
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
29447
|
+
* ptz.stop() → navigation.stop()
|
|
29448
|
+
* ptz.goHome() → navigation.runAction('goHome')
|
|
29449
|
+
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
29450
|
+
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
29451
|
+
*
|
|
29452
|
+
* ## Continuous drive
|
|
29453
|
+
*
|
|
29454
|
+
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
29455
|
+
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
29456
|
+
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
29457
|
+
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
29458
|
+
* coalesce them. The UI owns the cadence.
|
|
29459
|
+
*
|
|
29460
|
+
* ## The action dictionary
|
|
29461
|
+
*
|
|
29462
|
+
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
29463
|
+
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
29464
|
+
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
29465
|
+
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
29466
|
+
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
29467
|
+
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
29468
|
+
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
29469
|
+
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
29470
|
+
*
|
|
29471
|
+
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
29472
|
+
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
29473
|
+
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
29474
|
+
* every device handle. A future nodedreame publish adds a typed
|
|
29475
|
+
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
29476
|
+
* provider can then swap the raw calls for the typed methods with no change to
|
|
29477
|
+
* THIS contract.
|
|
29478
|
+
*/
|
|
29479
|
+
/**
|
|
29480
|
+
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
29481
|
+
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
29482
|
+
* halts it.
|
|
29483
|
+
*
|
|
29484
|
+
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
29485
|
+
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
29486
|
+
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
29487
|
+
* vector by it (drivers without proportional drive ignore it).
|
|
29488
|
+
*
|
|
29489
|
+
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
29490
|
+
* axis alone; an all-undefined nudge is a no-op.
|
|
29491
|
+
*/
|
|
29492
|
+
var NavigationMoveCommandSchema = object({
|
|
29493
|
+
pan: number().min(-1).max(1).optional(),
|
|
29494
|
+
tilt: number().min(-1).max(1).optional(),
|
|
29495
|
+
speed: number().min(0).max(1).optional()
|
|
29496
|
+
});
|
|
29497
|
+
/**
|
|
29498
|
+
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
29499
|
+
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
29500
|
+
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
29501
|
+
* `playSound` (see the `sound` dictionary entries).
|
|
29502
|
+
*/
|
|
29503
|
+
var NavigationActionIdSchema = _enum([
|
|
29504
|
+
"goHome",
|
|
29505
|
+
"locate",
|
|
29506
|
+
"spotClean",
|
|
29507
|
+
"findPet",
|
|
29508
|
+
"personFollow",
|
|
29509
|
+
"stop",
|
|
29510
|
+
"startClean",
|
|
29511
|
+
"pauseClean",
|
|
29512
|
+
"dockWash",
|
|
29513
|
+
"autoEmpty",
|
|
29514
|
+
"flashOn",
|
|
29515
|
+
"flashOff"
|
|
29516
|
+
]);
|
|
29517
|
+
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
29518
|
+
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
29519
|
+
/**
|
|
29520
|
+
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
29521
|
+
* native panel and the PTZ mimic render as a button.
|
|
29522
|
+
*
|
|
29523
|
+
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
29524
|
+
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
29525
|
+
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
29526
|
+
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
29527
|
+
* - `label` — operator-facing English label.
|
|
29528
|
+
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
29529
|
+
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
29530
|
+
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
29531
|
+
* flips it from config, never by editing code.
|
|
29532
|
+
*/
|
|
29533
|
+
var NavigationActionEntrySchema = object({
|
|
29534
|
+
id: string(),
|
|
29535
|
+
kind: NavigationEntryKindSchema,
|
|
29536
|
+
label: string(),
|
|
29537
|
+
icon: string(),
|
|
29538
|
+
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
29539
|
+
soundId: number().int().optional(),
|
|
29540
|
+
/** Per-device feature flag — render this entry only when true. */
|
|
29541
|
+
enabled: boolean()
|
|
29542
|
+
});
|
|
29543
|
+
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
29544
|
+
var NavigationPointSchema = object({
|
|
29545
|
+
x: number(),
|
|
29546
|
+
y: number()
|
|
29547
|
+
});
|
|
29548
|
+
/**
|
|
29549
|
+
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
29550
|
+
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
29551
|
+
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
29552
|
+
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
29553
|
+
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
29554
|
+
* that are not dictionary entries.
|
|
29555
|
+
*
|
|
29556
|
+
* - `move` / `stop` — the momentary drive joystick.
|
|
29557
|
+
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
29558
|
+
* map-coordinate plumbing is wired.
|
|
29559
|
+
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
29560
|
+
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
29561
|
+
* - `light` — the on/off fill-light toggle (works anytime).
|
|
29562
|
+
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
29563
|
+
* camera-service control; needs an active stream).
|
|
29564
|
+
*/
|
|
29565
|
+
var NavigationFeaturesSchema = object({
|
|
29566
|
+
move: boolean(),
|
|
29567
|
+
stop: boolean(),
|
|
29568
|
+
goToPoint: boolean(),
|
|
29569
|
+
runAction: boolean(),
|
|
29570
|
+
playSound: boolean(),
|
|
29571
|
+
light: boolean(),
|
|
29572
|
+
lightMode: boolean()
|
|
29573
|
+
});
|
|
29574
|
+
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
29575
|
+
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
29576
|
+
/**
|
|
29577
|
+
* Live navigation state so the UI can reflect what the robot is doing:
|
|
29578
|
+
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
29579
|
+
* - `following` — person/pet follow is currently armed.
|
|
29580
|
+
* - `flash` — the on-camera fill light is on.
|
|
29581
|
+
* - `lightMode` — auto vs manual fill-light mode.
|
|
29582
|
+
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
29583
|
+
* `lightMode === 'manual'`.
|
|
29584
|
+
*/
|
|
29585
|
+
var NavigationStatusSchema = object({
|
|
29586
|
+
mode: _enum([
|
|
29587
|
+
"idle",
|
|
29588
|
+
"cleaning",
|
|
29589
|
+
"spot",
|
|
29590
|
+
"following",
|
|
29591
|
+
"goto",
|
|
29592
|
+
"returning",
|
|
29593
|
+
"paused",
|
|
29594
|
+
"unknown"
|
|
29595
|
+
]),
|
|
29596
|
+
following: boolean(),
|
|
29597
|
+
flash: boolean(),
|
|
29598
|
+
lightMode: NavigationLightModeSchema,
|
|
29599
|
+
lightLevel: number().min(40).max(100),
|
|
29600
|
+
/** Ms epoch when the slice was last updated. */
|
|
29601
|
+
lastChangedAt: number()
|
|
29602
|
+
});
|
|
29603
|
+
/**
|
|
29604
|
+
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
29605
|
+
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
29606
|
+
* convention.
|
|
29607
|
+
*/
|
|
29608
|
+
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
29609
|
+
var navigationCapability = {
|
|
29610
|
+
name: "navigation",
|
|
29611
|
+
scope: "device",
|
|
29612
|
+
deviceNative: true,
|
|
29613
|
+
mode: "singleton",
|
|
29614
|
+
deviceTypes: [DeviceType.Camera],
|
|
29615
|
+
deviceConfig: { ui: {
|
|
29616
|
+
kind: "widget",
|
|
29617
|
+
widgetId: "host/navigation-panel",
|
|
29618
|
+
tab: "navigation",
|
|
29619
|
+
topTab: true,
|
|
29620
|
+
label: "Navigation",
|
|
29621
|
+
order: 0
|
|
29622
|
+
} },
|
|
29623
|
+
methods: {
|
|
29624
|
+
/**
|
|
29625
|
+
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
29626
|
+
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
29627
|
+
* path) works for any authenticated user, not admin-only. The UI sends
|
|
29628
|
+
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
29629
|
+
* a single drive write WITHOUT debouncing.
|
|
29630
|
+
*/
|
|
29631
|
+
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29632
|
+
/** Halt all motion immediately (zero drive vector). */
|
|
29633
|
+
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29634
|
+
/** Send the robot to a point on its live map. */
|
|
29635
|
+
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29636
|
+
/**
|
|
29637
|
+
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
29638
|
+
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
29639
|
+
*/
|
|
29640
|
+
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
29641
|
+
/**
|
|
29642
|
+
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
29643
|
+
* unsupported action ids are rejected by the provider.
|
|
29644
|
+
*/
|
|
29645
|
+
runAction: method(object({
|
|
29646
|
+
deviceId: number(),
|
|
29647
|
+
actionId: NavigationActionIdSchema
|
|
29648
|
+
}), _void(), { kind: "mutation" }),
|
|
29649
|
+
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
29650
|
+
playSound: method(object({
|
|
29651
|
+
deviceId: number(),
|
|
29652
|
+
soundId: number().int()
|
|
29653
|
+
}), _void(), { kind: "mutation" }),
|
|
29654
|
+
/**
|
|
29655
|
+
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
29656
|
+
* works anytime, no active stream required).
|
|
29657
|
+
*/
|
|
29658
|
+
setLightOn: method(object({
|
|
29659
|
+
deviceId: number(),
|
|
29660
|
+
on: boolean()
|
|
29661
|
+
}), _void(), { kind: "mutation" }),
|
|
29662
|
+
/**
|
|
29663
|
+
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
29664
|
+
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
29665
|
+
* action that generally needs an active camera stream/monitor session — the
|
|
29666
|
+
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
29667
|
+
*/
|
|
29668
|
+
setLightMode: method(object({
|
|
29669
|
+
deviceId: number(),
|
|
29670
|
+
mode: NavigationLightModeSchema,
|
|
29671
|
+
level: number().min(40).max(100).optional()
|
|
29672
|
+
}), _void(), { kind: "mutation" }),
|
|
29673
|
+
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
29674
|
+
setLightLevel: method(object({
|
|
29675
|
+
deviceId: number(),
|
|
29676
|
+
level: number().min(40).max(100)
|
|
29677
|
+
}), _void(), { kind: "mutation" }),
|
|
29678
|
+
/**
|
|
29679
|
+
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
29680
|
+
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
29681
|
+
* `listActions`).
|
|
29682
|
+
*/
|
|
29683
|
+
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
29684
|
+
},
|
|
29685
|
+
events: { onStatusChanged: { data: object({
|
|
29686
|
+
deviceId: number(),
|
|
29687
|
+
status: NavigationStatusSchema
|
|
29688
|
+
}) } },
|
|
29689
|
+
status: {
|
|
29690
|
+
schema: NavigationStatusSchema,
|
|
29691
|
+
kind: "push"
|
|
29692
|
+
},
|
|
29693
|
+
/**
|
|
29694
|
+
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
29695
|
+
* for live mode / follow / flash changes.
|
|
29696
|
+
*/
|
|
29697
|
+
runtimeState: NavigationRuntimeStateSchema,
|
|
29698
|
+
/**
|
|
29699
|
+
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
29700
|
+
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
29701
|
+
* that. The live handle re-publishes on connect.
|
|
29702
|
+
*
|
|
29703
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
29704
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
29705
|
+
*/
|
|
29706
|
+
durability: "session"
|
|
29707
|
+
};
|
|
29338
29708
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
29339
29709
|
kind: "mutation",
|
|
29340
29710
|
auth: "admin"
|
|
@@ -32610,6 +32980,8 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32610
32980
|
motionTrigger: motionTriggerCapability,
|
|
32611
32981
|
motionZones: motionZonesCapability,
|
|
32612
32982
|
nativeObjectDetection: nativeObjectDetectionCapability,
|
|
32983
|
+
navigation: navigationCapability,
|
|
32984
|
+
networkLink: networkLinkCapability,
|
|
32613
32985
|
notifier: notifierCapability,
|
|
32614
32986
|
numericSensor: numericSensorCapability,
|
|
32615
32987
|
petFeeder: petFeederCapability,
|
|
@@ -36463,6 +36835,66 @@ Object.freeze({
|
|
|
36463
36835
|
addonId: null,
|
|
36464
36836
|
access: "create"
|
|
36465
36837
|
},
|
|
36838
|
+
"navigation.getFeatures": {
|
|
36839
|
+
capName: "navigation",
|
|
36840
|
+
capScope: "device",
|
|
36841
|
+
addonId: null,
|
|
36842
|
+
access: "view"
|
|
36843
|
+
},
|
|
36844
|
+
"navigation.goToPoint": {
|
|
36845
|
+
capName: "navigation",
|
|
36846
|
+
capScope: "device",
|
|
36847
|
+
addonId: null,
|
|
36848
|
+
access: "create"
|
|
36849
|
+
},
|
|
36850
|
+
"navigation.listActions": {
|
|
36851
|
+
capName: "navigation",
|
|
36852
|
+
capScope: "device",
|
|
36853
|
+
addonId: null,
|
|
36854
|
+
access: "view"
|
|
36855
|
+
},
|
|
36856
|
+
"navigation.move": {
|
|
36857
|
+
capName: "navigation",
|
|
36858
|
+
capScope: "device",
|
|
36859
|
+
addonId: null,
|
|
36860
|
+
access: "create"
|
|
36861
|
+
},
|
|
36862
|
+
"navigation.playSound": {
|
|
36863
|
+
capName: "navigation",
|
|
36864
|
+
capScope: "device",
|
|
36865
|
+
addonId: null,
|
|
36866
|
+
access: "create"
|
|
36867
|
+
},
|
|
36868
|
+
"navigation.runAction": {
|
|
36869
|
+
capName: "navigation",
|
|
36870
|
+
capScope: "device",
|
|
36871
|
+
addonId: null,
|
|
36872
|
+
access: "create"
|
|
36873
|
+
},
|
|
36874
|
+
"navigation.setLightLevel": {
|
|
36875
|
+
capName: "navigation",
|
|
36876
|
+
capScope: "device",
|
|
36877
|
+
addonId: null,
|
|
36878
|
+
access: "create"
|
|
36879
|
+
},
|
|
36880
|
+
"navigation.setLightMode": {
|
|
36881
|
+
capName: "navigation",
|
|
36882
|
+
capScope: "device",
|
|
36883
|
+
addonId: null,
|
|
36884
|
+
access: "create"
|
|
36885
|
+
},
|
|
36886
|
+
"navigation.setLightOn": {
|
|
36887
|
+
capName: "navigation",
|
|
36888
|
+
capScope: "device",
|
|
36889
|
+
addonId: null,
|
|
36890
|
+
access: "create"
|
|
36891
|
+
},
|
|
36892
|
+
"navigation.stop": {
|
|
36893
|
+
capName: "navigation",
|
|
36894
|
+
capScope: "device",
|
|
36895
|
+
addonId: null,
|
|
36896
|
+
access: "create"
|
|
36897
|
+
},
|
|
36466
36898
|
"networkAccess.getEndpoint": {
|
|
36467
36899
|
capName: "network-access",
|
|
36468
36900
|
capScope: "system",
|
|
@@ -40558,6 +40990,56 @@ Object.freeze({
|
|
|
40558
40990
|
form: "single",
|
|
40559
40991
|
optional: false
|
|
40560
40992
|
}],
|
|
40993
|
+
"navigation.getFeatures": [{
|
|
40994
|
+
name: "deviceId",
|
|
40995
|
+
form: "single",
|
|
40996
|
+
optional: false
|
|
40997
|
+
}],
|
|
40998
|
+
"navigation.goToPoint": [{
|
|
40999
|
+
name: "deviceId",
|
|
41000
|
+
form: "single",
|
|
41001
|
+
optional: false
|
|
41002
|
+
}],
|
|
41003
|
+
"navigation.listActions": [{
|
|
41004
|
+
name: "deviceId",
|
|
41005
|
+
form: "single",
|
|
41006
|
+
optional: false
|
|
41007
|
+
}],
|
|
41008
|
+
"navigation.move": [{
|
|
41009
|
+
name: "deviceId",
|
|
41010
|
+
form: "single",
|
|
41011
|
+
optional: false
|
|
41012
|
+
}],
|
|
41013
|
+
"navigation.playSound": [{
|
|
41014
|
+
name: "deviceId",
|
|
41015
|
+
form: "single",
|
|
41016
|
+
optional: false
|
|
41017
|
+
}],
|
|
41018
|
+
"navigation.runAction": [{
|
|
41019
|
+
name: "deviceId",
|
|
41020
|
+
form: "single",
|
|
41021
|
+
optional: false
|
|
41022
|
+
}],
|
|
41023
|
+
"navigation.setLightLevel": [{
|
|
41024
|
+
name: "deviceId",
|
|
41025
|
+
form: "single",
|
|
41026
|
+
optional: false
|
|
41027
|
+
}],
|
|
41028
|
+
"navigation.setLightMode": [{
|
|
41029
|
+
name: "deviceId",
|
|
41030
|
+
form: "single",
|
|
41031
|
+
optional: false
|
|
41032
|
+
}],
|
|
41033
|
+
"navigation.setLightOn": [{
|
|
41034
|
+
name: "deviceId",
|
|
41035
|
+
form: "single",
|
|
41036
|
+
optional: false
|
|
41037
|
+
}],
|
|
41038
|
+
"navigation.stop": [{
|
|
41039
|
+
name: "deviceId",
|
|
41040
|
+
form: "single",
|
|
41041
|
+
optional: false
|
|
41042
|
+
}],
|
|
40561
41043
|
"networkQuality.getDeviceStats": [{
|
|
40562
41044
|
name: "deviceId",
|
|
40563
41045
|
form: "single",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../types/dist/event-category-
|
|
1
|
+
//#region ../types/dist/event-category-zAv7pMUz.mjs
|
|
2
2
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
3
3
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4
4
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -370,6 +370,13 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
370
370
|
*/
|
|
371
371
|
EventCategory["BatteryOnStatusChanged"] = "battery.onStatusChanged";
|
|
372
372
|
/**
|
|
373
|
+
* Cap event fired by every device that registers the `network-link`
|
|
374
|
+
* capability. Mirrors the cap definition's `onStatusChanged`. Carries
|
|
375
|
+
* `{ deviceId, status: NetworkLinkStatus }` — a link switch or a signal
|
|
376
|
+
* reading that moved.
|
|
377
|
+
*/
|
|
378
|
+
EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
|
|
379
|
+
/**
|
|
373
380
|
* Emitted by the battery cap provider WHEN `wakeForStream` enters the
|
|
374
381
|
* "wake in progress" window — between the Baichuan wake-up issue and
|
|
375
382
|
* the camera's first dialed-back RTP packet. The stream-broker
|
|
@@ -24209,6 +24216,88 @@ onStatusChanged: { data: object({
|
|
|
24209
24216
|
volatileStateFields: ["lastUpdated"]
|
|
24210
24217
|
};
|
|
24211
24218
|
/**
|
|
24219
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
24220
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
24221
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
24222
|
+
* one Home Assistant projection.
|
|
24223
|
+
*/
|
|
24224
|
+
var NetworkLinkStatusSchema = object({
|
|
24225
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
24226
|
+
type: _enum([
|
|
24227
|
+
"wifi",
|
|
24228
|
+
"ethernet",
|
|
24229
|
+
"cellular",
|
|
24230
|
+
"unknown"
|
|
24231
|
+
]),
|
|
24232
|
+
/**
|
|
24233
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
24234
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
24235
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
24236
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
24237
|
+
* SKIP a null rather than coerce it.
|
|
24238
|
+
*/
|
|
24239
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
24240
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
24241
|
+
rssiDbm: number().optional(),
|
|
24242
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
24243
|
+
ssid: string().optional(),
|
|
24244
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
24245
|
+
lastUpdated: number()
|
|
24246
|
+
});
|
|
24247
|
+
var networkLinkCapability = {
|
|
24248
|
+
name: "network-link",
|
|
24249
|
+
scope: "device",
|
|
24250
|
+
deviceNative: true,
|
|
24251
|
+
mode: "singleton",
|
|
24252
|
+
deviceTypes: [
|
|
24253
|
+
DeviceType.Camera,
|
|
24254
|
+
DeviceType.Sensor,
|
|
24255
|
+
DeviceType.Button,
|
|
24256
|
+
DeviceType.Switch,
|
|
24257
|
+
DeviceType.Light,
|
|
24258
|
+
DeviceType.Lock,
|
|
24259
|
+
DeviceType.Siren
|
|
24260
|
+
],
|
|
24261
|
+
methods: {},
|
|
24262
|
+
events: {
|
|
24263
|
+
/**
|
|
24264
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
24265
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
24266
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
24267
|
+
*/
|
|
24268
|
+
onStatusChanged: { data: object({
|
|
24269
|
+
deviceId: number(),
|
|
24270
|
+
status: NetworkLinkStatusSchema
|
|
24271
|
+
}) } },
|
|
24272
|
+
status: {
|
|
24273
|
+
schema: NetworkLinkStatusSchema,
|
|
24274
|
+
kind: "push",
|
|
24275
|
+
empty: {
|
|
24276
|
+
type: "unknown",
|
|
24277
|
+
signalPercent: null,
|
|
24278
|
+
lastUpdated: 0
|
|
24279
|
+
}
|
|
24280
|
+
},
|
|
24281
|
+
/**
|
|
24282
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
24283
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
24284
|
+
* Home Assistant projector regardless of the driver.
|
|
24285
|
+
*/
|
|
24286
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
24287
|
+
/**
|
|
24288
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
24289
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
24290
|
+
* restored slice is what the badge shows until the next read.
|
|
24291
|
+
*
|
|
24292
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
24293
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
24294
|
+
*/
|
|
24295
|
+
durability: "restored",
|
|
24296
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
24297
|
+
* whether persisting is worth a SQLite commit. */
|
|
24298
|
+
volatileStateFields: ["lastUpdated"]
|
|
24299
|
+
};
|
|
24300
|
+
/**
|
|
24212
24301
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
24213
24302
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
24214
24303
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -29335,6 +29424,287 @@ var ptzAutotrackCapability = {
|
|
|
29335
29424
|
*/
|
|
29336
29425
|
durability: "session"
|
|
29337
29426
|
};
|
|
29427
|
+
/**
|
|
29428
|
+
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
29429
|
+
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
29430
|
+
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
29431
|
+
*
|
|
29432
|
+
* Why a NEW cap rather than overloading `ptz`:
|
|
29433
|
+
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
29434
|
+
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
29435
|
+
* The two are different physical models: PTZ is absolute-position + presets,
|
|
29436
|
+
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
29437
|
+
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
29438
|
+
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
29439
|
+
* the reverse:
|
|
29440
|
+
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
29441
|
+
* / `getOptions`), and
|
|
29442
|
+
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
29443
|
+
* robot camera shows up in the existing PTZ control path without every
|
|
29444
|
+
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
29445
|
+
* not here (see the addon design note):
|
|
29446
|
+
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
29447
|
+
* ptz.stop() → navigation.stop()
|
|
29448
|
+
* ptz.goHome() → navigation.runAction('goHome')
|
|
29449
|
+
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
29450
|
+
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
29451
|
+
*
|
|
29452
|
+
* ## Continuous drive
|
|
29453
|
+
*
|
|
29454
|
+
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
29455
|
+
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
29456
|
+
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
29457
|
+
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
29458
|
+
* coalesce them. The UI owns the cadence.
|
|
29459
|
+
*
|
|
29460
|
+
* ## The action dictionary
|
|
29461
|
+
*
|
|
29462
|
+
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
29463
|
+
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
29464
|
+
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
29465
|
+
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
29466
|
+
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
29467
|
+
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
29468
|
+
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
29469
|
+
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
29470
|
+
*
|
|
29471
|
+
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
29472
|
+
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
29473
|
+
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
29474
|
+
* every device handle. A future nodedreame publish adds a typed
|
|
29475
|
+
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
29476
|
+
* provider can then swap the raw calls for the typed methods with no change to
|
|
29477
|
+
* THIS contract.
|
|
29478
|
+
*/
|
|
29479
|
+
/**
|
|
29480
|
+
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
29481
|
+
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
29482
|
+
* halts it.
|
|
29483
|
+
*
|
|
29484
|
+
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
29485
|
+
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
29486
|
+
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
29487
|
+
* vector by it (drivers without proportional drive ignore it).
|
|
29488
|
+
*
|
|
29489
|
+
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
29490
|
+
* axis alone; an all-undefined nudge is a no-op.
|
|
29491
|
+
*/
|
|
29492
|
+
var NavigationMoveCommandSchema = object({
|
|
29493
|
+
pan: number().min(-1).max(1).optional(),
|
|
29494
|
+
tilt: number().min(-1).max(1).optional(),
|
|
29495
|
+
speed: number().min(0).max(1).optional()
|
|
29496
|
+
});
|
|
29497
|
+
/**
|
|
29498
|
+
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
29499
|
+
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
29500
|
+
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
29501
|
+
* `playSound` (see the `sound` dictionary entries).
|
|
29502
|
+
*/
|
|
29503
|
+
var NavigationActionIdSchema = _enum([
|
|
29504
|
+
"goHome",
|
|
29505
|
+
"locate",
|
|
29506
|
+
"spotClean",
|
|
29507
|
+
"findPet",
|
|
29508
|
+
"personFollow",
|
|
29509
|
+
"stop",
|
|
29510
|
+
"startClean",
|
|
29511
|
+
"pauseClean",
|
|
29512
|
+
"dockWash",
|
|
29513
|
+
"autoEmpty",
|
|
29514
|
+
"flashOn",
|
|
29515
|
+
"flashOff"
|
|
29516
|
+
]);
|
|
29517
|
+
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
29518
|
+
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
29519
|
+
/**
|
|
29520
|
+
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
29521
|
+
* native panel and the PTZ mimic render as a button.
|
|
29522
|
+
*
|
|
29523
|
+
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
29524
|
+
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
29525
|
+
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
29526
|
+
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
29527
|
+
* - `label` — operator-facing English label.
|
|
29528
|
+
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
29529
|
+
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
29530
|
+
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
29531
|
+
* flips it from config, never by editing code.
|
|
29532
|
+
*/
|
|
29533
|
+
var NavigationActionEntrySchema = object({
|
|
29534
|
+
id: string(),
|
|
29535
|
+
kind: NavigationEntryKindSchema,
|
|
29536
|
+
label: string(),
|
|
29537
|
+
icon: string(),
|
|
29538
|
+
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
29539
|
+
soundId: number().int().optional(),
|
|
29540
|
+
/** Per-device feature flag — render this entry only when true. */
|
|
29541
|
+
enabled: boolean()
|
|
29542
|
+
});
|
|
29543
|
+
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
29544
|
+
var NavigationPointSchema = object({
|
|
29545
|
+
x: number(),
|
|
29546
|
+
y: number()
|
|
29547
|
+
});
|
|
29548
|
+
/**
|
|
29549
|
+
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
29550
|
+
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
29551
|
+
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
29552
|
+
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
29553
|
+
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
29554
|
+
* that are not dictionary entries.
|
|
29555
|
+
*
|
|
29556
|
+
* - `move` / `stop` — the momentary drive joystick.
|
|
29557
|
+
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
29558
|
+
* map-coordinate plumbing is wired.
|
|
29559
|
+
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
29560
|
+
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
29561
|
+
* - `light` — the on/off fill-light toggle (works anytime).
|
|
29562
|
+
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
29563
|
+
* camera-service control; needs an active stream).
|
|
29564
|
+
*/
|
|
29565
|
+
var NavigationFeaturesSchema = object({
|
|
29566
|
+
move: boolean(),
|
|
29567
|
+
stop: boolean(),
|
|
29568
|
+
goToPoint: boolean(),
|
|
29569
|
+
runAction: boolean(),
|
|
29570
|
+
playSound: boolean(),
|
|
29571
|
+
light: boolean(),
|
|
29572
|
+
lightMode: boolean()
|
|
29573
|
+
});
|
|
29574
|
+
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
29575
|
+
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
29576
|
+
/**
|
|
29577
|
+
* Live navigation state so the UI can reflect what the robot is doing:
|
|
29578
|
+
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
29579
|
+
* - `following` — person/pet follow is currently armed.
|
|
29580
|
+
* - `flash` — the on-camera fill light is on.
|
|
29581
|
+
* - `lightMode` — auto vs manual fill-light mode.
|
|
29582
|
+
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
29583
|
+
* `lightMode === 'manual'`.
|
|
29584
|
+
*/
|
|
29585
|
+
var NavigationStatusSchema = object({
|
|
29586
|
+
mode: _enum([
|
|
29587
|
+
"idle",
|
|
29588
|
+
"cleaning",
|
|
29589
|
+
"spot",
|
|
29590
|
+
"following",
|
|
29591
|
+
"goto",
|
|
29592
|
+
"returning",
|
|
29593
|
+
"paused",
|
|
29594
|
+
"unknown"
|
|
29595
|
+
]),
|
|
29596
|
+
following: boolean(),
|
|
29597
|
+
flash: boolean(),
|
|
29598
|
+
lightMode: NavigationLightModeSchema,
|
|
29599
|
+
lightLevel: number().min(40).max(100),
|
|
29600
|
+
/** Ms epoch when the slice was last updated. */
|
|
29601
|
+
lastChangedAt: number()
|
|
29602
|
+
});
|
|
29603
|
+
/**
|
|
29604
|
+
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
29605
|
+
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
29606
|
+
* convention.
|
|
29607
|
+
*/
|
|
29608
|
+
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
29609
|
+
var navigationCapability = {
|
|
29610
|
+
name: "navigation",
|
|
29611
|
+
scope: "device",
|
|
29612
|
+
deviceNative: true,
|
|
29613
|
+
mode: "singleton",
|
|
29614
|
+
deviceTypes: [DeviceType.Camera],
|
|
29615
|
+
deviceConfig: { ui: {
|
|
29616
|
+
kind: "widget",
|
|
29617
|
+
widgetId: "host/navigation-panel",
|
|
29618
|
+
tab: "navigation",
|
|
29619
|
+
topTab: true,
|
|
29620
|
+
label: "Navigation",
|
|
29621
|
+
order: 0
|
|
29622
|
+
} },
|
|
29623
|
+
methods: {
|
|
29624
|
+
/**
|
|
29625
|
+
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
29626
|
+
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
29627
|
+
* path) works for any authenticated user, not admin-only. The UI sends
|
|
29628
|
+
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
29629
|
+
* a single drive write WITHOUT debouncing.
|
|
29630
|
+
*/
|
|
29631
|
+
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29632
|
+
/** Halt all motion immediately (zero drive vector). */
|
|
29633
|
+
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29634
|
+
/** Send the robot to a point on its live map. */
|
|
29635
|
+
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29636
|
+
/**
|
|
29637
|
+
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
29638
|
+
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
29639
|
+
*/
|
|
29640
|
+
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
29641
|
+
/**
|
|
29642
|
+
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
29643
|
+
* unsupported action ids are rejected by the provider.
|
|
29644
|
+
*/
|
|
29645
|
+
runAction: method(object({
|
|
29646
|
+
deviceId: number(),
|
|
29647
|
+
actionId: NavigationActionIdSchema
|
|
29648
|
+
}), _void(), { kind: "mutation" }),
|
|
29649
|
+
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
29650
|
+
playSound: method(object({
|
|
29651
|
+
deviceId: number(),
|
|
29652
|
+
soundId: number().int()
|
|
29653
|
+
}), _void(), { kind: "mutation" }),
|
|
29654
|
+
/**
|
|
29655
|
+
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
29656
|
+
* works anytime, no active stream required).
|
|
29657
|
+
*/
|
|
29658
|
+
setLightOn: method(object({
|
|
29659
|
+
deviceId: number(),
|
|
29660
|
+
on: boolean()
|
|
29661
|
+
}), _void(), { kind: "mutation" }),
|
|
29662
|
+
/**
|
|
29663
|
+
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
29664
|
+
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
29665
|
+
* action that generally needs an active camera stream/monitor session — the
|
|
29666
|
+
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
29667
|
+
*/
|
|
29668
|
+
setLightMode: method(object({
|
|
29669
|
+
deviceId: number(),
|
|
29670
|
+
mode: NavigationLightModeSchema,
|
|
29671
|
+
level: number().min(40).max(100).optional()
|
|
29672
|
+
}), _void(), { kind: "mutation" }),
|
|
29673
|
+
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
29674
|
+
setLightLevel: method(object({
|
|
29675
|
+
deviceId: number(),
|
|
29676
|
+
level: number().min(40).max(100)
|
|
29677
|
+
}), _void(), { kind: "mutation" }),
|
|
29678
|
+
/**
|
|
29679
|
+
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
29680
|
+
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
29681
|
+
* `listActions`).
|
|
29682
|
+
*/
|
|
29683
|
+
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
29684
|
+
},
|
|
29685
|
+
events: { onStatusChanged: { data: object({
|
|
29686
|
+
deviceId: number(),
|
|
29687
|
+
status: NavigationStatusSchema
|
|
29688
|
+
}) } },
|
|
29689
|
+
status: {
|
|
29690
|
+
schema: NavigationStatusSchema,
|
|
29691
|
+
kind: "push"
|
|
29692
|
+
},
|
|
29693
|
+
/**
|
|
29694
|
+
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
29695
|
+
* for live mode / follow / flash changes.
|
|
29696
|
+
*/
|
|
29697
|
+
runtimeState: NavigationRuntimeStateSchema,
|
|
29698
|
+
/**
|
|
29699
|
+
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
29700
|
+
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
29701
|
+
* that. The live handle re-publishes on connect.
|
|
29702
|
+
*
|
|
29703
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
29704
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
29705
|
+
*/
|
|
29706
|
+
durability: "session"
|
|
29707
|
+
};
|
|
29338
29708
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
29339
29709
|
kind: "mutation",
|
|
29340
29710
|
auth: "admin"
|
|
@@ -32610,6 +32980,8 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
32610
32980
|
motionTrigger: motionTriggerCapability,
|
|
32611
32981
|
motionZones: motionZonesCapability,
|
|
32612
32982
|
nativeObjectDetection: nativeObjectDetectionCapability,
|
|
32983
|
+
navigation: navigationCapability,
|
|
32984
|
+
networkLink: networkLinkCapability,
|
|
32613
32985
|
notifier: notifierCapability,
|
|
32614
32986
|
numericSensor: numericSensorCapability,
|
|
32615
32987
|
petFeeder: petFeederCapability,
|
|
@@ -36463,6 +36835,66 @@ Object.freeze({
|
|
|
36463
36835
|
addonId: null,
|
|
36464
36836
|
access: "create"
|
|
36465
36837
|
},
|
|
36838
|
+
"navigation.getFeatures": {
|
|
36839
|
+
capName: "navigation",
|
|
36840
|
+
capScope: "device",
|
|
36841
|
+
addonId: null,
|
|
36842
|
+
access: "view"
|
|
36843
|
+
},
|
|
36844
|
+
"navigation.goToPoint": {
|
|
36845
|
+
capName: "navigation",
|
|
36846
|
+
capScope: "device",
|
|
36847
|
+
addonId: null,
|
|
36848
|
+
access: "create"
|
|
36849
|
+
},
|
|
36850
|
+
"navigation.listActions": {
|
|
36851
|
+
capName: "navigation",
|
|
36852
|
+
capScope: "device",
|
|
36853
|
+
addonId: null,
|
|
36854
|
+
access: "view"
|
|
36855
|
+
},
|
|
36856
|
+
"navigation.move": {
|
|
36857
|
+
capName: "navigation",
|
|
36858
|
+
capScope: "device",
|
|
36859
|
+
addonId: null,
|
|
36860
|
+
access: "create"
|
|
36861
|
+
},
|
|
36862
|
+
"navigation.playSound": {
|
|
36863
|
+
capName: "navigation",
|
|
36864
|
+
capScope: "device",
|
|
36865
|
+
addonId: null,
|
|
36866
|
+
access: "create"
|
|
36867
|
+
},
|
|
36868
|
+
"navigation.runAction": {
|
|
36869
|
+
capName: "navigation",
|
|
36870
|
+
capScope: "device",
|
|
36871
|
+
addonId: null,
|
|
36872
|
+
access: "create"
|
|
36873
|
+
},
|
|
36874
|
+
"navigation.setLightLevel": {
|
|
36875
|
+
capName: "navigation",
|
|
36876
|
+
capScope: "device",
|
|
36877
|
+
addonId: null,
|
|
36878
|
+
access: "create"
|
|
36879
|
+
},
|
|
36880
|
+
"navigation.setLightMode": {
|
|
36881
|
+
capName: "navigation",
|
|
36882
|
+
capScope: "device",
|
|
36883
|
+
addonId: null,
|
|
36884
|
+
access: "create"
|
|
36885
|
+
},
|
|
36886
|
+
"navigation.setLightOn": {
|
|
36887
|
+
capName: "navigation",
|
|
36888
|
+
capScope: "device",
|
|
36889
|
+
addonId: null,
|
|
36890
|
+
access: "create"
|
|
36891
|
+
},
|
|
36892
|
+
"navigation.stop": {
|
|
36893
|
+
capName: "navigation",
|
|
36894
|
+
capScope: "device",
|
|
36895
|
+
addonId: null,
|
|
36896
|
+
access: "create"
|
|
36897
|
+
},
|
|
36466
36898
|
"networkAccess.getEndpoint": {
|
|
36467
36899
|
capName: "network-access",
|
|
36468
36900
|
capScope: "system",
|
|
@@ -40558,6 +40990,56 @@ Object.freeze({
|
|
|
40558
40990
|
form: "single",
|
|
40559
40991
|
optional: false
|
|
40560
40992
|
}],
|
|
40993
|
+
"navigation.getFeatures": [{
|
|
40994
|
+
name: "deviceId",
|
|
40995
|
+
form: "single",
|
|
40996
|
+
optional: false
|
|
40997
|
+
}],
|
|
40998
|
+
"navigation.goToPoint": [{
|
|
40999
|
+
name: "deviceId",
|
|
41000
|
+
form: "single",
|
|
41001
|
+
optional: false
|
|
41002
|
+
}],
|
|
41003
|
+
"navigation.listActions": [{
|
|
41004
|
+
name: "deviceId",
|
|
41005
|
+
form: "single",
|
|
41006
|
+
optional: false
|
|
41007
|
+
}],
|
|
41008
|
+
"navigation.move": [{
|
|
41009
|
+
name: "deviceId",
|
|
41010
|
+
form: "single",
|
|
41011
|
+
optional: false
|
|
41012
|
+
}],
|
|
41013
|
+
"navigation.playSound": [{
|
|
41014
|
+
name: "deviceId",
|
|
41015
|
+
form: "single",
|
|
41016
|
+
optional: false
|
|
41017
|
+
}],
|
|
41018
|
+
"navigation.runAction": [{
|
|
41019
|
+
name: "deviceId",
|
|
41020
|
+
form: "single",
|
|
41021
|
+
optional: false
|
|
41022
|
+
}],
|
|
41023
|
+
"navigation.setLightLevel": [{
|
|
41024
|
+
name: "deviceId",
|
|
41025
|
+
form: "single",
|
|
41026
|
+
optional: false
|
|
41027
|
+
}],
|
|
41028
|
+
"navigation.setLightMode": [{
|
|
41029
|
+
name: "deviceId",
|
|
41030
|
+
form: "single",
|
|
41031
|
+
optional: false
|
|
41032
|
+
}],
|
|
41033
|
+
"navigation.setLightOn": [{
|
|
41034
|
+
name: "deviceId",
|
|
41035
|
+
form: "single",
|
|
41036
|
+
optional: false
|
|
41037
|
+
}],
|
|
41038
|
+
"navigation.stop": [{
|
|
41039
|
+
name: "deviceId",
|
|
41040
|
+
form: "single",
|
|
41041
|
+
optional: false
|
|
41042
|
+
}],
|
|
40561
41043
|
"networkQuality.getDeviceStats": [{
|
|
40562
41044
|
name: "deviceId",
|
|
40563
41045
|
form: "single",
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#endregion
|
|
6
|
-
const require_dist = require("../dist-
|
|
6
|
+
const require_dist = require("../dist-BmfTJtD2.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
//#region src/ha-export/topics.ts
|
|
9
9
|
/**
|
|
@@ -1333,6 +1333,22 @@ function cameraSpecs(device) {
|
|
|
1333
1333
|
enabledByDefault: true
|
|
1334
1334
|
}
|
|
1335
1335
|
];
|
|
1336
|
+
if (device.slices.includes("network-link")) specs.push({
|
|
1337
|
+
entity: "link",
|
|
1338
|
+
platform: "sensor",
|
|
1339
|
+
label: "Network link",
|
|
1340
|
+
icon: "mdi:lan-connect",
|
|
1341
|
+
entityCategory: "diagnostic",
|
|
1342
|
+
enabledByDefault: true
|
|
1343
|
+
}, {
|
|
1344
|
+
entity: "signal",
|
|
1345
|
+
platform: "sensor",
|
|
1346
|
+
label: "Signal",
|
|
1347
|
+
icon: "mdi:wifi",
|
|
1348
|
+
unit: "%",
|
|
1349
|
+
entityCategory: "diagnostic",
|
|
1350
|
+
enabledByDefault: true
|
|
1351
|
+
});
|
|
1336
1352
|
if (device.slices.includes("battery")) specs.push({
|
|
1337
1353
|
entity: "battery",
|
|
1338
1354
|
platform: "sensor",
|
|
@@ -4982,6 +4998,25 @@ function projectBatterySlice(deviceKey, slice) {
|
|
|
4982
4998
|
return values;
|
|
4983
4999
|
}
|
|
4984
5000
|
/**
|
|
5001
|
+
* The device's own link: which medium it is on and, for a wireless one, how
|
|
5002
|
+
* strong. An `unknown` type publishes nothing — it is the absence of a read,
|
|
5003
|
+
* and a wire drawn from it would be a lie the same way a 0 % battery was. A
|
|
5004
|
+
* `null` signal publishes no signal entity value: wired links have none, and
|
|
5005
|
+
* a wireless one not yet read must not sit at 0 %.
|
|
5006
|
+
*/
|
|
5007
|
+
function projectNetworkLinkSlice(deviceKey, slice) {
|
|
5008
|
+
if (slice.type === "unknown") return [];
|
|
5009
|
+
const values = [{
|
|
5010
|
+
topic: stateTopic(deviceKey, "link"),
|
|
5011
|
+
value: slice.type
|
|
5012
|
+
}];
|
|
5013
|
+
if (slice.signalPercent !== null) values.push({
|
|
5014
|
+
topic: stateTopic(deviceKey, "signal"),
|
|
5015
|
+
value: String(Math.round(slice.signalPercent))
|
|
5016
|
+
});
|
|
5017
|
+
return values;
|
|
5018
|
+
}
|
|
5019
|
+
/**
|
|
4985
5020
|
* The per-camera function switches, mirrored 1:1 from
|
|
4986
5021
|
* `deriveCameraFunctions` (`camera-functions.ts`) — the pure derivation over
|
|
4987
5022
|
* the AUTHORITIES that own each function, replacing the deprecated
|
|
@@ -6037,6 +6072,16 @@ var HaExportAddon = class extends require_dist.BaseAddon {
|
|
|
6037
6072
|
if (typeof online === "boolean") this.push(deviceId, projectDeviceStatus(deviceKey, online));
|
|
6038
6073
|
return;
|
|
6039
6074
|
}
|
|
6075
|
+
if (capName === "network-link") {
|
|
6076
|
+
const type = readString(slice, "type");
|
|
6077
|
+
if (type === null) return;
|
|
6078
|
+
const signalPercent = readNumber(slice, "signalPercent");
|
|
6079
|
+
this.push(deviceId, projectNetworkLinkSlice(deviceKey, {
|
|
6080
|
+
type,
|
|
6081
|
+
signalPercent
|
|
6082
|
+
}));
|
|
6083
|
+
return;
|
|
6084
|
+
}
|
|
6040
6085
|
if (capName === "battery") {
|
|
6041
6086
|
const percentage = readNumber(slice, "percentage");
|
|
6042
6087
|
const charging = readString(slice, "charging");
|
|
@@ -6800,6 +6845,14 @@ var HaExportAddon = class extends require_dist.BaseAddon {
|
|
|
6800
6845
|
const snapshot = toSnapshot(snapshotRaw);
|
|
6801
6846
|
const online = snapshot["device-status"]?.["online"];
|
|
6802
6847
|
if (typeof online === "boolean") values.push(...projectDeviceStatus(key, online));
|
|
6848
|
+
const link = snapshot["network-link"];
|
|
6849
|
+
if (link !== void 0) {
|
|
6850
|
+
const type = readString(link, "type");
|
|
6851
|
+
if (type !== null) values.push(...projectNetworkLinkSlice(key, {
|
|
6852
|
+
type,
|
|
6853
|
+
signalPercent: readNumber(link, "signalPercent")
|
|
6854
|
+
}));
|
|
6855
|
+
}
|
|
6803
6856
|
const battery = snapshot["battery"];
|
|
6804
6857
|
if (battery !== void 0) {
|
|
6805
6858
|
const percentage = readNumber(battery, "percentage");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-
|
|
1
|
+
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-G7mZomBW.mjs";
|
|
2
2
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
3
|
//#region src/ha-export/topics.ts
|
|
4
4
|
/**
|
|
@@ -1328,6 +1328,22 @@ function cameraSpecs(device) {
|
|
|
1328
1328
|
enabledByDefault: true
|
|
1329
1329
|
}
|
|
1330
1330
|
];
|
|
1331
|
+
if (device.slices.includes("network-link")) specs.push({
|
|
1332
|
+
entity: "link",
|
|
1333
|
+
platform: "sensor",
|
|
1334
|
+
label: "Network link",
|
|
1335
|
+
icon: "mdi:lan-connect",
|
|
1336
|
+
entityCategory: "diagnostic",
|
|
1337
|
+
enabledByDefault: true
|
|
1338
|
+
}, {
|
|
1339
|
+
entity: "signal",
|
|
1340
|
+
platform: "sensor",
|
|
1341
|
+
label: "Signal",
|
|
1342
|
+
icon: "mdi:wifi",
|
|
1343
|
+
unit: "%",
|
|
1344
|
+
entityCategory: "diagnostic",
|
|
1345
|
+
enabledByDefault: true
|
|
1346
|
+
});
|
|
1331
1347
|
if (device.slices.includes("battery")) specs.push({
|
|
1332
1348
|
entity: "battery",
|
|
1333
1349
|
platform: "sensor",
|
|
@@ -4977,6 +4993,25 @@ function projectBatterySlice(deviceKey, slice) {
|
|
|
4977
4993
|
return values;
|
|
4978
4994
|
}
|
|
4979
4995
|
/**
|
|
4996
|
+
* The device's own link: which medium it is on and, for a wireless one, how
|
|
4997
|
+
* strong. An `unknown` type publishes nothing — it is the absence of a read,
|
|
4998
|
+
* and a wire drawn from it would be a lie the same way a 0 % battery was. A
|
|
4999
|
+
* `null` signal publishes no signal entity value: wired links have none, and
|
|
5000
|
+
* a wireless one not yet read must not sit at 0 %.
|
|
5001
|
+
*/
|
|
5002
|
+
function projectNetworkLinkSlice(deviceKey, slice) {
|
|
5003
|
+
if (slice.type === "unknown") return [];
|
|
5004
|
+
const values = [{
|
|
5005
|
+
topic: stateTopic(deviceKey, "link"),
|
|
5006
|
+
value: slice.type
|
|
5007
|
+
}];
|
|
5008
|
+
if (slice.signalPercent !== null) values.push({
|
|
5009
|
+
topic: stateTopic(deviceKey, "signal"),
|
|
5010
|
+
value: String(Math.round(slice.signalPercent))
|
|
5011
|
+
});
|
|
5012
|
+
return values;
|
|
5013
|
+
}
|
|
5014
|
+
/**
|
|
4980
5015
|
* The per-camera function switches, mirrored 1:1 from
|
|
4981
5016
|
* `deriveCameraFunctions` (`camera-functions.ts`) — the pure derivation over
|
|
4982
5017
|
* the AUTHORITIES that own each function, replacing the deprecated
|
|
@@ -6032,6 +6067,16 @@ var HaExportAddon = class extends BaseAddon {
|
|
|
6032
6067
|
if (typeof online === "boolean") this.push(deviceId, projectDeviceStatus(deviceKey, online));
|
|
6033
6068
|
return;
|
|
6034
6069
|
}
|
|
6070
|
+
if (capName === "network-link") {
|
|
6071
|
+
const type = readString(slice, "type");
|
|
6072
|
+
if (type === null) return;
|
|
6073
|
+
const signalPercent = readNumber(slice, "signalPercent");
|
|
6074
|
+
this.push(deviceId, projectNetworkLinkSlice(deviceKey, {
|
|
6075
|
+
type,
|
|
6076
|
+
signalPercent
|
|
6077
|
+
}));
|
|
6078
|
+
return;
|
|
6079
|
+
}
|
|
6035
6080
|
if (capName === "battery") {
|
|
6036
6081
|
const percentage = readNumber(slice, "percentage");
|
|
6037
6082
|
const charging = readString(slice, "charging");
|
|
@@ -6795,6 +6840,14 @@ var HaExportAddon = class extends BaseAddon {
|
|
|
6795
6840
|
const snapshot = toSnapshot(snapshotRaw);
|
|
6796
6841
|
const online = snapshot["device-status"]?.["online"];
|
|
6797
6842
|
if (typeof online === "boolean") values.push(...projectDeviceStatus(key, online));
|
|
6843
|
+
const link = snapshot["network-link"];
|
|
6844
|
+
if (link !== void 0) {
|
|
6845
|
+
const type = readString(link, "type");
|
|
6846
|
+
if (type !== null) values.push(...projectNetworkLinkSlice(key, {
|
|
6847
|
+
type,
|
|
6848
|
+
signalPercent: readNumber(link, "signalPercent")
|
|
6849
|
+
}));
|
|
6850
|
+
}
|
|
6798
6851
|
const battery = snapshot["battery"];
|
|
6799
6852
|
if (battery !== void 0) {
|
|
6800
6853
|
const percentage = readNumber(battery, "percentage");
|