@camstack/addon-provider-reolink 1.2.243 → 1.2.244

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 CHANGED
@@ -100698,7 +100698,7 @@ function parseBaichuanWebhookObject(mess) {
100698
100698
  return parsed;
100699
100699
  }
100700
100700
  //#endregion
100701
- //#region ../types/dist/event-category-Hwx_JSCU.mjs
100701
+ //#region ../types/dist/event-category-CY27-fF0.mjs
100702
100702
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100703
100703
  EventCategory["SystemBoot"] = "system.boot";
100704
100704
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101198,7 +101198,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101198
101198
  */
101199
101199
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
101200
101200
  /**
101201
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
101201
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
101202
101202
  * "wake in progress" window — between the Baichuan wake-up issue and
101203
101203
  * the camera's first dialed-back RTP packet. The stream-broker
101204
101204
  * manager subscribes to flip the per-broker placeholder reason to
@@ -101530,7 +101530,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101530
101530
  return EventCategory;
101531
101531
  }({});
101532
101532
  //#endregion
101533
- //#region ../types/dist/composed-stable-id-BBL71oUQ.mjs
101533
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
101534
101534
  /**
101535
101535
  import { errMsg } from '@camstack/types'
101536
101536
  * Extract a human-readable message from an unknown error value.
@@ -101669,12 +101669,19 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101669
101669
  return DeviceType;
101670
101670
  }({});
101671
101671
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101672
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
101672
101673
  DeviceFeature["BatteryOperated"] = "battery-operated";
101674
+ /**
101675
+ * The device goes into low-power sleep and must be WOKEN before it streams
101676
+ * (the `low-power-sleep` cap, `wakeUp`). A battery reading alone is
101677
+ * not this: a battery sensor reports charge and never sleeps (#459, Q2).
101678
+ */
101679
+ DeviceFeature["Sleeps"] = "sleeps";
101673
101680
  DeviceFeature["Rebootable"] = "rebootable";
101674
101681
  /**
101675
101682
  * Device supports an on-demand re-sync of its derived spec with its
101676
- * upstream source — drives the generic Re-sync button. The owning
101677
- * provider implements the action via the `device-adoption.resync` cap.
101683
+ * upstream source — drives the generic Re-sync button. Present when the
101684
+ * device has the `resync` cap bound (#459, Q6).
101678
101685
  */
101679
101686
  DeviceFeature["Resyncable"] = "resyncable";
101680
101687
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -101758,9 +101765,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101758
101765
  DeviceFeature["FanDirection"] = "fan-direction";
101759
101766
  /** Fan exposes an oscillation toggle. */
101760
101767
  DeviceFeature["FanOscillating"] = "fan-oscillating";
101761
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
101762
- * field on the UI lock-controls panel. */
101763
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
101764
101768
  /** Lock supports a latch-release ("open door") action distinct from
101765
101769
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
101766
101770
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -101791,8 +101795,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101791
101795
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
101792
101796
  /** Media player exposes power on / off. */
101793
101797
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
101794
- /** Alarm panel requires a PIN code on arm/disarm. */
101795
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
101796
101798
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
101797
101799
  * addition to a textual location. */
101798
101800
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -101812,15 +101814,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101812
101814
  /** Automation `trigger` accepts a skipCondition flag — fires the
101813
101815
  * automation's actions while bypassing its condition block. */
101814
101816
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
101815
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
101816
- * map tile in the vacuum UI. */
101817
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
101818
101817
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
101819
101818
  * switches group. */
101820
101819
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
101821
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
101822
- * mower map tile. */
101823
- DeviceFeature["MowerHasMap"] = "mower-has-map";
101824
101820
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101825
101821
  * spots) — gates the Mow action + map selectors. */
101826
101822
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -106808,7 +106804,7 @@ var ZodIssueCode = {
106808
106804
  var ZodFirstPartyTypeKind;
106809
106805
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106810
106806
  //#endregion
106811
- //#region ../types/dist/sleep-D6Pih0Qt.mjs
106807
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
106812
106808
  /**
106813
106809
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106814
106810
  * window to float samples (D455).
@@ -118263,6 +118259,14 @@ var CAP_VOCABULARY_BY_NAME = {
118263
118259
  icon: "refresh-cw"
118264
118260
  }]
118265
118261
  },
118262
+ "resync": {
118263
+ scope: "device",
118264
+ noun: {
118265
+ en: "Re-sync",
118266
+ it: "Risincronizzazione"
118267
+ },
118268
+ notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
118269
+ },
118266
118270
  "recording": {
118267
118271
  scope: "device",
118268
118272
  noun: {
@@ -120274,7 +120278,6 @@ var CAP_VOCABULARY_BY_NAME = {
120274
120278
  en: "Battery",
120275
120279
  it: "Batteria"
120276
120280
  },
120277
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
120278
120281
  state: [
120279
120282
  {
120280
120283
  kind: "numeric",
@@ -120384,6 +120387,14 @@ var CAP_VOCABULARY_BY_NAME = {
120384
120387
  icon: "moon"
120385
120388
  }]
120386
120389
  },
120390
+ "low-power-sleep": {
120391
+ scope: "device",
120392
+ noun: {
120393
+ en: "Low-power sleep",
120394
+ it: "Sospensione a basso consumo"
120395
+ },
120396
+ notOperatorFacing: { wakeUp: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" }
120397
+ },
120387
120398
  "network-link": {
120388
120399
  scope: "device",
120389
120400
  noun: {
@@ -121289,6 +121300,7 @@ var CAP_NAMES = Object.freeze([
121289
121300
  "log-channels",
121290
121301
  "log-destination",
121291
121302
  "login-method",
121303
+ "low-power-sleep",
121292
121304
  "media-player",
121293
121305
  "mesh-network",
121294
121306
  "meter",
@@ -121342,6 +121354,7 @@ var CAP_NAMES = Object.freeze([
121342
121354
  "records",
121343
121355
  "remote",
121344
121356
  "remote-layout-components",
121357
+ "resync",
121345
121358
  "running-state",
121346
121359
  "scene-monitor",
121347
121360
  "schedulers",
@@ -121445,7 +121458,7 @@ Object.freeze({
121445
121458
  ]
121446
121459
  },
121447
121460
  {
121448
- "path": "requiresCode",
121461
+ "path": "codeRequired",
121449
121462
  "valueType": "boolean"
121450
121463
  }
121451
121464
  ],
@@ -122513,7 +122526,24 @@ Object.freeze({
122513
122526
  "jammed",
122514
122527
  "door-open"
122515
122528
  ]
122529
+ }, {
122530
+ "path": "codeRequired",
122531
+ "valueType": "boolean"
122516
122532
  }],
122533
+ "low-power-sleep": [
122534
+ {
122535
+ "path": "sleeping",
122536
+ "valueType": "boolean"
122537
+ },
122538
+ {
122539
+ "path": "lastContactAt",
122540
+ "valueType": "number"
122541
+ },
122542
+ {
122543
+ "path": "lastUpdated",
122544
+ "valueType": "number"
122545
+ }
122546
+ ],
122517
122547
  "media-player": [
122518
122548
  {
122519
122549
  "path": "state",
@@ -123707,7 +123737,7 @@ function sleep(ms) {
123707
123737
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123708
123738
  }
123709
123739
  //#endregion
123710
- //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
123740
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
123711
123741
  /**
123712
123742
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123713
123743
  *
@@ -150897,6 +150927,67 @@ object({
150897
150927
  /** Namespaces the client listed that no longer exist. */
150898
150928
  deleted: array(PreferenceNamespaceSchema)
150899
150929
  });
150930
+ /**
150931
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
150932
+ *
150933
+ * One entry per tRPC method the hub serves, capability and core routes alike,
150934
+ * read off the live router by the hub (never a hand-written list).
150935
+ */
150936
+ var ApiProcedureKindSchema = _enum([
150937
+ "query",
150938
+ "mutation",
150939
+ "subscription"
150940
+ ]);
150941
+ /** The gate a method runs behind. */
150942
+ var ApiProcedureTierSchema = _enum([
150943
+ "public",
150944
+ "protected",
150945
+ "admin"
150946
+ ]);
150947
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
150948
+ var ApiCatalogScopeSchema = object({
150949
+ capName: string(),
150950
+ capScope: _enum(["device", "system"]),
150951
+ access: _enum([
150952
+ "view",
150953
+ "create",
150954
+ "delete"
150955
+ ]),
150956
+ role: string()
150957
+ });
150958
+ var ApiCatalogEntrySchema = object({
150959
+ /** `<router>.<method>` — the tRPC path. */
150960
+ path: string(),
150961
+ router: string(),
150962
+ method: string(),
150963
+ kind: ApiProcedureKindSchema,
150964
+ tier: ApiProcedureTierSchema,
150965
+ source: _enum(["capability", "core"]),
150966
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
150967
+ scope: ApiCatalogScopeSchema.nullable(),
150968
+ hasInput: boolean()
150969
+ });
150970
+ /**
150971
+ * May the CALLER call a method. The list has no input, so a method reached
150972
+ * only through a device grant is `per-device`: the real call is allowed or
150973
+ * refused on the device its input names.
150974
+ */
150975
+ var ApiCallableSchema = _enum([
150976
+ "yes",
150977
+ "no",
150978
+ "per-device"
150979
+ ]);
150980
+ object({ methods: array(ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema })) });
150981
+ /** A JSON Schema document, as the explorer receives it. */
150982
+ var JsonSchemaDocumentSchema = record(string(), unknown());
150983
+ object({
150984
+ path: string(),
150985
+ hasInput: boolean(),
150986
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
150987
+ schema: JsonSchemaDocumentSchema.nullable(),
150988
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
150989
+ error: string().nullable()
150990
+ });
150900
150991
  _enum(["new-session", "step-up"]);
150901
150992
  /** The languages the hub's app landing pages are written in (D858). */
150902
150993
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -154642,9 +154733,8 @@ var airQualitySensorCapability = {
154642
154733
  * Many panels require a PIN code on arm / disarm — the optional
154643
154734
  * `code` field on the methods passes it through to the upstream
154644
154735
  * service; it's NEVER persisted in the runtime slice or any event
154645
- * payload. The presence of a required code is signalled by
154646
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
154647
- * field without a slice fetch.
154736
+ * payload. Whether a code is required is the slice's `codeRequired`
154737
+ * (#459): `null` when the provider cannot tell (D393).
154648
154738
  *
154649
154739
  * `availableModes` mirrors HA's `supported_features`-derived arm
154650
154740
  * mode list — the UI renders only the buttons the panel accepts.
@@ -154683,9 +154773,13 @@ var AlarmPanelStatusSchema = object({
154683
154773
  /** Subset of arm modes the panel accepts. UI renders one button per
154684
154774
  * mode in this list. */
154685
154775
  availableModes: array(AlarmArmModeSchema),
154686
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
154687
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
154688
- requiresCode: boolean(),
154776
+ /**
154777
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
154778
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
154779
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
154780
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
154781
+ */
154782
+ codeRequired: boolean().nullable(),
154689
154783
  /** Ms epoch when the slice was last updated. */
154690
154784
  lastChangedAt: number$1()
154691
154785
  });
@@ -154742,7 +154836,7 @@ var alarmPanelCapability = {
154742
154836
  arm: method(object({
154743
154837
  deviceId: number$1().int().nonnegative(),
154744
154838
  mode: AlarmArmModeSchema,
154745
- /** Optional PIN code. Required when `requiresCode === true`.
154839
+ /** Optional PIN code. Required when `codeRequired === true`.
154746
154840
  * Passed through to the upstream service; never persisted. */
154747
154841
  code: string().min(1).optional()
154748
154842
  }), _void(), {
@@ -154859,7 +154953,7 @@ var alarmPanelCapability = {
154859
154953
  /**
154860
154954
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
154861
154955
  * full slice; renders an arm button per `availableModes` entry and
154862
- * a PIN field iff `requiresCode === true`.
154956
+ * a PIN field iff `codeRequired === true`.
154863
154957
  */
154864
154958
  runtimeState: AlarmPanelStatusSchema,
154865
154959
  /**
@@ -154870,6 +154964,13 @@ var alarmPanelCapability = {
154870
154964
  */
154871
154965
  durability: "restored",
154872
154966
  /**
154967
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
154968
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
154969
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
154970
+ * can be dropped after every node has booted once on a release that has it.
154971
+ */
154972
+ restoredFieldRenames: { requiresCode: "codeRequired" },
154973
+ /**
154873
154974
  * History (D850): the panel's lifecycle state as an `enum` series —
154874
154975
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
154875
154976
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -156067,9 +156168,9 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
156067
156168
  auth: "admin"
156068
156169
  });
156069
156170
  /**
156070
- * Battery status snapshot. Emitted by providers whose device is
156071
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
156072
- * future sensor/button accessories). Consumers build their own "low
156171
+ * Battery status snapshot. Emitted by providers whose device reports a
156172
+ * battery (`DeviceFeature.BatteryOperated`): battery cameras, sensors,
156173
+ * buttons. Whether the device SLEEPS is `low-power-sleep`, not this cap. Consumers build their own "low
156073
156174
  * battery" alerting on top — the cap deliberately does NOT enforce a
156074
156175
  * threshold.
156075
156176
  */
@@ -156226,47 +156327,12 @@ var batteryCapability = {
156226
156327
  deviceNative: true,
156227
156328
  mode: "singleton",
156228
156329
  deviceTypes: BATTERY_DEVICE_TYPES,
156229
- methods: {
156230
156330
  /**
156231
- * Explicitly wake the camera from low-power sleep ahead of a
156232
- * streaming session start. Consumers that initiate a stream
156233
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
156234
- * RTCSession, snapshot wrappers) call this with a short timeout
156235
- * before establishing the media pipeline — the broker's own
156236
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
156237
- * during which the consumer renders a black screen. Pre-waking
156238
- * compresses that gap.
156239
- *
156240
- * Returns `awoke: true` when the firmware acknowledged the wake
156241
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
156242
- * the cap surface is unavailable (no Baichuan / firmware
156243
- * channel); the caller should still attempt the stream — the
156244
- * passive broker wake remains as fallback.
156245
- */
156246
- wakeForStream: method(object({
156247
- deviceId: number$1(),
156248
- /** Bound on the wait. Sensible range 3000–10000ms. */
156249
- timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
156250
- }), object({
156251
- awoke: boolean(),
156252
- durationMs: number$1()
156253
- }), {
156254
- kind: "mutation",
156255
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
156256
- }) },
156257
- /**
156258
- * A composed provider (battery ADDED to a pet feeder or container that has
156259
- * no wake surface) answers `wakeForStream` with the same "unavailable"
156260
- * result the contract already defines above: "Returns `awoke: false` when
156261
- * … the cap surface is unavailable." (D663).
156331
+ * No methods: waking a sleeping camera is `low-power-sleep.wakeUp`
156332
+ * (#459, Q2). A battery reading says nothing about sleep — a battery sensor
156333
+ * reports charge and never needs waking.
156262
156334
  */
156263
- composedMethods: { wakeForStream: {
156264
- kind: "answer",
156265
- value: {
156266
- awoke: false,
156267
- durationMs: 0
156268
- }
156269
- } },
156335
+ methods: {},
156270
156336
  events: {
156271
156337
  /**
156272
156338
  * Emitted whenever the cached status changes (firmware push OR
@@ -163298,6 +163364,69 @@ function normaliseIdentifiers(raw, options = {}) {
163298
163364
  rejected: refused
163299
163365
  };
163300
163366
  }
163367
+ /**
163368
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
163369
+ *
163370
+ * Two devices brought by DIFFERENT integrations that share provider-declared
163371
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
163372
+ * physical object. This module holds the answer's shape; the device-manager
163373
+ * keeps the index that finds the pairs and the ONE rule that grades a match
163374
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
163375
+ *
163376
+ * The rule (operator, planning#590):
163377
+ *
163378
+ * | Matched keys | Confidence |
163379
+ * | ---------------------------------------------- | ----------- |
163380
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
163381
+ * | `mac` + `ip` | `auto` |
163382
+ * | exactly one strong kind | `proposal` |
163383
+ * | weak keys only (`hostname`, `ip`) | no candidate|
163384
+ *
163385
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
163386
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
163387
+ * no match.
163388
+ *
163389
+ * Read-only: a candidate is NOT a link. Links are step 3.
163390
+ */
163391
+ var IdentityConfidenceSchema = _enum(["auto", "proposal"]);
163392
+ /** One identifier both devices declared, with the same normalised value. */
163393
+ var IdentityMatchedKeySchema = object({
163394
+ key: DeviceIdentifierKeySchema,
163395
+ value: string()
163396
+ });
163397
+ /** One side of a pair: the device and the integration that brought it. */
163398
+ var IdentityCandidateDeviceSchema = object({
163399
+ deviceId: number$1().int(),
163400
+ addonId: string(),
163401
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
163402
+ integrationId: string().nullable()
163403
+ });
163404
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
163405
+ var IdentityCandidatePairSchema = object({
163406
+ a: IdentityCandidateDeviceSchema,
163407
+ b: IdentityCandidateDeviceSchema,
163408
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
163409
+ keys: array(IdentityMatchedKeySchema).readonly(),
163410
+ confidence: IdentityConfidenceSchema
163411
+ });
163412
+ /**
163413
+ * The answer of `device-manager.listIdentityCandidates`.
163414
+ *
163415
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
163416
+ * NOT an empty list (D315).
163417
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
163418
+ * devices with no identifiers on record: whether they match anything is
163419
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
163420
+ * identifiers and matched nobody.
163421
+ */
163422
+ var IdentityCandidatesSchema = discriminatedUnion("status", [object({
163423
+ status: literal("unknown"),
163424
+ reason: string()
163425
+ }), object({
163426
+ status: literal("answered"),
163427
+ pairs: array(IdentityCandidatePairSchema).readonly(),
163428
+ undeclaredDeviceIds: array(number$1().int()).readonly()
163429
+ })]);
163301
163430
  var DeviceSearchRequiresSchema = object({
163302
163431
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
163303
163432
  caps: array(string()).readonly().optional(),
@@ -164338,6 +164467,9 @@ method(object({
164338
164467
  }), _void(), {
164339
164468
  kind: "mutation",
164340
164469
  auth: "admin"
164470
+ }), method(object({}), IdentityCandidatesSchema, {
164471
+ kind: "query",
164472
+ auth: "admin"
164341
164473
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
164342
164474
  kind: "mutation",
164343
164475
  auth: "admin"
@@ -172910,6 +173042,13 @@ var LockControlStatusSchema = object({
172910
173042
  "jammed",
172911
173043
  "door-open"
172912
173044
  ]),
173045
+ /**
173046
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
173047
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
173048
+ * (D393) — never `false`. `.optional()` so a restored slice written before
173049
+ * the field still parses; readers treat absent exactly like `null`.
173050
+ */
173051
+ codeRequired: boolean().nullable().optional(),
172913
173052
  /** Ms epoch when the slice was last updated. */
172914
173053
  lastChangedAt: number$1()
172915
173054
  });
@@ -173389,6 +173528,90 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
173389
173528
  ]);
173390
173529
  method(_void(), array(LoginMethodContributionSchema).readonly()), NOT_A_DEVICE.IDENTITY;
173391
173530
  /**
173531
+ * low-power-sleep — a device that goes into low-power sleep and must be WOKEN
173532
+ * before it streams (#459, Q2). A battery camera (Reolink Argus, a robot's
173533
+ * on-board camera) is one; a battery SENSOR is not: it reports charge on the
173534
+ * `battery` cap and never sleeps. The two meanings used to share
173535
+ * `DeviceFeature.BatteryOperated`; this cap is the one that answers "sleeps",
173536
+ * and `DeviceFeature.Sleeps` is derived from it being bound with
173537
+ * `wakeUp` implemented.
173538
+ *
173539
+ * The state is the sleep inputs (`deriveBatteryPresence`): whether the device
173540
+ * is asleep, and the last time it PROVED it was reachable. Read from this slice
173541
+ * by the stream broker (`readBatterySleepFacts`), the recorder
173542
+ * (`recordingWakeDeps`) and the snapshot builtin. The broker's per-device
173543
+ * mirror is still also fed by `BatteryOnStatusChanged` events.
173544
+ */
173545
+ var LowPowerSleepStatusSchema = object({
173546
+ /**
173547
+ * True while the firmware is in low-power mode. A provider MUST avoid polling
173548
+ * during sleep — a read wakes the device and drains charge.
173549
+ */
173550
+ sleeping: boolean().meta({ label: "Sleeping" }),
173551
+ /**
173552
+ * Ms epoch of the last time the device proved it was reachable, from
173553
+ * PASSIVE signals only (a completed round-trip, an observed wake, a push).
173554
+ * Absent = never since this slice was born. The only input that separates
173555
+ * "asleep" from "gone".
173556
+ */
173557
+ lastContactAt: number$1().optional(),
173558
+ /** Ms epoch of the last observation. */
173559
+ lastUpdated: number$1().meta(readingMeta("none"))
173560
+ });
173561
+ var lowPowerSleepCapability = {
173562
+ name: "low-power-sleep",
173563
+ scope: "device",
173564
+ deviceNative: true,
173565
+ mode: "singleton",
173566
+ deviceTypes: [DeviceType.Camera],
173567
+ methods: {
173568
+ /**
173569
+ * Explicitly wake the device from low-power sleep ahead of a streaming
173570
+ * session start. Consumers that initiate a stream against a sleeping
173571
+ * camera (wake-on-play, the recorder, HomeKit, Alexa, snapshot wrappers)
173572
+ * call this with a short timeout before establishing the media pipeline —
173573
+ * the broker's own passive wake-on-dial works but adds 5–7 seconds to
173574
+ * first-frame. Pre-waking compresses that gap.
173575
+ *
173576
+ * Returns `awoke: true` when the firmware acknowledged the wake before
173577
+ * `timeoutMs`, `awoke: false` when it timed out; the caller should still
173578
+ * attempt the stream — the passive broker wake remains as fallback.
173579
+ */
173580
+ wakeUp: method(object({
173581
+ deviceId: number$1(),
173582
+ /** Bound on the wait. Sensible range 3000–10000ms. */
173583
+ timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
173584
+ }), object({
173585
+ awoke: boolean(),
173586
+ durationMs: number$1()
173587
+ }), {
173588
+ kind: "mutation",
173589
+ notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
173590
+ }) },
173591
+ status: {
173592
+ schema: LowPowerSleepStatusSchema,
173593
+ kind: "push",
173594
+ empty: {
173595
+ sleeping: false,
173596
+ lastUpdated: 0
173597
+ }
173598
+ },
173599
+ runtimeState: LowPowerSleepStatusSchema,
173600
+ /**
173601
+ * Runtime-state durability: **restored** — a sleeping camera may not report
173602
+ * for hours; the restored sleep inputs are the only thing the sleep gate and
173603
+ * the presence derivation have (the same argument as `battery`).
173604
+ */
173605
+ durability: "restored",
173606
+ /** History (D850): none — battery never recorded a sleep series either. */
173607
+ history: "none",
173608
+ volatileStateFields: ["lastUpdated"],
173609
+ vocabulary: {
173610
+ noun: t("Low-power sleep", "Sospensione a basso consumo"),
173611
+ order: 5245
173612
+ }
173613
+ };
173614
+ /**
173392
173615
  * mesh-network — collection cap for mesh-VPN providers.
173393
173616
  *
173394
173617
  * Different shape from `network-access` (public tunnels):
@@ -191186,6 +191409,27 @@ var RemoteLayoutComponentSchema = object({
191186
191409
  });
191187
191410
  });
191188
191411
  method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
191412
+ /**
191413
+ * resync — a device whose derived spec can be re-aligned on demand with its
191414
+ * upstream source (#459, Q6). Registered by the containers an integration
191415
+ * adopted; `DeviceFeature.Resyncable` (the generic Re-sync button) is derived
191416
+ * from it being bound with `resync` implemented.
191417
+ *
191418
+ * The work itself stays where it is: the owning addon's `device-adoption`
191419
+ * provider, reached through `deviceManager.adoptionResync` (which also owns
191420
+ * the "resync from zero" child purge). A provider answers this method by
191421
+ * asking for exactly that — see `resyncThroughAdoption`.
191422
+ */
191423
+ var ResyncDeviceInputSchema = object({
191424
+ deviceId: number$1().int().nonnegative(),
191425
+ /** "Resync from zero": purge the accessory children before re-deriving. */
191426
+ resetToSource: boolean().optional()
191427
+ });
191428
+ DeviceType.Container, DeviceType.Workload, DeviceType.WeatherStation, method(ResyncDeviceInputSchema, ResyncResultSchema, {
191429
+ kind: "mutation",
191430
+ auth: "admin",
191431
+ notOperatorFacing: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action"
191432
+ });
191189
191433
  var RUNNING_POWER_START_DELAY_MS = 3e4;
191190
191434
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
191191
191435
  /**
@@ -200197,6 +200441,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
200197
200441
  irTransmitter: irTransmitterCapability,
200198
200442
  lawnMowerControl: lawnMowerControlCapability,
200199
200443
  lockControl: lockControlCapability,
200444
+ lowPowerSleep: lowPowerSleepCapability,
200200
200445
  mediaPlayer: mediaPlayerCapability,
200201
200446
  meter: meterCapability,
200202
200447
  motion: motionCapability,
@@ -201676,6 +201921,19 @@ var BaseDeviceProvider = class extends BaseAddon {
201676
201921
  return toDeviceSummary(device, this.addonId);
201677
201922
  }
201678
201923
  };
201924
+ /**
201925
+ * The `low-power-sleep` slice a provider projects from the `battery` slice it
201926
+ * already keeps: the sleep inputs, nothing else. One fact, one writer — the
201927
+ * provider's battery bookkeeping stays the source until the sleep state gets
201928
+ * its own writer.
201929
+ */
201930
+ function sleepSliceOfBattery(status) {
201931
+ return {
201932
+ sleeping: status.sleeping,
201933
+ ...status.lastContactAt !== void 0 ? { lastContactAt: status.lastContactAt } : {},
201934
+ lastUpdated: status.lastUpdated
201935
+ };
201936
+ }
201679
201937
  DeviceType.HeatPump;
201680
201938
  DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
201681
201939
  new Set(Object.values(DeviceType));
@@ -201886,8 +202144,8 @@ var ALARM_MODES = [
201886
202144
  "vacation",
201887
202145
  "custom_bypass"
201888
202146
  ];
201889
- function alarmControls(state, modes, requiresCode) {
201890
- if (requiresCode) return [];
202147
+ function alarmControls(state, modes, codeRequired) {
202148
+ if (codeRequired) return [];
201891
202149
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
201892
202150
  const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
201893
202151
  switch (state) {
@@ -201907,7 +202165,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
201907
202165
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
201908
202166
  return {
201909
202167
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
201910
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
202168
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
201911
202169
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
201912
202170
  ...words === null ? {} : { tiles: {
201913
202171
  left: [{
@@ -205290,13 +205548,6 @@ Object.freeze({
205290
205548
  access: "view",
205291
205549
  role: "viewer"
205292
205550
  },
205293
- "battery.wakeForStream": {
205294
- capName: "battery",
205295
- capScope: "device",
205296
- addonId: null,
205297
- access: "create",
205298
- role: "viewer"
205299
- },
205300
205551
  "binary.getStatus": {
205301
205552
  capName: "binary",
205302
205553
  capScope: "device",
@@ -206823,6 +207074,13 @@ Object.freeze({
206823
207074
  access: "view",
206824
207075
  role: "admin"
206825
207076
  },
207077
+ "deviceManager.listIdentityCandidates": {
207078
+ capName: "device-manager",
207079
+ capScope: "system",
207080
+ addonId: null,
207081
+ access: "view",
207082
+ role: "admin"
207083
+ },
206826
207084
  "deviceManager.listLocationDescriptions": {
206827
207085
  capName: "device-manager",
206828
207086
  capScope: "system",
@@ -208944,6 +209202,20 @@ Object.freeze({
208944
209202
  access: "view",
208945
209203
  role: "admin"
208946
209204
  },
209205
+ "lowPowerSleep.getStatus": {
209206
+ capName: "low-power-sleep",
209207
+ capScope: "device",
209208
+ addonId: null,
209209
+ access: "view",
209210
+ role: "viewer"
209211
+ },
209212
+ "lowPowerSleep.wakeUp": {
209213
+ capName: "low-power-sleep",
209214
+ capScope: "device",
209215
+ addonId: null,
209216
+ access: "create",
209217
+ role: "viewer"
209218
+ },
208947
209219
  "mediaPlayer.channelDown": {
208948
209220
  capName: "media-player",
208949
209221
  capScope: "device",
@@ -212619,6 +212891,13 @@ Object.freeze({
212619
212891
  access: "view",
212620
212892
  role: "admin"
212621
212893
  },
212894
+ "resync.resync": {
212895
+ capName: "resync",
212896
+ capScope: "device",
212897
+ addonId: null,
212898
+ access: "create",
212899
+ role: "admin"
212900
+ },
212622
212901
  "runningState.getStatus": {
212623
212902
  capName: "running-state",
212624
212903
  capScope: "device",
@@ -215014,7 +215293,7 @@ Object.freeze({
215014
215293
  role: "admin"
215015
215294
  }
215016
215295
  });
215017
- DeviceFeature.BatteryOperated;
215296
+ DeviceFeature.Sleeps;
215018
215297
  function bound(cap, methods = [], authority = "reported") {
215019
215298
  return {
215020
215299
  kind: "cap",
@@ -215026,11 +215305,11 @@ function bound(cap, methods = [], authority = "reported") {
215026
215305
  function derived(cap, methods = []) {
215027
215306
  return bound(cap, methods, "derived");
215028
215307
  }
215029
- DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
215308
+ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep", ["wakeUp"]), DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, derived("resync", ["resync"]), DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
215030
215309
  "startTalkSession",
215031
215310
  "pushTalkAudio",
215032
215311
  "endTalkSession"
215033
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockPinRequired, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.AlarmPinRequired, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasMap, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasMap, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
215312
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
215034
215313
  var ALL_FEATURES = Object.values(DeviceFeature);
215035
215314
  new Set(ALL_FEATURES);
215036
215315
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -215378,11 +215657,6 @@ Object.freeze({
215378
215657
  form: "single",
215379
215658
  optional: false
215380
215659
  }],
215381
- "battery.wakeForStream": [{
215382
- name: "deviceId",
215383
- form: "single",
215384
- optional: false
215385
- }],
215386
215660
  "binary.getStatus": [{
215387
215661
  name: "deviceId",
215388
215662
  form: "single",
@@ -216566,6 +216840,16 @@ Object.freeze({
216566
216840
  form: "single",
216567
216841
  optional: true
216568
216842
  }],
216843
+ "lowPowerSleep.getStatus": [{
216844
+ name: "deviceId",
216845
+ form: "single",
216846
+ optional: false
216847
+ }],
216848
+ "lowPowerSleep.wakeUp": [{
216849
+ name: "deviceId",
216850
+ form: "single",
216851
+ optional: false
216852
+ }],
216569
216853
  "mediaPlayer.channelDown": [{
216570
216854
  name: "deviceId",
216571
216855
  form: "single",
@@ -217851,6 +218135,11 @@ Object.freeze({
217851
218135
  form: "single",
217852
218136
  optional: false
217853
218137
  }],
218138
+ "resync.resync": [{
218139
+ name: "deviceId",
218140
+ form: "single",
218141
+ optional: false
218142
+ }],
217854
218143
  "runningState.getStatus": [{
217855
218144
  name: "deviceId",
217856
218145
  form: "single",
@@ -227010,7 +227299,8 @@ function capDayNightModeToReolink(mode) {
227010
227299
  * `features = ['native-snapshot','rebootable']` because the `feature-probe`
227011
227300
  * slice had never been written.
227012
227301
  *
227013
- * That miss is not cosmetic. `DeviceFeature.BatteryOperated` is the gate for:
227302
+ * That miss is not cosmetic. `DeviceFeature.BatteryOperated` (and, since #459,
227303
+ * `DeviceFeature.Sleeps` beside it) is the gate for:
227014
227304
  * - the viewer's battery badge + sleeping overlay (`use-cameras.ts` FEATURE
227015
227305
  * map) — without it the camera is drawn as an ordinary awake camera;
227016
227306
  * - the snapshot wrapper's sleep gate (`snapshot.addon.ts`
@@ -227024,10 +227314,19 @@ function capDayNightModeToReolink(mode) {
227024
227314
  * clears it). This makes the DERIVED answer sticky the same way, for the
227025
227315
  * window before any probe has ever succeeded.
227026
227316
  */
227317
+ /**
227318
+ * The ONE Reolink answer to "is this a battery camera that sleeps" (#459, Q2).
227319
+ * The published features (`BatteryOperated` + `Sleeps`) and the registration
227320
+ * of the `battery` and `low-power-sleep` caps both ask it, so a camera that
227321
+ * claims `Sleeps` in the stream catalog is also one the registry can wake.
227322
+ */
227323
+ function reolinkCameraSleeps(inputs) {
227324
+ return inputs.probe.hasBattery === true || inputs.isBattery;
227325
+ }
227027
227326
  function deriveReolinkCameraFeatures(inputs) {
227028
- const { probe, isBattery } = inputs;
227327
+ const { probe } = inputs;
227029
227328
  const out = [DeviceFeature.NativeSnapshot, DeviceFeature.Rebootable];
227030
- if (probe.hasBattery === true || isBattery) out.push(DeviceFeature.BatteryOperated);
227329
+ if (reolinkCameraSleeps(inputs)) out.push(DeviceFeature.BatteryOperated, DeviceFeature.Sleeps);
227031
227330
  if (probe.hasPtz === true) out.push(DeviceFeature.PanTiltZoom);
227032
227331
  if (probe.hasAutotrack === true) out.push(DeviceFeature.PtzAutotrack);
227033
227332
  if (probe.hasIntercom === true) out.push(DeviceFeature.TwoWayAudio);
@@ -228910,7 +229209,7 @@ function applyHubChildSections(sections, snapshot) {
228910
229209
  * costs when we get them wrong.
228911
229210
  *
228912
229211
  * `→ awake` (`WAKE_HYSTERESIS_MS`): expensive if wrong. Believing an asleep
228913
- * camera is awake un-gates every background probe and makes `wakeForStream`
229212
+ * camera is awake un-gates every background probe and makes `wakeUp`
228914
229213
  * early-out without actually waking. Keep the window >= the library's UDP
228915
229214
  * inference cycle (~12 s on battery cams with idle-disconnect) and >= its
228916
229215
  * `getIdleDisconnectTimeoutMs` (30 s default).
@@ -228947,7 +229246,7 @@ function isSummarySourced(source) {
228947
229246
  * the anti-flap window does not apply to it at all.
228948
229247
  * 3. A `confirmed-wake` in the `→ awake` direction is first-hand evidence
228949
229248
  * this process produced: gating it with the anti-flap window is what
228950
- * stranded 3825's mirror on "asleep" while `wakeForStream` answered
229249
+ * stranded 3825's mirror on "asleep" while `wakeUp` answered
228951
229250
  * `awoke: true`.
228952
229251
  * 4. Everything else is subject to the asymmetric hysteresis.
228953
229252
  * 5. A summary flip toward `sleeping` is refused while a first-hand
@@ -232553,10 +232852,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232553
232852
  return effectiveProbeFlags(this.hasProbed(), super.getProbeFlags(), this.config?.get("deviceCache"));
232554
232853
  }
232555
232854
  get features() {
232556
- return deriveReolinkCameraFeatures({
232855
+ return deriveReolinkCameraFeatures(this.featureInputs());
232856
+ }
232857
+ /** What the features and the battery / sleep registration both read. */
232858
+ featureInputs() {
232859
+ return {
232557
232860
  probe: this.getProbeFlags(),
232558
232861
  isBattery: this.isBattery
232559
- });
232862
+ };
232560
232863
  }
232561
232864
  /** Lazy-connected Baichuan API. Spans the lifetime of every active stream. */
232562
232865
  api = null;
@@ -232694,7 +232997,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232694
232997
  lastProactiveWakeAt = 0;
232695
232998
  /**
232696
232999
  * Minimum gap between two proactive wakes. Demand-driven wakes
232697
- * (`wakeForStream` from the broker, `wakeIfSleeping` behind an
233000
+ * (`wakeUp` from the broker, `wakeIfSleeping` behind an
232698
233001
  * operator action, the intercom pre-wake) bypass this entirely —
232699
233002
  * the operator asked, the operator gets the camera. Only
232700
233003
  * self-initiated wakes are rate-limited, so a thumbnail cache miss
@@ -233561,7 +233864,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
233561
233864
  * (proactive config buttons such as Auto-configure email push). A
233562
233865
  * sleeping battery cam ignores Baichuan config round-trips, so clicking
233563
233866
  * "configure" would otherwise silently fail; this drives the same forced
233564
- * wake `wakeForStream` uses, then lets the caller proceed against a live
233867
+ * wake `wakeUp` uses, then lets the caller proceed against a live
233565
233868
  * camera. No-op for non-battery or already-awake cams. Best-effort:
233566
233869
  * returns whether the camera is (now) reachable/awake.
233567
233870
  */
@@ -233983,14 +234286,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
233983
234286
  */
233984
234287
  registerBatteryIfSupported() {
233985
234288
  if (this.batteryRegistered) return;
233986
- if (!this.isBattery) return;
234289
+ if (!reolinkCameraSleeps(this.featureInputs())) return;
233987
234290
  this.batteryRegistered = true;
233988
- this.ctx.registerNativeCap(batteryCapability, {
234291
+ this.ctx.registerNativeCap(batteryCapability, { getStatus: async ({ deviceId }) => {
234292
+ if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
234293
+ return this.state.battery;
234294
+ } });
234295
+ this.ctx.registerNativeCap(lowPowerSleepCapability, {
233989
234296
  getStatus: async ({ deviceId }) => {
233990
234297
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
233991
- return this.state.battery;
234298
+ return sleepSliceOfBattery(this.state.battery);
233992
234299
  },
233993
- wakeForStream: async ({ deviceId, timeoutMs }) => {
234300
+ wakeUp: async ({ deviceId, timeoutMs }) => {
233994
234301
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
233995
234302
  const startedAt = Date.now();
233996
234303
  if (!this.sleeping) return {
@@ -234007,7 +234314,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234007
234314
  };
234008
234315
  }
234009
234316
  this.markWakeIssued();
234010
- this.ctx.logger.info("battery wakeForStream: cam sleeping — issuing wake", {
234317
+ this.ctx.logger.info("battery wakeUp: cam sleeping — issuing wake", {
234011
234318
  tags: { deviceId: this.id },
234012
234319
  meta: { timeoutMs }
234013
234320
  });
@@ -234020,7 +234327,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234020
234327
  attempts: 2
234021
234328
  });
234022
234329
  await sleep(1500);
234023
- })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
234330
+ })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeUp timeout")), timeoutMs))]);
234024
234331
  const CONFIRM_TIMEOUT_MS = 1e4;
234025
234332
  const CONFIRM_POLL_MS = 1e3;
234026
234333
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
@@ -234053,7 +234360,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234053
234360
  }
234054
234361
  const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
234055
234362
  if (observedAwake && this.commitSleepState(false, confirmSource)) {
234056
- this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
234363
+ this.ctx.logger.info("battery wakeUp: wake confirmed — driving wake transition", {
234057
234364
  tags: { deviceId: this.id },
234058
234365
  meta: {
234059
234366
  confirmMs: Date.now() - startedAt,
@@ -234062,7 +234369,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234062
234369
  });
234063
234370
  this.onWakeTransition(confirmSource).catch(() => {});
234064
234371
  } else if (!confirmed) {
234065
- this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
234372
+ this.ctx.logger.warn("battery wakeUp: ACK received but no awake evidence inside the confirm window", {
234066
234373
  tags: { deviceId: this.id },
234067
234374
  meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
234068
234375
  });
@@ -234074,7 +234381,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234074
234381
  }
234075
234382
  if (confirmed && !observedAwake && parent !== null) this.watchHubChildAwake(parent).catch(() => {});
234076
234383
  if (this.commitSleepState(false, "confirmed-wake")) {
234077
- this.ctx.logger.info("battery wakeForStream: answering awake — committing the mirror", {
234384
+ this.ctx.logger.info("battery wakeUp: answering awake — committing the mirror", {
234078
234385
  tags: { deviceId: this.id },
234079
234386
  meta: {
234080
234387
  confirmedMs: Date.now() - startedAt,
@@ -234088,7 +234395,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234088
234395
  durationMs: Date.now() - startedAt
234089
234396
  };
234090
234397
  } catch (err) {
234091
- this.ctx.logger.warn("battery wakeForStream: wake did not complete in time", {
234398
+ this.ctx.logger.warn("battery wakeUp: wake did not complete in time", {
234092
234399
  tags: { deviceId: this.id },
234093
234400
  meta: {
234094
234401
  timeoutMs,
@@ -234111,11 +234418,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234111
234418
  });
234112
234419
  this.runtimeState.subscribeCap("battery", (slice) => {
234113
234420
  if (!slice) return;
234421
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(slice));
234114
234422
  this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnStatusChanged, this.eventSource(), {
234115
234423
  deviceId: this.id,
234116
234424
  status: slice
234117
234425
  }));
234118
234426
  });
234427
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(this.state.battery));
234119
234428
  this.refreshBatteryFromApi("register");
234120
234429
  }
234121
234430
  /**
@@ -234231,7 +234540,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234231
234540
  * `PROACTIVE_WAKE_COOLDOWN_MS` ago — the caller must then serve
234232
234541
  * whatever it has cached instead of reaching for the radio.
234233
234542
  *
234234
- * Demand-driven paths never call this: `wakeForStream` (a consumer
234543
+ * Demand-driven paths never call this: `wakeUp` (a consumer
234235
234544
  * wants live video), `wakeIfSleeping` (an operator clicked
234236
234545
  * something) and the intercom pre-wake all wake unconditionally.
234237
234546
  */
@@ -234270,7 +234579,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234270
234579
  try {
234271
234580
  if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
234272
234581
  if (this.commitSleepState(false, "hub-summary")) {
234273
- this.ctx.logger.info("battery wakeForStream: hub child observed awake after the dial", { tags: { deviceId: this.id } });
234582
+ this.ctx.logger.info("battery wakeUp: hub child observed awake after the dial", { tags: { deviceId: this.id } });
234274
234583
  this.onWakeTransition("hub-summary").catch(() => {});
234275
234584
  }
234276
234585
  return;
@@ -240304,6 +240613,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240304
240613
  this.registerPtzAutotrackIfSupported();
240305
240614
  this.registerDoorbellIfSupported();
240306
240615
  this.registerIntercomIfSupported();
240616
+ this.registerBatteryIfSupported();
240307
240617
  this.ctx.logger.info("Reolink features probed + persisted", {
240308
240618
  tags: { deviceId: this.id },
240309
240619
  meta: {