@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.mjs CHANGED
@@ -100690,7 +100690,7 @@ function parseBaichuanWebhookObject(mess) {
100690
100690
  return parsed;
100691
100691
  }
100692
100692
  //#endregion
100693
- //#region ../types/dist/event-category-Hwx_JSCU.mjs
100693
+ //#region ../types/dist/event-category-CY27-fF0.mjs
100694
100694
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100695
100695
  EventCategory["SystemBoot"] = "system.boot";
100696
100696
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101190,7 +101190,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101190
101190
  */
101191
101191
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
101192
101192
  /**
101193
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
101193
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
101194
101194
  * "wake in progress" window — between the Baichuan wake-up issue and
101195
101195
  * the camera's first dialed-back RTP packet. The stream-broker
101196
101196
  * manager subscribes to flip the per-broker placeholder reason to
@@ -101522,7 +101522,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101522
101522
  return EventCategory;
101523
101523
  }({});
101524
101524
  //#endregion
101525
- //#region ../types/dist/composed-stable-id-BBL71oUQ.mjs
101525
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
101526
101526
  /**
101527
101527
  import { errMsg } from '@camstack/types'
101528
101528
  * Extract a human-readable message from an unknown error value.
@@ -101661,12 +101661,19 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101661
101661
  return DeviceType;
101662
101662
  }({});
101663
101663
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101664
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
101664
101665
  DeviceFeature["BatteryOperated"] = "battery-operated";
101666
+ /**
101667
+ * The device goes into low-power sleep and must be WOKEN before it streams
101668
+ * (the `low-power-sleep` cap, `wakeUp`). A battery reading alone is
101669
+ * not this: a battery sensor reports charge and never sleeps (#459, Q2).
101670
+ */
101671
+ DeviceFeature["Sleeps"] = "sleeps";
101665
101672
  DeviceFeature["Rebootable"] = "rebootable";
101666
101673
  /**
101667
101674
  * Device supports an on-demand re-sync of its derived spec with its
101668
- * upstream source — drives the generic Re-sync button. The owning
101669
- * provider implements the action via the `device-adoption.resync` cap.
101675
+ * upstream source — drives the generic Re-sync button. Present when the
101676
+ * device has the `resync` cap bound (#459, Q6).
101670
101677
  */
101671
101678
  DeviceFeature["Resyncable"] = "resyncable";
101672
101679
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -101750,9 +101757,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101750
101757
  DeviceFeature["FanDirection"] = "fan-direction";
101751
101758
  /** Fan exposes an oscillation toggle. */
101752
101759
  DeviceFeature["FanOscillating"] = "fan-oscillating";
101753
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
101754
- * field on the UI lock-controls panel. */
101755
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
101756
101760
  /** Lock supports a latch-release ("open door") action distinct from
101757
101761
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
101758
101762
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -101783,8 +101787,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101783
101787
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
101784
101788
  /** Media player exposes power on / off. */
101785
101789
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
101786
- /** Alarm panel requires a PIN code on arm/disarm. */
101787
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
101788
101790
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
101789
101791
  * addition to a textual location. */
101790
101792
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -101804,15 +101806,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101804
101806
  /** Automation `trigger` accepts a skipCondition flag — fires the
101805
101807
  * automation's actions while bypassing its condition block. */
101806
101808
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
101807
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
101808
- * map tile in the vacuum UI. */
101809
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
101810
101809
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
101811
101810
  * switches group. */
101812
101811
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
101813
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
101814
- * mower map tile. */
101815
- DeviceFeature["MowerHasMap"] = "mower-has-map";
101816
101812
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101817
101813
  * spots) — gates the Mow action + map selectors. */
101818
101814
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -106800,7 +106796,7 @@ var ZodIssueCode = {
106800
106796
  var ZodFirstPartyTypeKind;
106801
106797
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106802
106798
  //#endregion
106803
- //#region ../types/dist/sleep-D6Pih0Qt.mjs
106799
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
106804
106800
  /**
106805
106801
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106806
106802
  * window to float samples (D455).
@@ -118255,6 +118251,14 @@ var CAP_VOCABULARY_BY_NAME = {
118255
118251
  icon: "refresh-cw"
118256
118252
  }]
118257
118253
  },
118254
+ "resync": {
118255
+ scope: "device",
118256
+ noun: {
118257
+ en: "Re-sync",
118258
+ it: "Risincronizzazione"
118259
+ },
118260
+ notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
118261
+ },
118258
118262
  "recording": {
118259
118263
  scope: "device",
118260
118264
  noun: {
@@ -120266,7 +120270,6 @@ var CAP_VOCABULARY_BY_NAME = {
120266
120270
  en: "Battery",
120267
120271
  it: "Batteria"
120268
120272
  },
120269
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
120270
120273
  state: [
120271
120274
  {
120272
120275
  kind: "numeric",
@@ -120376,6 +120379,14 @@ var CAP_VOCABULARY_BY_NAME = {
120376
120379
  icon: "moon"
120377
120380
  }]
120378
120381
  },
120382
+ "low-power-sleep": {
120383
+ scope: "device",
120384
+ noun: {
120385
+ en: "Low-power sleep",
120386
+ it: "Sospensione a basso consumo"
120387
+ },
120388
+ notOperatorFacing: { wakeUp: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" }
120389
+ },
120379
120390
  "network-link": {
120380
120391
  scope: "device",
120381
120392
  noun: {
@@ -121281,6 +121292,7 @@ var CAP_NAMES = Object.freeze([
121281
121292
  "log-channels",
121282
121293
  "log-destination",
121283
121294
  "login-method",
121295
+ "low-power-sleep",
121284
121296
  "media-player",
121285
121297
  "mesh-network",
121286
121298
  "meter",
@@ -121334,6 +121346,7 @@ var CAP_NAMES = Object.freeze([
121334
121346
  "records",
121335
121347
  "remote",
121336
121348
  "remote-layout-components",
121349
+ "resync",
121337
121350
  "running-state",
121338
121351
  "scene-monitor",
121339
121352
  "schedulers",
@@ -121437,7 +121450,7 @@ Object.freeze({
121437
121450
  ]
121438
121451
  },
121439
121452
  {
121440
- "path": "requiresCode",
121453
+ "path": "codeRequired",
121441
121454
  "valueType": "boolean"
121442
121455
  }
121443
121456
  ],
@@ -122505,7 +122518,24 @@ Object.freeze({
122505
122518
  "jammed",
122506
122519
  "door-open"
122507
122520
  ]
122521
+ }, {
122522
+ "path": "codeRequired",
122523
+ "valueType": "boolean"
122508
122524
  }],
122525
+ "low-power-sleep": [
122526
+ {
122527
+ "path": "sleeping",
122528
+ "valueType": "boolean"
122529
+ },
122530
+ {
122531
+ "path": "lastContactAt",
122532
+ "valueType": "number"
122533
+ },
122534
+ {
122535
+ "path": "lastUpdated",
122536
+ "valueType": "number"
122537
+ }
122538
+ ],
122509
122539
  "media-player": [
122510
122540
  {
122511
122541
  "path": "state",
@@ -123699,7 +123729,7 @@ function sleep(ms) {
123699
123729
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123700
123730
  }
123701
123731
  //#endregion
123702
- //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
123732
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
123703
123733
  /**
123704
123734
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123705
123735
  *
@@ -150889,6 +150919,67 @@ object({
150889
150919
  /** Namespaces the client listed that no longer exist. */
150890
150920
  deleted: array(PreferenceNamespaceSchema)
150891
150921
  });
150922
+ /**
150923
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
150924
+ *
150925
+ * One entry per tRPC method the hub serves, capability and core routes alike,
150926
+ * read off the live router by the hub (never a hand-written list).
150927
+ */
150928
+ var ApiProcedureKindSchema = _enum([
150929
+ "query",
150930
+ "mutation",
150931
+ "subscription"
150932
+ ]);
150933
+ /** The gate a method runs behind. */
150934
+ var ApiProcedureTierSchema = _enum([
150935
+ "public",
150936
+ "protected",
150937
+ "admin"
150938
+ ]);
150939
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
150940
+ var ApiCatalogScopeSchema = object({
150941
+ capName: string(),
150942
+ capScope: _enum(["device", "system"]),
150943
+ access: _enum([
150944
+ "view",
150945
+ "create",
150946
+ "delete"
150947
+ ]),
150948
+ role: string()
150949
+ });
150950
+ var ApiCatalogEntrySchema = object({
150951
+ /** `<router>.<method>` — the tRPC path. */
150952
+ path: string(),
150953
+ router: string(),
150954
+ method: string(),
150955
+ kind: ApiProcedureKindSchema,
150956
+ tier: ApiProcedureTierSchema,
150957
+ source: _enum(["capability", "core"]),
150958
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
150959
+ scope: ApiCatalogScopeSchema.nullable(),
150960
+ hasInput: boolean()
150961
+ });
150962
+ /**
150963
+ * May the CALLER call a method. The list has no input, so a method reached
150964
+ * only through a device grant is `per-device`: the real call is allowed or
150965
+ * refused on the device its input names.
150966
+ */
150967
+ var ApiCallableSchema = _enum([
150968
+ "yes",
150969
+ "no",
150970
+ "per-device"
150971
+ ]);
150972
+ object({ methods: array(ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema })) });
150973
+ /** A JSON Schema document, as the explorer receives it. */
150974
+ var JsonSchemaDocumentSchema = record(string(), unknown());
150975
+ object({
150976
+ path: string(),
150977
+ hasInput: boolean(),
150978
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
150979
+ schema: JsonSchemaDocumentSchema.nullable(),
150980
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
150981
+ error: string().nullable()
150982
+ });
150892
150983
  _enum(["new-session", "step-up"]);
150893
150984
  /** The languages the hub's app landing pages are written in (D858). */
150894
150985
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -154634,9 +154725,8 @@ var airQualitySensorCapability = {
154634
154725
  * Many panels require a PIN code on arm / disarm — the optional
154635
154726
  * `code` field on the methods passes it through to the upstream
154636
154727
  * service; it's NEVER persisted in the runtime slice or any event
154637
- * payload. The presence of a required code is signalled by
154638
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
154639
- * field without a slice fetch.
154728
+ * payload. Whether a code is required is the slice's `codeRequired`
154729
+ * (#459): `null` when the provider cannot tell (D393).
154640
154730
  *
154641
154731
  * `availableModes` mirrors HA's `supported_features`-derived arm
154642
154732
  * mode list — the UI renders only the buttons the panel accepts.
@@ -154675,9 +154765,13 @@ var AlarmPanelStatusSchema = object({
154675
154765
  /** Subset of arm modes the panel accepts. UI renders one button per
154676
154766
  * mode in this list. */
154677
154767
  availableModes: array(AlarmArmModeSchema),
154678
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
154679
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
154680
- requiresCode: boolean(),
154768
+ /**
154769
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
154770
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
154771
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
154772
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
154773
+ */
154774
+ codeRequired: boolean().nullable(),
154681
154775
  /** Ms epoch when the slice was last updated. */
154682
154776
  lastChangedAt: number$1()
154683
154777
  });
@@ -154734,7 +154828,7 @@ var alarmPanelCapability = {
154734
154828
  arm: method(object({
154735
154829
  deviceId: number$1().int().nonnegative(),
154736
154830
  mode: AlarmArmModeSchema,
154737
- /** Optional PIN code. Required when `requiresCode === true`.
154831
+ /** Optional PIN code. Required when `codeRequired === true`.
154738
154832
  * Passed through to the upstream service; never persisted. */
154739
154833
  code: string().min(1).optional()
154740
154834
  }), _void(), {
@@ -154851,7 +154945,7 @@ var alarmPanelCapability = {
154851
154945
  /**
154852
154946
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
154853
154947
  * full slice; renders an arm button per `availableModes` entry and
154854
- * a PIN field iff `requiresCode === true`.
154948
+ * a PIN field iff `codeRequired === true`.
154855
154949
  */
154856
154950
  runtimeState: AlarmPanelStatusSchema,
154857
154951
  /**
@@ -154862,6 +154956,13 @@ var alarmPanelCapability = {
154862
154956
  */
154863
154957
  durability: "restored",
154864
154958
  /**
154959
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
154960
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
154961
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
154962
+ * can be dropped after every node has booted once on a release that has it.
154963
+ */
154964
+ restoredFieldRenames: { requiresCode: "codeRequired" },
154965
+ /**
154865
154966
  * History (D850): the panel's lifecycle state as an `enum` series —
154866
154967
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
154867
154968
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -156059,9 +156160,9 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
156059
156160
  auth: "admin"
156060
156161
  });
156061
156162
  /**
156062
- * Battery status snapshot. Emitted by providers whose device is
156063
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
156064
- * future sensor/button accessories). Consumers build their own "low
156163
+ * Battery status snapshot. Emitted by providers whose device reports a
156164
+ * battery (`DeviceFeature.BatteryOperated`): battery cameras, sensors,
156165
+ * buttons. Whether the device SLEEPS is `low-power-sleep`, not this cap. Consumers build their own "low
156065
156166
  * battery" alerting on top — the cap deliberately does NOT enforce a
156066
156167
  * threshold.
156067
156168
  */
@@ -156218,47 +156319,12 @@ var batteryCapability = {
156218
156319
  deviceNative: true,
156219
156320
  mode: "singleton",
156220
156321
  deviceTypes: BATTERY_DEVICE_TYPES,
156221
- methods: {
156222
156322
  /**
156223
- * Explicitly wake the camera from low-power sleep ahead of a
156224
- * streaming session start. Consumers that initiate a stream
156225
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
156226
- * RTCSession, snapshot wrappers) call this with a short timeout
156227
- * before establishing the media pipeline — the broker's own
156228
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
156229
- * during which the consumer renders a black screen. Pre-waking
156230
- * compresses that gap.
156231
- *
156232
- * Returns `awoke: true` when the firmware acknowledged the wake
156233
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
156234
- * the cap surface is unavailable (no Baichuan / firmware
156235
- * channel); the caller should still attempt the stream — the
156236
- * passive broker wake remains as fallback.
156237
- */
156238
- wakeForStream: method(object({
156239
- deviceId: number$1(),
156240
- /** Bound on the wait. Sensible range 3000–10000ms. */
156241
- timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
156242
- }), object({
156243
- awoke: boolean(),
156244
- durationMs: number$1()
156245
- }), {
156246
- kind: "mutation",
156247
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
156248
- }) },
156249
- /**
156250
- * A composed provider (battery ADDED to a pet feeder or container that has
156251
- * no wake surface) answers `wakeForStream` with the same "unavailable"
156252
- * result the contract already defines above: "Returns `awoke: false` when
156253
- * … the cap surface is unavailable." (D663).
156323
+ * No methods: waking a sleeping camera is `low-power-sleep.wakeUp`
156324
+ * (#459, Q2). A battery reading says nothing about sleep — a battery sensor
156325
+ * reports charge and never needs waking.
156254
156326
  */
156255
- composedMethods: { wakeForStream: {
156256
- kind: "answer",
156257
- value: {
156258
- awoke: false,
156259
- durationMs: 0
156260
- }
156261
- } },
156327
+ methods: {},
156262
156328
  events: {
156263
156329
  /**
156264
156330
  * Emitted whenever the cached status changes (firmware push OR
@@ -163290,6 +163356,69 @@ function normaliseIdentifiers(raw, options = {}) {
163290
163356
  rejected: refused
163291
163357
  };
163292
163358
  }
163359
+ /**
163360
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
163361
+ *
163362
+ * Two devices brought by DIFFERENT integrations that share provider-declared
163363
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
163364
+ * physical object. This module holds the answer's shape; the device-manager
163365
+ * keeps the index that finds the pairs and the ONE rule that grades a match
163366
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
163367
+ *
163368
+ * The rule (operator, planning#590):
163369
+ *
163370
+ * | Matched keys | Confidence |
163371
+ * | ---------------------------------------------- | ----------- |
163372
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
163373
+ * | `mac` + `ip` | `auto` |
163374
+ * | exactly one strong kind | `proposal` |
163375
+ * | weak keys only (`hostname`, `ip`) | no candidate|
163376
+ *
163377
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
163378
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
163379
+ * no match.
163380
+ *
163381
+ * Read-only: a candidate is NOT a link. Links are step 3.
163382
+ */
163383
+ var IdentityConfidenceSchema = _enum(["auto", "proposal"]);
163384
+ /** One identifier both devices declared, with the same normalised value. */
163385
+ var IdentityMatchedKeySchema = object({
163386
+ key: DeviceIdentifierKeySchema,
163387
+ value: string()
163388
+ });
163389
+ /** One side of a pair: the device and the integration that brought it. */
163390
+ var IdentityCandidateDeviceSchema = object({
163391
+ deviceId: number$1().int(),
163392
+ addonId: string(),
163393
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
163394
+ integrationId: string().nullable()
163395
+ });
163396
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
163397
+ var IdentityCandidatePairSchema = object({
163398
+ a: IdentityCandidateDeviceSchema,
163399
+ b: IdentityCandidateDeviceSchema,
163400
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
163401
+ keys: array(IdentityMatchedKeySchema).readonly(),
163402
+ confidence: IdentityConfidenceSchema
163403
+ });
163404
+ /**
163405
+ * The answer of `device-manager.listIdentityCandidates`.
163406
+ *
163407
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
163408
+ * NOT an empty list (D315).
163409
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
163410
+ * devices with no identifiers on record: whether they match anything is
163411
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
163412
+ * identifiers and matched nobody.
163413
+ */
163414
+ var IdentityCandidatesSchema = discriminatedUnion("status", [object({
163415
+ status: literal("unknown"),
163416
+ reason: string()
163417
+ }), object({
163418
+ status: literal("answered"),
163419
+ pairs: array(IdentityCandidatePairSchema).readonly(),
163420
+ undeclaredDeviceIds: array(number$1().int()).readonly()
163421
+ })]);
163293
163422
  var DeviceSearchRequiresSchema = object({
163294
163423
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
163295
163424
  caps: array(string()).readonly().optional(),
@@ -164330,6 +164459,9 @@ method(object({
164330
164459
  }), _void(), {
164331
164460
  kind: "mutation",
164332
164461
  auth: "admin"
164462
+ }), method(object({}), IdentityCandidatesSchema, {
164463
+ kind: "query",
164464
+ auth: "admin"
164333
164465
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
164334
164466
  kind: "mutation",
164335
164467
  auth: "admin"
@@ -172902,6 +173034,13 @@ var LockControlStatusSchema = object({
172902
173034
  "jammed",
172903
173035
  "door-open"
172904
173036
  ]),
173037
+ /**
173038
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
173039
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
173040
+ * (D393) — never `false`. `.optional()` so a restored slice written before
173041
+ * the field still parses; readers treat absent exactly like `null`.
173042
+ */
173043
+ codeRequired: boolean().nullable().optional(),
172905
173044
  /** Ms epoch when the slice was last updated. */
172906
173045
  lastChangedAt: number$1()
172907
173046
  });
@@ -173381,6 +173520,90 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
173381
173520
  ]);
173382
173521
  method(_void(), array(LoginMethodContributionSchema).readonly()), NOT_A_DEVICE.IDENTITY;
173383
173522
  /**
173523
+ * low-power-sleep — a device that goes into low-power sleep and must be WOKEN
173524
+ * before it streams (#459, Q2). A battery camera (Reolink Argus, a robot's
173525
+ * on-board camera) is one; a battery SENSOR is not: it reports charge on the
173526
+ * `battery` cap and never sleeps. The two meanings used to share
173527
+ * `DeviceFeature.BatteryOperated`; this cap is the one that answers "sleeps",
173528
+ * and `DeviceFeature.Sleeps` is derived from it being bound with
173529
+ * `wakeUp` implemented.
173530
+ *
173531
+ * The state is the sleep inputs (`deriveBatteryPresence`): whether the device
173532
+ * is asleep, and the last time it PROVED it was reachable. Read from this slice
173533
+ * by the stream broker (`readBatterySleepFacts`), the recorder
173534
+ * (`recordingWakeDeps`) and the snapshot builtin. The broker's per-device
173535
+ * mirror is still also fed by `BatteryOnStatusChanged` events.
173536
+ */
173537
+ var LowPowerSleepStatusSchema = object({
173538
+ /**
173539
+ * True while the firmware is in low-power mode. A provider MUST avoid polling
173540
+ * during sleep — a read wakes the device and drains charge.
173541
+ */
173542
+ sleeping: boolean().meta({ label: "Sleeping" }),
173543
+ /**
173544
+ * Ms epoch of the last time the device proved it was reachable, from
173545
+ * PASSIVE signals only (a completed round-trip, an observed wake, a push).
173546
+ * Absent = never since this slice was born. The only input that separates
173547
+ * "asleep" from "gone".
173548
+ */
173549
+ lastContactAt: number$1().optional(),
173550
+ /** Ms epoch of the last observation. */
173551
+ lastUpdated: number$1().meta(readingMeta("none"))
173552
+ });
173553
+ var lowPowerSleepCapability = {
173554
+ name: "low-power-sleep",
173555
+ scope: "device",
173556
+ deviceNative: true,
173557
+ mode: "singleton",
173558
+ deviceTypes: [DeviceType.Camera],
173559
+ methods: {
173560
+ /**
173561
+ * Explicitly wake the device from low-power sleep ahead of a streaming
173562
+ * session start. Consumers that initiate a stream against a sleeping
173563
+ * camera (wake-on-play, the recorder, HomeKit, Alexa, snapshot wrappers)
173564
+ * call this with a short timeout before establishing the media pipeline —
173565
+ * the broker's own passive wake-on-dial works but adds 5–7 seconds to
173566
+ * first-frame. Pre-waking compresses that gap.
173567
+ *
173568
+ * Returns `awoke: true` when the firmware acknowledged the wake before
173569
+ * `timeoutMs`, `awoke: false` when it timed out; the caller should still
173570
+ * attempt the stream — the passive broker wake remains as fallback.
173571
+ */
173572
+ wakeUp: method(object({
173573
+ deviceId: number$1(),
173574
+ /** Bound on the wait. Sensible range 3000–10000ms. */
173575
+ timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
173576
+ }), object({
173577
+ awoke: boolean(),
173578
+ durationMs: number$1()
173579
+ }), {
173580
+ kind: "mutation",
173581
+ notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
173582
+ }) },
173583
+ status: {
173584
+ schema: LowPowerSleepStatusSchema,
173585
+ kind: "push",
173586
+ empty: {
173587
+ sleeping: false,
173588
+ lastUpdated: 0
173589
+ }
173590
+ },
173591
+ runtimeState: LowPowerSleepStatusSchema,
173592
+ /**
173593
+ * Runtime-state durability: **restored** — a sleeping camera may not report
173594
+ * for hours; the restored sleep inputs are the only thing the sleep gate and
173595
+ * the presence derivation have (the same argument as `battery`).
173596
+ */
173597
+ durability: "restored",
173598
+ /** History (D850): none — battery never recorded a sleep series either. */
173599
+ history: "none",
173600
+ volatileStateFields: ["lastUpdated"],
173601
+ vocabulary: {
173602
+ noun: t("Low-power sleep", "Sospensione a basso consumo"),
173603
+ order: 5245
173604
+ }
173605
+ };
173606
+ /**
173384
173607
  * mesh-network — collection cap for mesh-VPN providers.
173385
173608
  *
173386
173609
  * Different shape from `network-access` (public tunnels):
@@ -191178,6 +191401,27 @@ var RemoteLayoutComponentSchema = object({
191178
191401
  });
191179
191402
  });
191180
191403
  method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
191404
+ /**
191405
+ * resync — a device whose derived spec can be re-aligned on demand with its
191406
+ * upstream source (#459, Q6). Registered by the containers an integration
191407
+ * adopted; `DeviceFeature.Resyncable` (the generic Re-sync button) is derived
191408
+ * from it being bound with `resync` implemented.
191409
+ *
191410
+ * The work itself stays where it is: the owning addon's `device-adoption`
191411
+ * provider, reached through `deviceManager.adoptionResync` (which also owns
191412
+ * the "resync from zero" child purge). A provider answers this method by
191413
+ * asking for exactly that — see `resyncThroughAdoption`.
191414
+ */
191415
+ var ResyncDeviceInputSchema = object({
191416
+ deviceId: number$1().int().nonnegative(),
191417
+ /** "Resync from zero": purge the accessory children before re-deriving. */
191418
+ resetToSource: boolean().optional()
191419
+ });
191420
+ DeviceType.Container, DeviceType.Workload, DeviceType.WeatherStation, method(ResyncDeviceInputSchema, ResyncResultSchema, {
191421
+ kind: "mutation",
191422
+ auth: "admin",
191423
+ notOperatorFacing: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action"
191424
+ });
191181
191425
  var RUNNING_POWER_START_DELAY_MS = 3e4;
191182
191426
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
191183
191427
  /**
@@ -200189,6 +200433,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
200189
200433
  irTransmitter: irTransmitterCapability,
200190
200434
  lawnMowerControl: lawnMowerControlCapability,
200191
200435
  lockControl: lockControlCapability,
200436
+ lowPowerSleep: lowPowerSleepCapability,
200192
200437
  mediaPlayer: mediaPlayerCapability,
200193
200438
  meter: meterCapability,
200194
200439
  motion: motionCapability,
@@ -201668,6 +201913,19 @@ var BaseDeviceProvider = class extends BaseAddon {
201668
201913
  return toDeviceSummary(device, this.addonId);
201669
201914
  }
201670
201915
  };
201916
+ /**
201917
+ * The `low-power-sleep` slice a provider projects from the `battery` slice it
201918
+ * already keeps: the sleep inputs, nothing else. One fact, one writer — the
201919
+ * provider's battery bookkeeping stays the source until the sleep state gets
201920
+ * its own writer.
201921
+ */
201922
+ function sleepSliceOfBattery(status) {
201923
+ return {
201924
+ sleeping: status.sleeping,
201925
+ ...status.lastContactAt !== void 0 ? { lastContactAt: status.lastContactAt } : {},
201926
+ lastUpdated: status.lastUpdated
201927
+ };
201928
+ }
201671
201929
  DeviceType.HeatPump;
201672
201930
  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;
201673
201931
  new Set(Object.values(DeviceType));
@@ -201878,8 +202136,8 @@ var ALARM_MODES = [
201878
202136
  "vacation",
201879
202137
  "custom_bypass"
201880
202138
  ];
201881
- function alarmControls(state, modes, requiresCode) {
201882
- if (requiresCode) return [];
202139
+ function alarmControls(state, modes, codeRequired) {
202140
+ if (codeRequired) return [];
201883
202141
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
201884
202142
  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")));
201885
202143
  switch (state) {
@@ -201899,7 +202157,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
201899
202157
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
201900
202158
  return {
201901
202159
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
201902
- 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))],
202160
+ 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))],
201903
202161
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
201904
202162
  ...words === null ? {} : { tiles: {
201905
202163
  left: [{
@@ -205282,13 +205540,6 @@ Object.freeze({
205282
205540
  access: "view",
205283
205541
  role: "viewer"
205284
205542
  },
205285
- "battery.wakeForStream": {
205286
- capName: "battery",
205287
- capScope: "device",
205288
- addonId: null,
205289
- access: "create",
205290
- role: "viewer"
205291
- },
205292
205543
  "binary.getStatus": {
205293
205544
  capName: "binary",
205294
205545
  capScope: "device",
@@ -206815,6 +207066,13 @@ Object.freeze({
206815
207066
  access: "view",
206816
207067
  role: "admin"
206817
207068
  },
207069
+ "deviceManager.listIdentityCandidates": {
207070
+ capName: "device-manager",
207071
+ capScope: "system",
207072
+ addonId: null,
207073
+ access: "view",
207074
+ role: "admin"
207075
+ },
206818
207076
  "deviceManager.listLocationDescriptions": {
206819
207077
  capName: "device-manager",
206820
207078
  capScope: "system",
@@ -208936,6 +209194,20 @@ Object.freeze({
208936
209194
  access: "view",
208937
209195
  role: "admin"
208938
209196
  },
209197
+ "lowPowerSleep.getStatus": {
209198
+ capName: "low-power-sleep",
209199
+ capScope: "device",
209200
+ addonId: null,
209201
+ access: "view",
209202
+ role: "viewer"
209203
+ },
209204
+ "lowPowerSleep.wakeUp": {
209205
+ capName: "low-power-sleep",
209206
+ capScope: "device",
209207
+ addonId: null,
209208
+ access: "create",
209209
+ role: "viewer"
209210
+ },
208939
209211
  "mediaPlayer.channelDown": {
208940
209212
  capName: "media-player",
208941
209213
  capScope: "device",
@@ -212611,6 +212883,13 @@ Object.freeze({
212611
212883
  access: "view",
212612
212884
  role: "admin"
212613
212885
  },
212886
+ "resync.resync": {
212887
+ capName: "resync",
212888
+ capScope: "device",
212889
+ addonId: null,
212890
+ access: "create",
212891
+ role: "admin"
212892
+ },
212614
212893
  "runningState.getStatus": {
212615
212894
  capName: "running-state",
212616
212895
  capScope: "device",
@@ -215006,7 +215285,7 @@ Object.freeze({
215006
215285
  role: "admin"
215007
215286
  }
215008
215287
  });
215009
- DeviceFeature.BatteryOperated;
215288
+ DeviceFeature.Sleeps;
215010
215289
  function bound(cap, methods = [], authority = "reported") {
215011
215290
  return {
215012
215291
  kind: "cap",
@@ -215018,11 +215297,11 @@ function bound(cap, methods = [], authority = "reported") {
215018
215297
  function derived(cap, methods = []) {
215019
215298
  return bound(cap, methods, "derived");
215020
215299
  }
215021
- DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
215300
+ 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", [
215022
215301
  "startTalkSession",
215023
215302
  "pushTalkAudio",
215024
215303
  "endTalkSession"
215025
- ]), 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");
215304
+ ]), 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");
215026
215305
  var ALL_FEATURES = Object.values(DeviceFeature);
215027
215306
  new Set(ALL_FEATURES);
215028
215307
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -215370,11 +215649,6 @@ Object.freeze({
215370
215649
  form: "single",
215371
215650
  optional: false
215372
215651
  }],
215373
- "battery.wakeForStream": [{
215374
- name: "deviceId",
215375
- form: "single",
215376
- optional: false
215377
- }],
215378
215652
  "binary.getStatus": [{
215379
215653
  name: "deviceId",
215380
215654
  form: "single",
@@ -216558,6 +216832,16 @@ Object.freeze({
216558
216832
  form: "single",
216559
216833
  optional: true
216560
216834
  }],
216835
+ "lowPowerSleep.getStatus": [{
216836
+ name: "deviceId",
216837
+ form: "single",
216838
+ optional: false
216839
+ }],
216840
+ "lowPowerSleep.wakeUp": [{
216841
+ name: "deviceId",
216842
+ form: "single",
216843
+ optional: false
216844
+ }],
216561
216845
  "mediaPlayer.channelDown": [{
216562
216846
  name: "deviceId",
216563
216847
  form: "single",
@@ -217843,6 +218127,11 @@ Object.freeze({
217843
218127
  form: "single",
217844
218128
  optional: false
217845
218129
  }],
218130
+ "resync.resync": [{
218131
+ name: "deviceId",
218132
+ form: "single",
218133
+ optional: false
218134
+ }],
217846
218135
  "runningState.getStatus": [{
217847
218136
  name: "deviceId",
217848
218137
  form: "single",
@@ -227002,7 +227291,8 @@ function capDayNightModeToReolink(mode) {
227002
227291
  * `features = ['native-snapshot','rebootable']` because the `feature-probe`
227003
227292
  * slice had never been written.
227004
227293
  *
227005
- * That miss is not cosmetic. `DeviceFeature.BatteryOperated` is the gate for:
227294
+ * That miss is not cosmetic. `DeviceFeature.BatteryOperated` (and, since #459,
227295
+ * `DeviceFeature.Sleeps` beside it) is the gate for:
227006
227296
  * - the viewer's battery badge + sleeping overlay (`use-cameras.ts` FEATURE
227007
227297
  * map) — without it the camera is drawn as an ordinary awake camera;
227008
227298
  * - the snapshot wrapper's sleep gate (`snapshot.addon.ts`
@@ -227016,10 +227306,19 @@ function capDayNightModeToReolink(mode) {
227016
227306
  * clears it). This makes the DERIVED answer sticky the same way, for the
227017
227307
  * window before any probe has ever succeeded.
227018
227308
  */
227309
+ /**
227310
+ * The ONE Reolink answer to "is this a battery camera that sleeps" (#459, Q2).
227311
+ * The published features (`BatteryOperated` + `Sleeps`) and the registration
227312
+ * of the `battery` and `low-power-sleep` caps both ask it, so a camera that
227313
+ * claims `Sleeps` in the stream catalog is also one the registry can wake.
227314
+ */
227315
+ function reolinkCameraSleeps(inputs) {
227316
+ return inputs.probe.hasBattery === true || inputs.isBattery;
227317
+ }
227019
227318
  function deriveReolinkCameraFeatures(inputs) {
227020
- const { probe, isBattery } = inputs;
227319
+ const { probe } = inputs;
227021
227320
  const out = [DeviceFeature.NativeSnapshot, DeviceFeature.Rebootable];
227022
- if (probe.hasBattery === true || isBattery) out.push(DeviceFeature.BatteryOperated);
227321
+ if (reolinkCameraSleeps(inputs)) out.push(DeviceFeature.BatteryOperated, DeviceFeature.Sleeps);
227023
227322
  if (probe.hasPtz === true) out.push(DeviceFeature.PanTiltZoom);
227024
227323
  if (probe.hasAutotrack === true) out.push(DeviceFeature.PtzAutotrack);
227025
227324
  if (probe.hasIntercom === true) out.push(DeviceFeature.TwoWayAudio);
@@ -228902,7 +229201,7 @@ function applyHubChildSections(sections, snapshot) {
228902
229201
  * costs when we get them wrong.
228903
229202
  *
228904
229203
  * `→ awake` (`WAKE_HYSTERESIS_MS`): expensive if wrong. Believing an asleep
228905
- * camera is awake un-gates every background probe and makes `wakeForStream`
229204
+ * camera is awake un-gates every background probe and makes `wakeUp`
228906
229205
  * early-out without actually waking. Keep the window >= the library's UDP
228907
229206
  * inference cycle (~12 s on battery cams with idle-disconnect) and >= its
228908
229207
  * `getIdleDisconnectTimeoutMs` (30 s default).
@@ -228939,7 +229238,7 @@ function isSummarySourced(source) {
228939
229238
  * the anti-flap window does not apply to it at all.
228940
229239
  * 3. A `confirmed-wake` in the `→ awake` direction is first-hand evidence
228941
229240
  * this process produced: gating it with the anti-flap window is what
228942
- * stranded 3825's mirror on "asleep" while `wakeForStream` answered
229241
+ * stranded 3825's mirror on "asleep" while `wakeUp` answered
228943
229242
  * `awoke: true`.
228944
229243
  * 4. Everything else is subject to the asymmetric hysteresis.
228945
229244
  * 5. A summary flip toward `sleeping` is refused while a first-hand
@@ -232545,10 +232844,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232545
232844
  return effectiveProbeFlags(this.hasProbed(), super.getProbeFlags(), this.config?.get("deviceCache"));
232546
232845
  }
232547
232846
  get features() {
232548
- return deriveReolinkCameraFeatures({
232847
+ return deriveReolinkCameraFeatures(this.featureInputs());
232848
+ }
232849
+ /** What the features and the battery / sleep registration both read. */
232850
+ featureInputs() {
232851
+ return {
232549
232852
  probe: this.getProbeFlags(),
232550
232853
  isBattery: this.isBattery
232551
- });
232854
+ };
232552
232855
  }
232553
232856
  /** Lazy-connected Baichuan API. Spans the lifetime of every active stream. */
232554
232857
  api = null;
@@ -232686,7 +232989,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232686
232989
  lastProactiveWakeAt = 0;
232687
232990
  /**
232688
232991
  * Minimum gap between two proactive wakes. Demand-driven wakes
232689
- * (`wakeForStream` from the broker, `wakeIfSleeping` behind an
232992
+ * (`wakeUp` from the broker, `wakeIfSleeping` behind an
232690
232993
  * operator action, the intercom pre-wake) bypass this entirely —
232691
232994
  * the operator asked, the operator gets the camera. Only
232692
232995
  * self-initiated wakes are rate-limited, so a thumbnail cache miss
@@ -233553,7 +233856,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
233553
233856
  * (proactive config buttons such as Auto-configure email push). A
233554
233857
  * sleeping battery cam ignores Baichuan config round-trips, so clicking
233555
233858
  * "configure" would otherwise silently fail; this drives the same forced
233556
- * wake `wakeForStream` uses, then lets the caller proceed against a live
233859
+ * wake `wakeUp` uses, then lets the caller proceed against a live
233557
233860
  * camera. No-op for non-battery or already-awake cams. Best-effort:
233558
233861
  * returns whether the camera is (now) reachable/awake.
233559
233862
  */
@@ -233975,14 +234278,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
233975
234278
  */
233976
234279
  registerBatteryIfSupported() {
233977
234280
  if (this.batteryRegistered) return;
233978
- if (!this.isBattery) return;
234281
+ if (!reolinkCameraSleeps(this.featureInputs())) return;
233979
234282
  this.batteryRegistered = true;
233980
- this.ctx.registerNativeCap(batteryCapability, {
234283
+ this.ctx.registerNativeCap(batteryCapability, { getStatus: async ({ deviceId }) => {
234284
+ if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
234285
+ return this.state.battery;
234286
+ } });
234287
+ this.ctx.registerNativeCap(lowPowerSleepCapability, {
233981
234288
  getStatus: async ({ deviceId }) => {
233982
234289
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
233983
- return this.state.battery;
234290
+ return sleepSliceOfBattery(this.state.battery);
233984
234291
  },
233985
- wakeForStream: async ({ deviceId, timeoutMs }) => {
234292
+ wakeUp: async ({ deviceId, timeoutMs }) => {
233986
234293
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
233987
234294
  const startedAt = Date.now();
233988
234295
  if (!this.sleeping) return {
@@ -233999,7 +234306,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
233999
234306
  };
234000
234307
  }
234001
234308
  this.markWakeIssued();
234002
- this.ctx.logger.info("battery wakeForStream: cam sleeping — issuing wake", {
234309
+ this.ctx.logger.info("battery wakeUp: cam sleeping — issuing wake", {
234003
234310
  tags: { deviceId: this.id },
234004
234311
  meta: { timeoutMs }
234005
234312
  });
@@ -234012,7 +234319,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234012
234319
  attempts: 2
234013
234320
  });
234014
234321
  await sleep(1500);
234015
- })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
234322
+ })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeUp timeout")), timeoutMs))]);
234016
234323
  const CONFIRM_TIMEOUT_MS = 1e4;
234017
234324
  const CONFIRM_POLL_MS = 1e3;
234018
234325
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
@@ -234045,7 +234352,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234045
234352
  }
234046
234353
  const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
234047
234354
  if (observedAwake && this.commitSleepState(false, confirmSource)) {
234048
- this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
234355
+ this.ctx.logger.info("battery wakeUp: wake confirmed — driving wake transition", {
234049
234356
  tags: { deviceId: this.id },
234050
234357
  meta: {
234051
234358
  confirmMs: Date.now() - startedAt,
@@ -234054,7 +234361,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234054
234361
  });
234055
234362
  this.onWakeTransition(confirmSource).catch(() => {});
234056
234363
  } else if (!confirmed) {
234057
- this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
234364
+ this.ctx.logger.warn("battery wakeUp: ACK received but no awake evidence inside the confirm window", {
234058
234365
  tags: { deviceId: this.id },
234059
234366
  meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
234060
234367
  });
@@ -234066,7 +234373,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234066
234373
  }
234067
234374
  if (confirmed && !observedAwake && parent !== null) this.watchHubChildAwake(parent).catch(() => {});
234068
234375
  if (this.commitSleepState(false, "confirmed-wake")) {
234069
- this.ctx.logger.info("battery wakeForStream: answering awake — committing the mirror", {
234376
+ this.ctx.logger.info("battery wakeUp: answering awake — committing the mirror", {
234070
234377
  tags: { deviceId: this.id },
234071
234378
  meta: {
234072
234379
  confirmedMs: Date.now() - startedAt,
@@ -234080,7 +234387,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234080
234387
  durationMs: Date.now() - startedAt
234081
234388
  };
234082
234389
  } catch (err) {
234083
- this.ctx.logger.warn("battery wakeForStream: wake did not complete in time", {
234390
+ this.ctx.logger.warn("battery wakeUp: wake did not complete in time", {
234084
234391
  tags: { deviceId: this.id },
234085
234392
  meta: {
234086
234393
  timeoutMs,
@@ -234103,11 +234410,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234103
234410
  });
234104
234411
  this.runtimeState.subscribeCap("battery", (slice) => {
234105
234412
  if (!slice) return;
234413
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(slice));
234106
234414
  this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnStatusChanged, this.eventSource(), {
234107
234415
  deviceId: this.id,
234108
234416
  status: slice
234109
234417
  }));
234110
234418
  });
234419
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(this.state.battery));
234111
234420
  this.refreshBatteryFromApi("register");
234112
234421
  }
234113
234422
  /**
@@ -234223,7 +234532,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234223
234532
  * `PROACTIVE_WAKE_COOLDOWN_MS` ago — the caller must then serve
234224
234533
  * whatever it has cached instead of reaching for the radio.
234225
234534
  *
234226
- * Demand-driven paths never call this: `wakeForStream` (a consumer
234535
+ * Demand-driven paths never call this: `wakeUp` (a consumer
234227
234536
  * wants live video), `wakeIfSleeping` (an operator clicked
234228
234537
  * something) and the intercom pre-wake all wake unconditionally.
234229
234538
  */
@@ -234262,7 +234571,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234262
234571
  try {
234263
234572
  if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
234264
234573
  if (this.commitSleepState(false, "hub-summary")) {
234265
- this.ctx.logger.info("battery wakeForStream: hub child observed awake after the dial", { tags: { deviceId: this.id } });
234574
+ this.ctx.logger.info("battery wakeUp: hub child observed awake after the dial", { tags: { deviceId: this.id } });
234266
234575
  this.onWakeTransition("hub-summary").catch(() => {});
234267
234576
  }
234268
234577
  return;
@@ -240296,6 +240605,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240296
240605
  this.registerPtzAutotrackIfSupported();
240297
240606
  this.registerDoorbellIfSupported();
240298
240607
  this.registerIntercomIfSupported();
240608
+ this.registerBatteryIfSupported();
240299
240609
  this.ctx.logger.info("Reolink features probed + persisted", {
240300
240610
  tags: { deviceId: this.id },
240301
240611
  meta: {