@camstack/addon-provider-reolink 1.2.242 → 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
@@ -29168,7 +29168,7 @@ var require_lz4 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
29168
29168
  };
29169
29169
  }));
29170
29170
  //#endregion
29171
- //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-DBCXE3EJ.js
29171
+ //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-BQPNG2XV.js
29172
29172
  var import_fxp = require_fxp();
29173
29173
  var import_lz4 = /* @__PURE__ */ require_chunk.__toESM(require_lz4(), 1);
29174
29174
  function bcHeaderLen(messageClass, buf, bodyLen) {
@@ -31139,6 +31139,7 @@ function createDebugGateLogger(base, enabled = false) {
31139
31139
  function isTalkCmd(cmdId) {
31140
31140
  return cmdId === 10 || cmdId === 11 || cmdId === 201 || cmdId === 202;
31141
31141
  }
31142
+ var DEFAULT_LOGIN_MAX_ATTEMPTS = 3;
31142
31143
  function toWireChannelId(channelId) {
31143
31144
  return channelId & 255;
31144
31145
  }
@@ -33947,9 +33948,11 @@ var BaichuanClient = class _BaichuanClient extends events.EventEmitter {
33947
33948
  /**
33948
33949
  * Login flow: legacy "upgrade" -> receive nonce/encryption -> modern login.
33949
33950
  */
33950
- async login(maxEncryption = "full_aes") {
33951
+ async login(maxEncryption = "full_aes", options = {}) {
33951
33952
  if (this.loggedIn) return;
33952
- const maxAttempts = 3;
33953
+ const requested = options.maxAttempts ?? DEFAULT_LOGIN_MAX_ATTEMPTS;
33954
+ if (!Number.isInteger(requested) || requested < 1) throw new RangeError(`login maxAttempts must be a positive integer, got ${requested}`);
33955
+ const maxAttempts = requested;
33953
33956
  let lastError;
33954
33957
  let effectiveMaxEncryption = maxEncryption;
33955
33958
  let effectiveHostChannelId = this.hostChannelId;
@@ -43223,8 +43226,8 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
43223
43226
  this.client.setIdleDisconnect(enabled);
43224
43227
  this.logger.debug?.(`[ReolinkBaichuanApi] setIdleDisconnect: ${enabled}`);
43225
43228
  }
43226
- async login(maxEncryption) {
43227
- await this.client.login(maxEncryption);
43229
+ async login(maxEncryption, options) {
43230
+ await this.client.login(maxEncryption, options);
43228
43231
  this.applyTransportDerivedDefaults();
43229
43232
  }
43230
43233
  /**
@@ -100695,7 +100698,7 @@ function parseBaichuanWebhookObject(mess) {
100695
100698
  return parsed;
100696
100699
  }
100697
100700
  //#endregion
100698
- //#region ../types/dist/event-category-Dhcd0TRH.mjs
100701
+ //#region ../types/dist/event-category-CY27-fF0.mjs
100699
100702
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100700
100703
  EventCategory["SystemBoot"] = "system.boot";
100701
100704
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101195,7 +101198,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101195
101198
  */
101196
101199
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
101197
101200
  /**
101198
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
101201
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
101199
101202
  * "wake in progress" window — between the Baichuan wake-up issue and
101200
101203
  * the camera's first dialed-back RTP packet. The stream-broker
101201
101204
  * manager subscribes to flip the per-broker placeholder reason to
@@ -101217,6 +101220,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101217
101220
  EventCategory["RunningStarted"] = "running.started";
101218
101221
  /** Mirrors `runningStateCapability.events.onFinished`. */
101219
101222
  EventCategory["RunningFinished"] = "running.finished";
101223
+ /** Mirrors `workloadCapability.events.onStarted` — a workload reached running (#585). */
101224
+ EventCategory["WorkloadStarted"] = "workload.started";
101225
+ /** Mirrors `workloadCapability.events.onStopped` — a running workload stopped cleanly. */
101226
+ EventCategory["WorkloadStopped"] = "workload.stopped";
101227
+ /** Mirrors `workloadCapability.events.onCrashed` — a workload stopped without a request. */
101228
+ EventCategory["WorkloadCrashed"] = "workload.crashed";
101229
+ /** Mirrors `workloadCapability.events.onRecovered` — a crashed workload runs again. */
101230
+ EventCategory["WorkloadRecovered"] = "workload.recovered";
101220
101231
  /** Mirrors `deviceRunsCapability.events.onRunOpened` - a durable run record opened. */
101221
101232
  EventCategory["DeviceRunOpened"] = "device-run.opened";
101222
101233
  /** Mirrors `deviceRunsCapability.events.onRunClosed` - a durable run record closed. */
@@ -101519,7 +101530,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101519
101530
  return EventCategory;
101520
101531
  }({});
101521
101532
  //#endregion
101522
- //#region ../types/dist/composed-stable-id-RvQIEpqg.mjs
101533
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
101523
101534
  /**
101524
101535
  import { errMsg } from '@camstack/types'
101525
101536
  * Extract a human-readable message from an unknown error value.
@@ -101651,15 +101662,26 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101651
101662
  * and the storage as branches of one bus. One read-only `energy-system` cap carries
101652
101663
  * every value; the storage is a field of it, never the `battery` cap (#513, #522). */
101653
101664
  DeviceType["EnergySystem"] = "energy-system";
101665
+ /** Something that RUNS on a machine, or the machine itself (#585): a VM, an app
101666
+ * container, an LXC, an app, or a host. The kind is the ROLE (D1033, D1056), never
101667
+ * a field; one `workload` cap carries the state, the controls and the resources. */
101668
+ DeviceType["Workload"] = "workload";
101654
101669
  return DeviceType;
101655
101670
  }({});
101656
101671
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101672
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
101657
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";
101658
101680
  DeviceFeature["Rebootable"] = "rebootable";
101659
101681
  /**
101660
101682
  * Device supports an on-demand re-sync of its derived spec with its
101661
- * upstream source — drives the generic Re-sync button. The owning
101662
- * 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).
101663
101685
  */
101664
101686
  DeviceFeature["Resyncable"] = "resyncable";
101665
101687
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -101743,9 +101765,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101743
101765
  DeviceFeature["FanDirection"] = "fan-direction";
101744
101766
  /** Fan exposes an oscillation toggle. */
101745
101767
  DeviceFeature["FanOscillating"] = "fan-oscillating";
101746
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
101747
- * field on the UI lock-controls panel. */
101748
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
101749
101768
  /** Lock supports a latch-release ("open door") action distinct from
101750
101769
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
101751
101770
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -101776,8 +101795,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101776
101795
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
101777
101796
  /** Media player exposes power on / off. */
101778
101797
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
101779
- /** Alarm panel requires a PIN code on arm/disarm. */
101780
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
101781
101798
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
101782
101799
  * addition to a textual location. */
101783
101800
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -101797,15 +101814,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101797
101814
  /** Automation `trigger` accepts a skipCondition flag — fires the
101798
101815
  * automation's actions while bypassing its condition block. */
101799
101816
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
101800
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
101801
- * map tile in the vacuum UI. */
101802
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
101803
101817
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
101804
101818
  * switches group. */
101805
101819
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
101806
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
101807
- * mower map tile. */
101808
- DeviceFeature["MowerHasMap"] = "mower-has-map";
101809
101820
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101810
101821
  * spots) — gates the Mow action + map selectors. */
101811
101822
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -101871,6 +101882,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101871
101882
  * `light` type: the provider owns the type, and a light implies brightness
101872
101883
  * or colour this relay lacks. */
101873
101884
  DeviceRole["SwitchLight"] = "switch-light";
101885
+ /** One port of a network switch that powers the device behind it (PoE): on /
101886
+ * off feeds or cuts that power. Its link is `network-link`, its draw
101887
+ * `power-meter`. Restarting the powered device through the port is that
101888
+ * device's `power-source` cap, never a reboot of the port. */
101889
+ DeviceRole["PoePort"] = "poe-port";
101874
101890
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
101875
101891
  DeviceRole["ClimateAc"] = "climate-ac";
101876
101892
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -101951,6 +101967,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101951
101967
  /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
101952
101968
  * cap. A `DeviceType.Generic` device. */
101953
101969
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101970
+ /** A virtual machine on a hypervisor. */
101971
+ DeviceRole["Vm"] = "vm";
101972
+ /** An application container (Docker, Podman). */
101973
+ DeviceRole["AppContainer"] = "app-container";
101974
+ /** A system container (LXC). */
101975
+ DeviceRole["Lxc"] = "lxc";
101976
+ /** An application or service running on a host. */
101977
+ DeviceRole["App"] = "app";
101978
+ /** A machine that runs workloads or is an appliance with its own OS: a
101979
+ * server, a hypervisor, a gateway console, a CCU. */
101980
+ DeviceRole["Host"] = "host";
101954
101981
  return DeviceRole;
101955
101982
  }({});
101956
101983
  /**
@@ -102534,8 +102561,8 @@ var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
102534
102561
  function emoji() {
102535
102562
  return new RegExp(_emoji$1, "u");
102536
102563
  }
102537
- var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
102538
- var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
102564
+ var ipv4$1 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
102565
+ var ipv6$1 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
102539
102566
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
102540
102567
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
102541
102568
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
@@ -103209,12 +103236,12 @@ var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)
103209
103236
  $ZodStringFormat.init(inst, def);
103210
103237
  });
103211
103238
  var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
103212
- def.pattern ?? (def.pattern = ipv4);
103239
+ def.pattern ?? (def.pattern = ipv4$1);
103213
103240
  $ZodStringFormat.init(inst, def);
103214
103241
  inst._zod.bag.format = `ipv4`;
103215
103242
  });
103216
103243
  var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
103217
- def.pattern ?? (def.pattern = ipv6);
103244
+ def.pattern ?? (def.pattern = ipv6$1);
103218
103245
  $ZodStringFormat.init(inst, def);
103219
103246
  inst._zod.bag.format = `ipv6`;
103220
103247
  inst._zod.check = (payload) => {
@@ -106130,10 +106157,16 @@ var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
106130
106157
  $ZodIPv4.init(inst, def);
106131
106158
  ZodStringFormat.init(inst, def);
106132
106159
  });
106160
+ function ipv4(params) {
106161
+ return /* @__PURE__ */ _ipv4(ZodIPv4, params);
106162
+ }
106133
106163
  var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
106134
106164
  $ZodIPv6.init(inst, def);
106135
106165
  ZodStringFormat.init(inst, def);
106136
106166
  });
106167
+ function ipv6(params) {
106168
+ return /* @__PURE__ */ _ipv6(ZodIPv6, params);
106169
+ }
106137
106170
  var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
106138
106171
  $ZodCIDRv4.init(inst, def);
106139
106172
  ZodStringFormat.init(inst, def);
@@ -106771,7 +106804,7 @@ var ZodIssueCode = {
106771
106804
  var ZodFirstPartyTypeKind;
106772
106805
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106773
106806
  //#endregion
106774
- //#region ../types/dist/sleep-Ch7Q7UtE.mjs
106807
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
106775
106808
  /**
106776
106809
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106777
106810
  * window to float samples (D455).
@@ -111569,6 +111602,10 @@ var CAP_VOCABULARY_BY_NAME = {
111569
111602
  effect: {
111570
111603
  field: "on",
111571
111604
  value: true
111605
+ },
111606
+ offeredWhen: {
111607
+ method: "getOptions",
111608
+ field: "supportsSetState"
111572
111609
  }
111573
111610
  },
111574
111611
  {
@@ -111587,6 +111624,10 @@ var CAP_VOCABULARY_BY_NAME = {
111587
111624
  effect: {
111588
111625
  field: "on",
111589
111626
  value: false
111627
+ },
111628
+ offeredWhen: {
111629
+ method: "getOptions",
111630
+ field: "supportsSetState"
111590
111631
  }
111591
111632
  },
111592
111633
  {
@@ -111600,9 +111641,14 @@ var CAP_VOCABULARY_BY_NAME = {
111600
111641
  en: "Toggle {device}",
111601
111642
  it: "Commuta {device}"
111602
111643
  },
111603
- icon: "toggle-right"
111644
+ icon: "toggle-right",
111645
+ offeredWhen: {
111646
+ method: "getOptions",
111647
+ field: "supportsSetState"
111648
+ }
111604
111649
  }
111605
111650
  ],
111651
+ notOperatorFacing: { powerCycle: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own" },
111606
111652
  state: [{
111607
111653
  kind: "boolean",
111608
111654
  field: "on",
@@ -111861,6 +111907,47 @@ var CAP_VOCABULARY_BY_NAME = {
111861
111907
  "switch.off": { icon: "plug" }
111862
111908
  },
111863
111909
  state: { on: { icon: "plug-zap" } }
111910
+ },
111911
+ [DeviceRole.PoePort]: {
111912
+ actions: {
111913
+ "switch.on": {
111914
+ label: {
111915
+ en: "Power on",
111916
+ it: "Alimenta"
111917
+ },
111918
+ phrase: {
111919
+ en: "Power on {device}",
111920
+ it: "Alimenta {device}"
111921
+ },
111922
+ icon: "plug-zap"
111923
+ },
111924
+ "switch.off": {
111925
+ label: {
111926
+ en: "Power off",
111927
+ it: "Togli alimentazione"
111928
+ },
111929
+ phrase: {
111930
+ en: "Power off {device}",
111931
+ it: "Togli alimentazione a {device}"
111932
+ },
111933
+ icon: "unplug"
111934
+ }
111935
+ },
111936
+ state: { on: {
111937
+ label: {
111938
+ en: "Powered",
111939
+ it: "Alimentata"
111940
+ },
111941
+ whenTrue: {
111942
+ en: "When {device} is powered",
111943
+ it: "Quando {device} viene alimentata"
111944
+ },
111945
+ whenFalse: {
111946
+ en: "When {device} loses power",
111947
+ it: "Quando {device} perde l’alimentazione"
111948
+ },
111949
+ icon: "plug-zap"
111950
+ } }
111864
111951
  }
111865
111952
  }
111866
111953
  }
@@ -112580,7 +112667,11 @@ var CAP_VOCABULARY_BY_NAME = {
112580
112667
  en: "Power on {device}",
112581
112668
  it: "Dai corrente a {device}"
112582
112669
  },
112583
- icon: "power"
112670
+ icon: "power",
112671
+ offeredWhen: {
112672
+ method: "getStatus",
112673
+ field: "switchSettable"
112674
+ }
112584
112675
  },
112585
112676
  {
112586
112677
  id: "powerSource.off",
@@ -112593,7 +112684,11 @@ var CAP_VOCABULARY_BY_NAME = {
112593
112684
  en: "Cut the power of {device}",
112594
112685
  it: "Togli la corrente a {device}"
112595
112686
  },
112596
- icon: "power-off"
112687
+ icon: "power-off",
112688
+ offeredWhen: {
112689
+ method: "getStatus",
112690
+ field: "switchSettable"
112691
+ }
112597
112692
  },
112598
112693
  {
112599
112694
  id: "powerSource.forceRestart",
@@ -114363,37 +114458,66 @@ var CAP_VOCABULARY_BY_NAME = {
114363
114458
  en: "Siren",
114364
114459
  it: "Sirena"
114365
114460
  },
114366
- actions: [{
114367
- id: "siren.trigger",
114368
- method: "trigger",
114369
- label: {
114370
- en: "Sound the siren",
114371
- it: "Fai suonare la sirena"
114372
- },
114373
- phrase: {
114374
- en: "Sound {device}",
114375
- it: "Fai suonare {device}"
114376
- },
114377
- icon: "siren",
114378
- args: {}
114379
- }, {
114380
- id: "siren.stop",
114381
- method: "stop",
114382
- label: {
114383
- en: "Silence the siren",
114384
- it: "Zittisci la sirena"
114461
+ actions: [
114462
+ {
114463
+ id: "siren.trigger",
114464
+ method: "trigger",
114465
+ label: {
114466
+ en: "Sound the siren",
114467
+ it: "Fai suonare la sirena"
114468
+ },
114469
+ phrase: {
114470
+ en: "Sound {device}",
114471
+ it: "Fai suonare {device}"
114472
+ },
114473
+ icon: "siren",
114474
+ args: {}
114385
114475
  },
114386
- phrase: {
114387
- en: "Silence {device}",
114388
- it: "Zittisci {device}"
114476
+ {
114477
+ id: "siren.triggerPlays",
114478
+ method: "trigger",
114479
+ label: {
114480
+ en: "Sound the siren N times",
114481
+ it: "Fai suonare la sirena N volte"
114482
+ },
114483
+ phrase: {
114484
+ en: "Sound {device} {plays} times",
114485
+ it: "Fai suonare {device} {plays} volte"
114486
+ },
114487
+ icon: "siren",
114488
+ openArgs: [{
114489
+ key: "plays",
114490
+ label: {
114491
+ en: "Plays",
114492
+ it: "Riproduzioni"
114493
+ },
114494
+ offer: {
114495
+ kind: "dynamic",
114496
+ from: "method",
114497
+ method: "getPlayChoices",
114498
+ valueKind: "number"
114499
+ }
114500
+ }]
114389
114501
  },
114390
- icon: "siren",
114391
- args: {},
114392
- effect: {
114393
- field: "active",
114394
- value: false
114502
+ {
114503
+ id: "siren.stop",
114504
+ method: "stop",
114505
+ label: {
114506
+ en: "Silence the siren",
114507
+ it: "Zittisci la sirena"
114508
+ },
114509
+ phrase: {
114510
+ en: "Silence {device}",
114511
+ it: "Zittisci {device}"
114512
+ },
114513
+ icon: "siren",
114514
+ args: {},
114515
+ effect: {
114516
+ field: "active",
114517
+ value: false
114518
+ }
114395
114519
  }
114396
- }],
114520
+ ],
114397
114521
  state: [{
114398
114522
  kind: "boolean",
114399
114523
  field: "active",
@@ -116988,6 +117112,374 @@ var CAP_VOCABULARY_BY_NAME = {
116988
117112
  icon: "loader"
116989
117113
  }]
116990
117114
  },
117115
+ "workload": {
117116
+ scope: "device",
117117
+ noun: {
117118
+ en: "Workload",
117119
+ it: "Carico di lavoro"
117120
+ },
117121
+ actions: [
117122
+ {
117123
+ id: "workload.start",
117124
+ method: "start",
117125
+ label: {
117126
+ en: "Start",
117127
+ it: "Avvia"
117128
+ },
117129
+ phrase: {
117130
+ en: "Start {device}",
117131
+ it: "Avvia {device}"
117132
+ },
117133
+ icon: "play",
117134
+ effect: {
117135
+ field: "state",
117136
+ value: "running"
117137
+ }
117138
+ },
117139
+ {
117140
+ id: "workload.stop",
117141
+ method: "stop",
117142
+ label: {
117143
+ en: "Stop",
117144
+ it: "Arresta"
117145
+ },
117146
+ phrase: {
117147
+ en: "Stop {device}",
117148
+ it: "Arresta {device}"
117149
+ },
117150
+ icon: "square",
117151
+ effect: {
117152
+ field: "state",
117153
+ value: "stopped"
117154
+ }
117155
+ },
117156
+ {
117157
+ id: "workload.restart",
117158
+ method: "restart",
117159
+ label: {
117160
+ en: "Restart",
117161
+ it: "Riavvia"
117162
+ },
117163
+ phrase: {
117164
+ en: "Restart {device}",
117165
+ it: "Riavvia {device}"
117166
+ },
117167
+ icon: "rotate-ccw"
117168
+ },
117169
+ {
117170
+ id: "workload.pause",
117171
+ method: "pause",
117172
+ label: {
117173
+ en: "Pause",
117174
+ it: "Metti in pausa"
117175
+ },
117176
+ phrase: {
117177
+ en: "Pause {device}",
117178
+ it: "Metti in pausa {device}"
117179
+ },
117180
+ icon: "pause",
117181
+ effect: {
117182
+ field: "state",
117183
+ value: "paused"
117184
+ }
117185
+ },
117186
+ {
117187
+ id: "workload.resume",
117188
+ method: "resume",
117189
+ label: {
117190
+ en: "Resume",
117191
+ it: "Riprendi"
117192
+ },
117193
+ phrase: {
117194
+ en: "Resume {device}",
117195
+ it: "Riprendi {device}"
117196
+ },
117197
+ icon: "circle-play",
117198
+ effect: {
117199
+ field: "state",
117200
+ value: "running"
117201
+ }
117202
+ },
117203
+ {
117204
+ id: "workload.forceStop",
117205
+ method: "forceStop",
117206
+ label: {
117207
+ en: "Force stop",
117208
+ it: "Arresto forzato"
117209
+ },
117210
+ phrase: {
117211
+ en: "Force {device} to stop",
117212
+ it: "Forza l’arresto di {device}"
117213
+ },
117214
+ icon: "octagon-x",
117215
+ effect: {
117216
+ field: "state",
117217
+ value: "stopped"
117218
+ }
117219
+ }
117220
+ ],
117221
+ state: [
117222
+ {
117223
+ kind: "enum",
117224
+ field: "state",
117225
+ label: {
117226
+ en: "State",
117227
+ it: "Stato"
117228
+ },
117229
+ values: [
117230
+ {
117231
+ value: "running",
117232
+ label: {
117233
+ en: "Running",
117234
+ it: "In esecuzione"
117235
+ },
117236
+ phrase: {
117237
+ en: "When {device} is running",
117238
+ it: "Quando {device} è in esecuzione"
117239
+ }
117240
+ },
117241
+ {
117242
+ value: "paused",
117243
+ label: {
117244
+ en: "Paused",
117245
+ it: "In pausa"
117246
+ }
117247
+ },
117248
+ {
117249
+ value: "stopped",
117250
+ label: {
117251
+ en: "Stopped",
117252
+ it: "Arrestato"
117253
+ },
117254
+ phrase: {
117255
+ en: "When {device} is stopped",
117256
+ it: "Quando {device} è arrestato"
117257
+ }
117258
+ },
117259
+ {
117260
+ value: "starting",
117261
+ label: {
117262
+ en: "Starting",
117263
+ it: "In avvio"
117264
+ }
117265
+ },
117266
+ {
117267
+ value: "stopping",
117268
+ label: {
117269
+ en: "Stopping",
117270
+ it: "In arresto"
117271
+ }
117272
+ },
117273
+ {
117274
+ value: "crashed",
117275
+ label: {
117276
+ en: "Crashed",
117277
+ it: "Arrestato in modo anomalo"
117278
+ },
117279
+ phrase: {
117280
+ en: "When {device} has crashed",
117281
+ it: "Quando {device} è arrestato in modo anomalo"
117282
+ }
117283
+ }
117284
+ ],
117285
+ icon: "activity"
117286
+ },
117287
+ {
117288
+ kind: "numeric",
117289
+ field: "resources.cpuPercent",
117290
+ quantity: {
117291
+ en: "the CPU use",
117292
+ it: "l'uso della CPU"
117293
+ },
117294
+ label: {
117295
+ en: "CPU",
117296
+ it: "CPU"
117297
+ },
117298
+ unit: "%",
117299
+ icon: "cpu"
117300
+ },
117301
+ {
117302
+ kind: "numeric",
117303
+ field: "resources.memoryPercent",
117304
+ quantity: {
117305
+ en: "the memory use",
117306
+ it: "l'uso della memoria"
117307
+ },
117308
+ label: {
117309
+ en: "Memory",
117310
+ it: "Memoria"
117311
+ },
117312
+ unit: "%",
117313
+ icon: "memory-stick"
117314
+ },
117315
+ {
117316
+ kind: "numeric",
117317
+ field: "resources.temperature",
117318
+ quantity: {
117319
+ en: "the temperature",
117320
+ it: "la temperatura"
117321
+ },
117322
+ label: {
117323
+ en: "Temperature",
117324
+ it: "Temperatura"
117325
+ },
117326
+ unit: "°C",
117327
+ icon: "thermometer"
117328
+ }
117329
+ ],
117330
+ events: {
117331
+ onStarted: {
117332
+ category: EventCategory.WorkloadStarted,
117333
+ label: {
117334
+ en: "Started",
117335
+ it: "Avviato"
117336
+ },
117337
+ phrase: {
117338
+ en: "When {device} starts",
117339
+ it: "Quando {device} si avvia"
117340
+ },
117341
+ icon: "play"
117342
+ },
117343
+ onStopped: {
117344
+ category: EventCategory.WorkloadStopped,
117345
+ label: {
117346
+ en: "Stopped",
117347
+ it: "Arrestato"
117348
+ },
117349
+ phrase: {
117350
+ en: "When {device} stops",
117351
+ it: "Quando {device} si arresta"
117352
+ },
117353
+ icon: "square"
117354
+ },
117355
+ onCrashed: {
117356
+ category: EventCategory.WorkloadCrashed,
117357
+ label: {
117358
+ en: "Crashed",
117359
+ it: "Arrestato in modo anomalo"
117360
+ },
117361
+ phrase: {
117362
+ en: "When {device} stops without being asked",
117363
+ it: "Quando {device} si arresta senza che sia stato richiesto"
117364
+ },
117365
+ icon: "triangle-alert"
117366
+ },
117367
+ onRecovered: {
117368
+ category: EventCategory.WorkloadRecovered,
117369
+ label: {
117370
+ en: "Recovered",
117371
+ it: "Ripristinato"
117372
+ },
117373
+ phrase: {
117374
+ en: "When {device} runs again after a crash",
117375
+ it: "Quando {device} riparte dopo un arresto anomalo"
117376
+ },
117377
+ icon: "heart-pulse"
117378
+ }
117379
+ },
117380
+ overrides: { byRole: {
117381
+ [DeviceRole.Vm]: {
117382
+ actions: { "workload.start": { icon: "monitor" } },
117383
+ state: { state: { icon: "monitor" } }
117384
+ },
117385
+ [DeviceRole.AppContainer]: {
117386
+ actions: { "workload.start": { icon: "container" } },
117387
+ state: { state: { icon: "container" } }
117388
+ },
117389
+ [DeviceRole.Lxc]: {
117390
+ actions: { "workload.start": { icon: "box" } },
117391
+ state: { state: { icon: "box" } }
117392
+ },
117393
+ [DeviceRole.App]: {
117394
+ actions: { "workload.start": { icon: "app-window" } },
117395
+ state: { state: { icon: "app-window" } }
117396
+ },
117397
+ [DeviceRole.Host]: {
117398
+ actions: {
117399
+ "workload.start": {
117400
+ label: {
117401
+ en: "Power on",
117402
+ it: "Accendi"
117403
+ },
117404
+ phrase: {
117405
+ en: "Power on {device}",
117406
+ it: "Accendi {device}"
117407
+ },
117408
+ icon: "power"
117409
+ },
117410
+ "workload.stop": {
117411
+ label: {
117412
+ en: "Shut down",
117413
+ it: "Spegni"
117414
+ },
117415
+ phrase: {
117416
+ en: "Shut down {device}",
117417
+ it: "Spegni {device}"
117418
+ },
117419
+ icon: "power-off"
117420
+ },
117421
+ "workload.restart": {
117422
+ label: {
117423
+ en: "Reboot",
117424
+ it: "Riavvia"
117425
+ },
117426
+ phrase: {
117427
+ en: "Reboot {device}",
117428
+ it: "Riavvia {device}"
117429
+ },
117430
+ icon: "refresh-cw"
117431
+ }
117432
+ },
117433
+ state: { state: { icon: "server" } },
117434
+ events: {
117435
+ onStarted: {
117436
+ label: {
117437
+ en: "Came online",
117438
+ it: "Tornato in linea"
117439
+ },
117440
+ phrase: {
117441
+ en: "When {device} comes online",
117442
+ it: "Quando {device} torna in linea"
117443
+ },
117444
+ icon: "server"
117445
+ },
117446
+ onStopped: {
117447
+ label: {
117448
+ en: "Shut down",
117449
+ it: "Spento"
117450
+ },
117451
+ phrase: {
117452
+ en: "When {device} shuts down",
117453
+ it: "Quando {device} si spegne"
117454
+ },
117455
+ icon: "server-off"
117456
+ },
117457
+ onCrashed: {
117458
+ label: {
117459
+ en: "Went down",
117460
+ it: "Caduto"
117461
+ },
117462
+ phrase: {
117463
+ en: "When {device} goes down unexpectedly",
117464
+ it: "Quando {device} cade inaspettatamente"
117465
+ },
117466
+ icon: "server-crash"
117467
+ },
117468
+ onRecovered: {
117469
+ label: {
117470
+ en: "Came online",
117471
+ it: "Tornato in linea"
117472
+ },
117473
+ phrase: {
117474
+ en: "When {device} comes back online after going down",
117475
+ it: "Quando {device} torna in linea dopo essere caduto"
117476
+ },
117477
+ icon: "server"
117478
+ }
117479
+ }
117480
+ }
117481
+ } }
117482
+ },
116991
117483
  "accessories": {
116992
117484
  scope: "device",
116993
117485
  noun: {
@@ -117767,6 +118259,14 @@ var CAP_VOCABULARY_BY_NAME = {
117767
118259
  icon: "refresh-cw"
117768
118260
  }]
117769
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
+ },
117770
118270
  "recording": {
117771
118271
  scope: "device",
117772
118272
  noun: {
@@ -119778,7 +120278,6 @@ var CAP_VOCABULARY_BY_NAME = {
119778
120278
  en: "Battery",
119779
120279
  it: "Batteria"
119780
120280
  },
119781
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
119782
120281
  state: [
119783
120282
  {
119784
120283
  kind: "numeric",
@@ -119888,6 +120387,14 @@ var CAP_VOCABULARY_BY_NAME = {
119888
120387
  icon: "moon"
119889
120388
  }]
119890
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
+ },
119891
120398
  "network-link": {
119892
120399
  scope: "device",
119893
120400
  noun: {
@@ -120636,6 +121143,15 @@ var PipelineStepInputSchema = lazy(() => object({
120636
121143
  }));
120637
121144
  /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
120638
121145
  var PipelineRunResultBridge = custom();
121146
+ /**
121147
+ * Whether a switch can be set (D1058), schema-free so the addon runner can import it from
121148
+ * `@camstack/types/addon` without loading the capability schema graph (D28).
121149
+ */
121150
+ /** The read that decides whether a switch is offered on/off (`offeredWhen` of its actions). */
121151
+ var SWITCH_SETTABLE_GATE = {
121152
+ method: "getOptions",
121153
+ field: "supportsSetState"
121154
+ };
120639
121155
  var StaticDirOutputSchema = object({ staticDir: string() });
120640
121156
  var VersionOutputSchema = object({ version: string() });
120641
121157
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" }), NOT_A_DEVICE.UI_PLUMBING;
@@ -120784,6 +121300,7 @@ var CAP_NAMES = Object.freeze([
120784
121300
  "log-channels",
120785
121301
  "log-destination",
120786
121302
  "login-method",
121303
+ "low-power-sleep",
120787
121304
  "media-player",
120788
121305
  "mesh-network",
120789
121306
  "meter",
@@ -120837,6 +121354,7 @@ var CAP_NAMES = Object.freeze([
120837
121354
  "records",
120838
121355
  "remote",
120839
121356
  "remote-layout-components",
121357
+ "resync",
120840
121358
  "running-state",
120841
121359
  "scene-monitor",
120842
121360
  "schedulers",
@@ -120883,6 +121401,7 @@ var CAP_NAMES = Object.freeze([
120883
121401
  "weather",
120884
121402
  "weather-station",
120885
121403
  "webrtc-session",
121404
+ "workload",
120886
121405
  "zone-analytics",
120887
121406
  "zone-rules",
120888
121407
  "zones"
@@ -120939,7 +121458,7 @@ Object.freeze({
120939
121458
  ]
120940
121459
  },
120941
121460
  {
120942
- "path": "requiresCode",
121461
+ "path": "codeRequired",
120943
121462
  "valueType": "boolean"
120944
121463
  }
120945
121464
  ],
@@ -122007,7 +122526,24 @@ Object.freeze({
122007
122526
  "jammed",
122008
122527
  "door-open"
122009
122528
  ]
122529
+ }, {
122530
+ "path": "codeRequired",
122531
+ "valueType": "boolean"
122010
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
+ ],
122011
122547
  "media-player": [
122012
122548
  {
122013
122549
  "path": "state",
@@ -122185,6 +122721,14 @@ Object.freeze({
122185
122721
  "path": "ssid",
122186
122722
  "valueType": "string"
122187
122723
  },
122724
+ {
122725
+ "path": "speedKbps",
122726
+ "valueType": "number"
122727
+ },
122728
+ {
122729
+ "path": "linkUp",
122730
+ "valueType": "boolean"
122731
+ },
122188
122732
  {
122189
122733
  "path": "lastUpdated",
122190
122734
  "valueType": "number"
@@ -122581,6 +123125,14 @@ Object.freeze({
122581
123125
  "path": "durationSeconds",
122582
123126
  "valueType": "number"
122583
123127
  },
123128
+ {
123129
+ "path": "plays",
123130
+ "valueType": "number"
123131
+ },
123132
+ {
123133
+ "path": "activeUntilEstimated",
123134
+ "valueType": "boolean"
123135
+ },
122584
123136
  {
122585
123137
  "path": "lastTriggeredAt",
122586
123138
  "valueType": "number"
@@ -122983,6 +123535,92 @@ Object.freeze({
122983
123535
  "valueType": "number"
122984
123536
  }
122985
123537
  ],
123538
+ "workload": [
123539
+ {
123540
+ "path": "state",
123541
+ "valueType": "enum",
123542
+ "enumValues": [
123543
+ "running",
123544
+ "paused",
123545
+ "stopped",
123546
+ "starting",
123547
+ "stopping",
123548
+ "crashed"
123549
+ ]
123550
+ },
123551
+ {
123552
+ "path": "since",
123553
+ "valueType": "number"
123554
+ },
123555
+ {
123556
+ "path": "hostDeviceId",
123557
+ "valueType": "number"
123558
+ },
123559
+ {
123560
+ "path": "image",
123561
+ "valueType": "string"
123562
+ },
123563
+ {
123564
+ "path": "os",
123565
+ "valueType": "string"
123566
+ },
123567
+ {
123568
+ "path": "version",
123569
+ "valueType": "string"
123570
+ },
123571
+ {
123572
+ "path": "autostart",
123573
+ "valueType": "boolean"
123574
+ },
123575
+ {
123576
+ "path": "resources.cpuPercent",
123577
+ "valueType": "number"
123578
+ },
123579
+ {
123580
+ "path": "resources.memoryUsedBytes",
123581
+ "valueType": "number"
123582
+ },
123583
+ {
123584
+ "path": "resources.memoryPercent",
123585
+ "valueType": "number"
123586
+ },
123587
+ {
123588
+ "path": "resources.memoryLimitBytes",
123589
+ "valueType": "number"
123590
+ },
123591
+ {
123592
+ "path": "resources.vcpus",
123593
+ "valueType": "number"
123594
+ },
123595
+ {
123596
+ "path": "resources.diskUsedBytes",
123597
+ "valueType": "number"
123598
+ },
123599
+ {
123600
+ "path": "resources.diskTotalBytes",
123601
+ "valueType": "number"
123602
+ },
123603
+ {
123604
+ "path": "resources.netRxKbps",
123605
+ "valueType": "number"
123606
+ },
123607
+ {
123608
+ "path": "resources.netTxKbps",
123609
+ "valueType": "number"
123610
+ },
123611
+ {
123612
+ "path": "resources.load1",
123613
+ "valueType": "number"
123614
+ },
123615
+ {
123616
+ "path": "resources.temperature",
123617
+ "valueType": "number"
123618
+ },
123619
+ {
123620
+ "path": "updateAvailable",
123621
+ "valueType": "boolean"
123622
+ }
123623
+ ],
122986
123624
  "zone-analytics": [
122987
123625
  {
122988
123626
  "path": "ts",
@@ -123099,7 +123737,7 @@ function sleep(ms) {
123099
123737
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123100
123738
  }
123101
123739
  //#endregion
123102
- //#region ../types/dist/implemented-methods-C5FMXLGP.mjs
123740
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
123103
123741
  /**
123104
123742
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123105
123743
  *
@@ -124020,63 +124658,99 @@ var HelperMemberSchema = object({
124020
124658
  cap: string().min(1),
124021
124659
  fieldPath: string().min(1)
124022
124660
  });
124661
+ /** A group, a statistic, or an integral (D944). The composer runs all three. */
124662
+ var GroupHelperSpecSchema = object({
124663
+ kind: literal("group"),
124664
+ templateId: GroupTemplateIdSchema,
124665
+ aggregate: AggregateReducerSchema,
124666
+ members: array(HelperMemberSchema).min(1).max(64),
124667
+ /** Actuator groups only. Readings leave this unset. */
124668
+ active: ActiveCriterionSchema.optional()
124669
+ });
124670
+ var statisticHelperObject = object({
124671
+ kind: literal("statistic"),
124672
+ stat: _enum(STATISTIC_STATS),
124673
+ window: StatisticWindowSchema,
124674
+ source: HelperMemberSchema
124675
+ });
124676
+ var integralHelperObject = object({
124677
+ kind: literal("integral"),
124678
+ reset: _enum(RESET_PERIODS),
124679
+ output: _enum(["energy", "meter"]),
124680
+ source: HelperMemberSchema
124681
+ });
124682
+ var thresholdHelperObject = object({
124683
+ kind: literal("threshold"),
124684
+ source: HelperMemberSchema,
124685
+ high: number$1(),
124686
+ low: number$1(),
124687
+ onForMs: number$1().int().nonnegative(),
124688
+ offForMs: number$1().int().nonnegative()
124689
+ });
124690
+ var arithmeticHelperObject = object({
124691
+ kind: literal("arithmetic"),
124692
+ op: _enum([
124693
+ "sum",
124694
+ "difference",
124695
+ "ratio"
124696
+ ]),
124697
+ inputs: array(HelperMemberSchema).min(2).max(64)
124698
+ });
124699
+ var expressionHelperObject = object({
124700
+ kind: literal("expression"),
124701
+ expr: string().min(1),
124702
+ inputs: array(object({
124703
+ name: string().min(1),
124704
+ member: HelperMemberSchema
124705
+ })).min(1).max(64),
124706
+ output: _enum(["number", "boolean"])
124707
+ });
124708
+ var derivativeHelperObject = object({
124709
+ kind: literal("derivative"),
124710
+ window: RollingWindowSchema,
124711
+ per: _enum([
124712
+ "second",
124713
+ "minute",
124714
+ "hour"
124715
+ ]),
124716
+ source: HelperMemberSchema
124717
+ });
124718
+ /** The stream profiles a camera grid can publish. */
124719
+ var GRID_PROFILES = [
124720
+ "high",
124721
+ "mid",
124722
+ "low"
124723
+ ];
124724
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
124725
+ var GridRectSchema = object({
124726
+ x: number$1().min(0).max(1),
124727
+ y: number$1().min(0).max(1),
124728
+ width: number$1().gt(0).max(1),
124729
+ height: number$1().gt(0).max(1)
124730
+ });
124731
+ var GridCellSpecSchema = object({
124732
+ source: CompositionSourceRefSchema,
124733
+ region: GridRectSchema,
124734
+ cell: GridRectSchema
124735
+ });
124023
124736
  var HelperSpecSchema = discriminatedUnion("kind", [
124024
124737
  object({
124025
- kind: literal("group"),
124026
- templateId: GroupTemplateIdSchema,
124027
- aggregate: AggregateReducerSchema,
124028
- members: array(HelperMemberSchema).min(1).max(64),
124029
- /** Actuator groups only. Readings leave this unset. */
124030
- active: ActiveCriterionSchema.optional()
124738
+ kind: literal("grid"),
124739
+ fps: number$1().int().min(1).max(60),
124740
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
124741
+ cells: array(GridCellSpecSchema).max(16)
124031
124742
  }),
124032
124743
  object({
124033
- kind: literal("statistic"),
124034
- stat: _enum(STATISTIC_STATS),
124035
- window: StatisticWindowSchema,
124036
- source: HelperMemberSchema
124744
+ kind: literal("terminal"),
124745
+ terminalId: string().uuid()
124037
124746
  }),
124038
- object({
124039
- kind: literal("integral"),
124040
- reset: _enum(RESET_PERIODS),
124041
- output: _enum(["energy", "meter"]),
124042
- source: HelperMemberSchema
124043
- }),
124044
- object({
124045
- kind: literal("threshold"),
124046
- source: HelperMemberSchema,
124047
- high: number$1(),
124048
- low: number$1(),
124049
- onForMs: number$1().int().nonnegative(),
124050
- offForMs: number$1().int().nonnegative()
124051
- }),
124052
- object({
124053
- kind: literal("arithmetic"),
124054
- op: _enum([
124055
- "sum",
124056
- "difference",
124057
- "ratio"
124058
- ]),
124059
- inputs: array(HelperMemberSchema).min(2).max(64)
124060
- }),
124061
- object({
124062
- kind: literal("expression"),
124063
- expr: string().min(1),
124064
- inputs: array(object({
124065
- name: string().min(1),
124066
- member: HelperMemberSchema
124067
- })).min(1).max(64),
124068
- output: _enum(["number", "boolean"])
124069
- }),
124070
- object({
124071
- kind: literal("derivative"),
124072
- window: RollingWindowSchema,
124073
- per: _enum([
124074
- "second",
124075
- "minute",
124076
- "hour"
124077
- ]),
124078
- source: HelperMemberSchema
124079
- })
124747
+ GroupHelperSpecSchema,
124748
+ statisticHelperObject,
124749
+ integralHelperObject,
124750
+ thresholdHelperObject,
124751
+ arithmeticHelperObject,
124752
+ expressionHelperObject,
124753
+ derivativeHelperObject
124080
124754
  ]);
124081
124755
  /** Longest snippet a `code` source may carry (slice 4). */
124082
124756
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
@@ -150253,6 +150927,67 @@ object({
150253
150927
  /** Namespaces the client listed that no longer exist. */
150254
150928
  deleted: array(PreferenceNamespaceSchema)
150255
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
+ });
150256
150991
  _enum(["new-session", "step-up"]);
150257
150992
  /** The languages the hub's app landing pages are written in (D858). */
150258
150993
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -153998,9 +154733,8 @@ var airQualitySensorCapability = {
153998
154733
  * Many panels require a PIN code on arm / disarm — the optional
153999
154734
  * `code` field on the methods passes it through to the upstream
154000
154735
  * service; it's NEVER persisted in the runtime slice or any event
154001
- * payload. The presence of a required code is signalled by
154002
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
154003
- * 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).
154004
154738
  *
154005
154739
  * `availableModes` mirrors HA's `supported_features`-derived arm
154006
154740
  * mode list — the UI renders only the buttons the panel accepts.
@@ -154039,9 +154773,13 @@ var AlarmPanelStatusSchema = object({
154039
154773
  /** Subset of arm modes the panel accepts. UI renders one button per
154040
154774
  * mode in this list. */
154041
154775
  availableModes: array(AlarmArmModeSchema),
154042
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
154043
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
154044
- 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(),
154045
154783
  /** Ms epoch when the slice was last updated. */
154046
154784
  lastChangedAt: number$1()
154047
154785
  });
@@ -154098,7 +154836,7 @@ var alarmPanelCapability = {
154098
154836
  arm: method(object({
154099
154837
  deviceId: number$1().int().nonnegative(),
154100
154838
  mode: AlarmArmModeSchema,
154101
- /** Optional PIN code. Required when `requiresCode === true`.
154839
+ /** Optional PIN code. Required when `codeRequired === true`.
154102
154840
  * Passed through to the upstream service; never persisted. */
154103
154841
  code: string().min(1).optional()
154104
154842
  }), _void(), {
@@ -154215,7 +154953,7 @@ var alarmPanelCapability = {
154215
154953
  /**
154216
154954
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
154217
154955
  * full slice; renders an arm button per `availableModes` entry and
154218
- * a PIN field iff `requiresCode === true`.
154956
+ * a PIN field iff `codeRequired === true`.
154219
154957
  */
154220
154958
  runtimeState: AlarmPanelStatusSchema,
154221
154959
  /**
@@ -154226,6 +154964,13 @@ var alarmPanelCapability = {
154226
154964
  */
154227
154965
  durability: "restored",
154228
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
+ /**
154229
154974
  * History (D850): the panel's lifecycle state as an `enum` series —
154230
154975
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
154231
154976
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -155423,9 +156168,9 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
155423
156168
  auth: "admin"
155424
156169
  });
155425
156170
  /**
155426
- * Battery status snapshot. Emitted by providers whose device is
155427
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
155428
- * 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
155429
156174
  * battery" alerting on top — the cap deliberately does NOT enforce a
155430
156175
  * threshold.
155431
156176
  */
@@ -155582,47 +156327,12 @@ var batteryCapability = {
155582
156327
  deviceNative: true,
155583
156328
  mode: "singleton",
155584
156329
  deviceTypes: BATTERY_DEVICE_TYPES,
155585
- methods: {
155586
- /**
155587
- * Explicitly wake the camera from low-power sleep ahead of a
155588
- * streaming session start. Consumers that initiate a stream
155589
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
155590
- * RTCSession, snapshot wrappers) call this with a short timeout
155591
- * before establishing the media pipeline — the broker's own
155592
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
155593
- * during which the consumer renders a black screen. Pre-waking
155594
- * compresses that gap.
155595
- *
155596
- * Returns `awoke: true` when the firmware acknowledged the wake
155597
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
155598
- * the cap surface is unavailable (no Baichuan / firmware
155599
- * channel); the caller should still attempt the stream — the
155600
- * passive broker wake remains as fallback.
155601
- */
155602
- wakeForStream: method(object({
155603
- deviceId: number$1(),
155604
- /** Bound on the wait. Sensible range 3000–10000ms. */
155605
- timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
155606
- }), object({
155607
- awoke: boolean(),
155608
- durationMs: number$1()
155609
- }), {
155610
- kind: "mutation",
155611
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
155612
- }) },
155613
156330
  /**
155614
- * A composed provider (battery ADDED to a pet feeder or container that has
155615
- * no wake surface) answers `wakeForStream` with the same "unavailable"
155616
- * result the contract already defines above: "Returns `awoke: false` when
155617
- * … 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.
155618
156334
  */
155619
- composedMethods: { wakeForStream: {
155620
- kind: "answer",
155621
- value: {
155622
- awoke: false,
155623
- durationMs: 0
155624
- }
155625
- } },
156335
+ methods: {},
155626
156336
  events: {
155627
156337
  /**
155628
156338
  * Emitted whenever the cached status changes (firmware push OR
@@ -156390,9 +157100,10 @@ var GridProfileOfferSchema = object({
156390
157100
  published: boolean()
156391
157101
  });
156392
157102
  var GridLayoutViewSchema = object({
156393
- /** The persisted grid row this camera was declared from. */
156394
- instanceId: string(),
157103
+ /** The grid block (planning#580) whose camera this is. */
157104
+ blockId: string(),
156395
157105
  deviceId: number$1().int().nonnegative(),
157106
+ /** The device row's name — the only name a grid has; it is renamed on the block or the device. */
156396
157107
  name: string(),
156397
157108
  /**
156398
157109
  * NO canvas size. A grid's resolution is not authored: each profile derives
@@ -156408,7 +157119,6 @@ var GridLayoutViewSchema = object({
156408
157119
  });
156409
157120
  var GridLayoutPatchSchema = object({
156410
157121
  deviceId: number$1().int().nonnegative(),
156411
- name: string().min(1).max(160).optional(),
156412
157122
  fps: number$1().int().min(1).max(60).optional(),
156413
157123
  /** Which profiles to publish. See `GridProfileOffer.published`. */
156414
157124
  publishedProfiles: array(_enum([
@@ -160138,7 +160848,7 @@ var mediaPlayerCapability = {
160138
160848
  ]
160139
160849
  }
160140
160850
  };
160141
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, 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, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
160851
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, 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, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
160142
160852
  var NUMBER = {
160143
160853
  kind: "fixed",
160144
160854
  result: ["number"]
@@ -160588,7 +161298,7 @@ new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
160588
161298
  DeviceType.Camera;
160589
161299
  /**
160590
161300
  * The series a device card trends, per cap (`history.primary` + `history.priority`):
160591
- * 6 caps. The card shows the primary of the enabled cap with the highest priority.
161301
+ * 7 caps. The card shows the primary of the enabled cap with the highest priority.
160592
161302
  */
160593
161303
  var HISTORY_PRIMARY = {
160594
161304
  "climate-control": {
@@ -160614,6 +161324,10 @@ var HISTORY_PRIMARY = {
160614
161324
  "weather-station": {
160615
161325
  field: "temperature",
160616
161326
  priority: 60
161327
+ },
161328
+ "workload": {
161329
+ field: "resources.cpuPercent",
161330
+ priority: 40
160617
161331
  }
160618
161332
  };
160619
161333
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
@@ -160624,6 +161338,8 @@ var PowerSourceRefusalReasonSchema = _enum([
160624
161338
  "switch-unknown",
160625
161339
  "restart-in-progress",
160626
161340
  "switch-call-failed",
161341
+ "switch-options-unreadable",
161342
+ "not-settable",
160627
161343
  "switch-is-actuator"
160628
161344
  ]);
160629
161345
  var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
@@ -160640,6 +161356,14 @@ var PowerSourceInfoSchema = object({
160640
161356
  /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
160641
161357
  switchOn: boolean().nullable(),
160642
161358
  switchOnline: boolean().nullable(),
161359
+ /**
161360
+ * Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
161361
+ * without the method is a plain switch, `true`). `null` = not known: no link, the switch is
161362
+ * missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
161363
+ * withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
161364
+ * unknown keeps them (D315, D1058).
161365
+ */
161366
+ switchSettable: boolean().nullable().optional(),
160643
161367
  restartInProgress: boolean(),
160644
161368
  offSeconds: number$1().int()
160645
161369
  });
@@ -160697,6 +161421,11 @@ var powerSourceCustomize = {
160697
161421
  }]
160698
161422
  };
160699
161423
  var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
161424
+ /** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
161425
+ var POWER_SOURCE_SETTABLE_GATE = {
161426
+ method: "getStatus",
161427
+ field: "switchSettable"
161428
+ };
160700
161429
  var powerSourceCapability = {
160701
161430
  name: "power-source",
160702
161431
  scope: "device",
@@ -160711,7 +161440,8 @@ var powerSourceCapability = {
160711
161440
  id: "powerSource.on",
160712
161441
  label: t("Power on", "Dai corrente"),
160713
161442
  phrase: t("Power on {device}", "Dai corrente a {device}"),
160714
- icon: "power"
161443
+ icon: "power",
161444
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160715
161445
  }]
160716
161446
  }),
160717
161447
  powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -160721,7 +161451,8 @@ var powerSourceCapability = {
160721
161451
  id: "powerSource.off",
160722
161452
  label: t("Power off", "Togli corrente"),
160723
161453
  phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
160724
- icon: "power-off"
161454
+ icon: "power-off",
161455
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160725
161456
  }]
160726
161457
  }),
160727
161458
  forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -162434,6 +163165,268 @@ var SiteZoneSchema = object({
162434
163165
  * the ones that most want grouping. */
162435
163166
  locationKeys: array(string())
162436
163167
  });
163168
+ /**
163169
+ * Provider-declared device identifiers (D1059, planning#590).
163170
+ *
163171
+ * What a device IS, as its owning provider read it from the hardware: the keys a
163172
+ * later step matches across integrations to tell that two devices are the same
163173
+ * physical object. Separate from `DeviceMetadata` on purpose — metadata is a
163174
+ * free-form blob the operator can edit, identifiers are typed, normalised and
163175
+ * written ONLY by the provider that owns the device (`device-manager.
163176
+ * setIdentifiers`, owner-checked on the transport's caller stamp).
163177
+ *
163178
+ * | Key | Stored form | Strength |
163179
+ * | -------------- | ----------------------------------- | -------- |
163180
+ * | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
163181
+ * | `serial` | `<manufacturer>:<serial>` | strong |
163182
+ * | `machine-uuid` | SMBIOS / VM / container uuid | strong |
163183
+ * | `vendor-uid` | `<vendor>:<id>` | strong |
163184
+ * | `hostname` | lower-case, no domain | weak |
163185
+ * | `ip` | IPv4 / IPv6 | weak |
163186
+ *
163187
+ * Strength is a property of the KEY, derived by {@link identifierStrength} —
163188
+ * never stored, so it cannot drift from the table above. A weak key never links
163189
+ * two devices on its own.
163190
+ *
163191
+ * The schema refuses a value that is not in its stored form, so whatever is
163192
+ * persisted is already normalised. Build a declaration with
163193
+ * {@link normaliseIdentifiers}, which turns the raw values a driver read into
163194
+ * that form and names every value it refused.
163195
+ */
163196
+ var DEVICE_IDENTIFIER_KEYS = [
163197
+ "mac",
163198
+ "serial",
163199
+ "machine-uuid",
163200
+ "vendor-uid",
163201
+ "hostname",
163202
+ "ip"
163203
+ ];
163204
+ var DeviceIdentifierKeySchema = _enum(DEVICE_IDENTIFIER_KEYS);
163205
+ /** `read` — the provider read it from the device; `derived` — computed from something else it read. */
163206
+ var DeviceIdentifierOriginSchema = _enum(["read", "derived"]);
163207
+ var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
163208
+ /** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
163209
+ var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
163210
+ var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
163211
+ var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
163212
+ function entrySchema(value) {
163213
+ return object({
163214
+ value,
163215
+ origin: DeviceIdentifierOriginSchema,
163216
+ /** Epoch ms of the FIRST read that produced this value (and origin). A later
163217
+ * read of the same value does not move it — see {@link mergeIdentifiers}. */
163218
+ readAt: number$1().int().nonnegative()
163219
+ }).strict();
163220
+ }
163221
+ var MacEntrySchema = entrySchema(string().regex(MAC_PATTERN));
163222
+ var SerialEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163223
+ var MachineUuidEntrySchema = entrySchema(string().regex(MACHINE_UUID_PATTERN));
163224
+ var VendorUidEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163225
+ var HostnameEntrySchema = entrySchema(string().regex(HOSTNAME_PATTERN));
163226
+ var IpEntrySchema = entrySchema(union([ipv4(), ipv6()]));
163227
+ object({
163228
+ value: string().min(1),
163229
+ origin: DeviceIdentifierOriginSchema,
163230
+ readAt: number$1().int().nonnegative()
163231
+ }).strict();
163232
+ /** The typed declaration. Every key optional; `mac` the only one that holds several. */
163233
+ var DeviceIdentifiersSchema = object({
163234
+ mac: array(MacEntrySchema).min(1).readonly().optional(),
163235
+ serial: SerialEntrySchema.optional(),
163236
+ "machine-uuid": MachineUuidEntrySchema.optional(),
163237
+ "vendor-uid": VendorUidEntrySchema.optional(),
163238
+ hostname: HostnameEntrySchema.optional(),
163239
+ ip: IpEntrySchema.optional()
163240
+ }).strict();
163241
+ /** True when the declaration carries no key at all. */
163242
+ function isEmptyIdentifiers(identifiers) {
163243
+ return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
163244
+ }
163245
+ /** Values devices report when they do not know: never an identity. */
163246
+ var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
163247
+ var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
163248
+ function rejected(reason) {
163249
+ return {
163250
+ ok: false,
163251
+ reason
163252
+ };
163253
+ }
163254
+ /** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
163255
+ function normaliseMac(raw) {
163256
+ const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
163257
+ if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
163258
+ const mac = (hex.match(/../g) ?? []).join(":");
163259
+ if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
163260
+ return {
163261
+ ok: true,
163262
+ value: mac
163263
+ };
163264
+ }
163265
+ function slug$2(raw) {
163266
+ return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
163267
+ }
163268
+ function normalisePrefixed(prefixRaw, valueRaw, what) {
163269
+ const prefix = slug$2(prefixRaw);
163270
+ if (prefix.length === 0) return rejected(`no ${what}`);
163271
+ const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
163272
+ if (value.length === 0) return rejected("blank value");
163273
+ if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
163274
+ return {
163275
+ ok: true,
163276
+ value: `${prefix}:${value}`
163277
+ };
163278
+ }
163279
+ function normaliseMachineUuid(raw) {
163280
+ const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
163281
+ if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
163282
+ if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
163283
+ return {
163284
+ ok: true,
163285
+ value
163286
+ };
163287
+ }
163288
+ function isIp(value) {
163289
+ return union([ipv4(), ipv6()]).safeParse(value).success;
163290
+ }
163291
+ function normaliseHostname(raw) {
163292
+ const full = raw.trim().toLowerCase().replace(/\.$/, "");
163293
+ if (full.length === 0) return rejected("blank hostname");
163294
+ if (isIp(full)) return rejected("an address, not a hostname");
163295
+ const label = full.split(".")[0] ?? "";
163296
+ if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
163297
+ if (label === "localhost") return rejected("placeholder hostname");
163298
+ return {
163299
+ ok: true,
163300
+ value: label
163301
+ };
163302
+ }
163303
+ function normaliseIp(raw) {
163304
+ const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
163305
+ if (!isIp(value)) return rejected("not an IP address");
163306
+ if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
163307
+ return {
163308
+ ok: true,
163309
+ value
163310
+ };
163311
+ }
163312
+ function isBlank(value) {
163313
+ return value === null || value === void 0 || value.trim().length === 0;
163314
+ }
163315
+ /**
163316
+ * Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
163317
+ * with colons and de-duplicated, a hostname without its domain, an IP validated,
163318
+ * a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
163319
+ * cannot be normalised is left out and listed in `rejected` — the caller logs it
163320
+ * (with `tags: { deviceId }`), it is never dropped in silence.
163321
+ */
163322
+ function normaliseIdentifiers(raw, options = {}) {
163323
+ const readAt = options.readAt ?? Date.now();
163324
+ const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
163325
+ const entry = (key, value) => ({
163326
+ value,
163327
+ origin: originOf(key),
163328
+ readAt
163329
+ });
163330
+ const refused = [];
163331
+ const take = (key, input, result) => {
163332
+ if (result.ok) return entry(key, result.value);
163333
+ refused.push({
163334
+ key,
163335
+ value: input,
163336
+ reason: result.reason
163337
+ });
163338
+ };
163339
+ const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
163340
+ const macs = [];
163341
+ for (const input of macInputs) {
163342
+ if (isBlank(input)) continue;
163343
+ const taken = take("mac", input, normaliseMac(input));
163344
+ if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
163345
+ }
163346
+ const serial = raw.serial === null || raw.serial === void 0 || isBlank(raw.serial.serial) ? void 0 : take("serial", `${raw.serial.manufacturer}:${raw.serial.serial}`, normalisePrefixed(raw.serial.manufacturer, raw.serial.serial, "manufacturer"));
163347
+ const vendorUid = raw.vendorUid === null || raw.vendorUid === void 0 || isBlank(raw.vendorUid.id) ? void 0 : take("vendor-uid", `${raw.vendorUid.vendor}:${raw.vendorUid.id}`, normalisePrefixed(raw.vendorUid.vendor, raw.vendorUid.id, "vendor"));
163348
+ const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
163349
+ const host = isBlank(raw.host) ? null : raw.host.trim();
163350
+ const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
163351
+ const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
163352
+ const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
163353
+ const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
163354
+ const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
163355
+ return {
163356
+ identifiers: {
163357
+ ...macs.length > 0 ? { mac: macs } : {},
163358
+ ...serial !== void 0 ? { serial } : {},
163359
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
163360
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
163361
+ ...hostname !== void 0 ? { hostname } : {},
163362
+ ...ip !== void 0 ? { ip } : {}
163363
+ },
163364
+ rejected: refused
163365
+ };
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
+ })]);
162437
163430
  var DeviceSearchRequiresSchema = object({
162438
163431
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
162439
163432
  caps: array(string()).readonly().optional(),
@@ -162996,6 +163989,10 @@ var DeviceInfoSchema = object({
162996
163989
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
162997
163990
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
162998
163991
  metadata: record(string(), unknown()).nullable().optional(),
163992
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
163993
+ * the owning provider via `setIdentifiers`; read-only for the operator.
163994
+ * Absent ⇒ the provider declared none. */
163995
+ identifiers: DeviceIdentifiersSchema.optional(),
162999
163996
  /** Optional upstream-system identity + rendering envelope. See
163000
163997
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
163001
163998
  sourceInfo: SourceInfoSchema.optional(),
@@ -163147,6 +164144,8 @@ var DeviceMetaSchema = object({
163147
164144
  disabled: boolean(),
163148
164145
  parentDeviceId: number$1().nullable(),
163149
164146
  metadata: record(string(), unknown()).nullable().optional(),
164147
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
164148
+ identifiers: DeviceIdentifiersSchema.optional(),
163150
164149
  /** Optional upstream-system identity + rendering envelope. See
163151
164150
  * `SourceInfo`. Present when the device has been persisted with a
163152
164151
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -163460,6 +164459,17 @@ method(object({
163460
164459
  }), _void(), {
163461
164460
  kind: "mutation",
163462
164461
  auth: "admin"
164462
+ }), method(object({
164463
+ deviceId: number$1(),
164464
+ identifiers: DeviceIdentifiersSchema.nullable(),
164465
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
164466
+ unread: array(DeviceIdentifierKeySchema).optional()
164467
+ }), _void(), {
164468
+ kind: "mutation",
164469
+ auth: "admin"
164470
+ }), method(object({}), IdentityCandidatesSchema, {
164471
+ kind: "query",
164472
+ auth: "admin"
163463
164473
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
163464
164474
  kind: "mutation",
163465
164475
  auth: "admin"
@@ -168657,8 +169667,8 @@ var HeroSceneSchema = object({
168657
169667
  /** 0..1: volume, cover position, cycle progress. */
168658
169668
  level: number$1().min(0).max(1).nullable()
168659
169669
  });
168660
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, 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;
168661
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
169670
+ DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Fan, 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;
169671
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
168662
169672
  var HeroRowIdSchema = _enum([
168663
169673
  "progress",
168664
169674
  "run-for",
@@ -168887,8 +169897,12 @@ var HeroPowerSupplySlotSchema = object({
168887
169897
  /** Off asks for a confirmation while the device runs. */
168888
169898
  confirmOffWhileRunning: boolean(),
168889
169899
  running: boolean().nullable(),
168890
- powerOn: HeroActionSchema,
168891
- powerOff: HeroActionSchema,
169900
+ /**
169901
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
169902
+ * API key): power on / off would always be refused. The restart stays (D1058).
169903
+ */
169904
+ powerOn: HeroActionSchema.nullable(),
169905
+ powerOff: HeroActionSchema.nullable(),
168892
169906
  restart: HeroActionSchema
168893
169907
  });
168894
169908
  var HeroStateBackdropSchema = object({
@@ -172028,6 +173042,13 @@ var LockControlStatusSchema = object({
172028
173042
  "jammed",
172029
173043
  "door-open"
172030
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(),
172031
173052
  /** Ms epoch when the slice was last updated. */
172032
173053
  lastChangedAt: number$1()
172033
173054
  });
@@ -172507,6 +173528,90 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
172507
173528
  ]);
172508
173529
  method(_void(), array(LoginMethodContributionSchema).readonly()), NOT_A_DEVICE.IDENTITY;
172509
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
+ /**
172510
173615
  * mesh-network — collection cap for mesh-VPN providers.
172511
173616
  *
172512
173617
  * Different shape from `network-access` (public tunnels):
@@ -179648,6 +180753,19 @@ var NetworkLinkStatusSchema = object({
179648
180753
  rssi: number$1().optional().meta(readingMeta("signal-level")),
179649
180754
  /** Network name of a wireless link, when the firmware reports it. */
179650
180755
  ssid: string().optional(),
180756
+ /**
180757
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
180758
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
180759
+ * `null` = the port is down or the speed is not known; absent = the provider
180760
+ * never reports one.
180761
+ */
180762
+ speedKbps: number$1().nonnegative().nullable().optional().meta(readingMeta("bitrate")),
180763
+ /**
180764
+ * Whether the link is up. `type` names the medium, not its state, so a wired
180765
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
180766
+ * absent = the provider never reports it.
180767
+ */
180768
+ linkUp: boolean().nullable().optional(),
179651
180769
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
179652
180770
  lastUpdated: number$1().meta(readingMeta("none"))
179653
180771
  });
@@ -181852,7 +182970,32 @@ var NcRuleInputSchema = object({
181852
182970
  * authored before this field meant. An editor turns it off by writing
181853
182971
  * `false`, so it needs no `clear` key.
181854
182972
  */
181855
- askVerdict: boolean().optional()
182973
+ askVerdict: boolean().optional(),
182974
+ /**
182975
+ * Operator tags (D1054), kept on the rule like a core block's. Absent = no
182976
+ * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
182977
+ * does not name `tags` keeps the stored ones (the store merges), and an
182978
+ * editor empties them by sending `[]` (the store drops an empty list).
182979
+ * Renamed or removed fleet-wide only through the `tags` cap, which writes
182980
+ * here with `setRuleTags`.
182981
+ */
182982
+ tags: TagsFieldSchema.optional()
182983
+ });
182984
+ /**
182985
+ * The rule kinds that carry tags (D1054) — each one its own store. Every kind
182986
+ * labels its rules the same way; this names which store a tag write goes to.
182987
+ */
182988
+ var NcTaggedRuleKindSchema = _enum([
182989
+ "event",
182990
+ "summary",
182991
+ "timelapse",
182992
+ "calendar-events"
182993
+ ]);
182994
+ /** One rule's tags, as the `tags` cap reads them across every kind. */
182995
+ var NcRuleTagsEntrySchema = object({
182996
+ kind: NcTaggedRuleKindSchema,
182997
+ ruleId: string(),
182998
+ tags: array(string())
181856
182999
  });
181857
183000
  /**
181858
183001
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -182869,6 +184012,16 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
182869
184012
  }), object({ success: literal(true) }), {
182870
184013
  kind: "mutation",
182871
184014
  auth: "admin"
184015
+ }), method(object({}), object({ rules: array(NcRuleTagsEntrySchema) }), {
184016
+ kind: "query",
184017
+ auth: "admin"
184018
+ }), method(object({
184019
+ kind: NcTaggedRuleKindSchema,
184020
+ ruleId: string(),
184021
+ tags: TagsFieldSchema
184022
+ }), object({ success: literal(true) }), {
184023
+ kind: "mutation",
184024
+ auth: "admin"
182872
184025
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
182873
184026
  deviceId: number$1().int(),
182874
184027
  muted: boolean()
@@ -188872,7 +190025,18 @@ var videoclipsCapability = {
188872
190025
  * older than this field keeps working unchanged (D382 — an unstated
188873
190026
  * ask is zero).
188874
190027
  */
188875
- audio: ClipStreamAudioSchema.optional()
190028
+ audio: ClipStreamAudioSchema.optional(),
190029
+ /**
190030
+ * The operator's authorisation to wake a sleeping camera for this
190031
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
190032
+ * — the default — means a sleeping standalone battery camera is
190033
+ * REFUSED by name before any URL is minted. A caller sets it only
190034
+ * when a viewer itself asked for the clip (the broker's `playClip`);
190035
+ * a prefetch, a reconcile or a retry never does. With it, the
190036
+ * provider wakes the camera and waits under a bound; a camera that
190037
+ * does not come up is refused `wake-timeout`, naming the wait.
190038
+ */
190039
+ wake: ClipWakeSchema.optional()
188876
190040
  }), ClipStreamDialSchema, {
188877
190041
  kind: "query",
188878
190042
  auth: "protected"
@@ -189176,7 +190340,8 @@ _enum([
189176
190340
  "camera-refused",
189177
190341
  "fetch-failed",
189178
190342
  "too-large-to-transfer",
189179
- "wake-expired"
190343
+ "wake-expired",
190344
+ "wake-timeout"
189180
190345
  ]);
189181
190346
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
189182
190347
  function clipExportFailure(code, detail) {
@@ -190244,6 +191409,27 @@ var RemoteLayoutComponentSchema = object({
190244
191409
  });
190245
191410
  });
190246
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
+ });
190247
191433
  var RUNNING_POWER_START_DELAY_MS = 3e4;
190248
191434
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
190249
191435
  /**
@@ -191436,6 +192622,16 @@ var SirenOptionsSchema = object({
191436
192622
  rangeSeconds: SirenDurationRangeSchema.nullable(),
191437
192623
  /** The camera's default duration, seconds. */
191438
192624
  defaultSeconds: number$1().positive(),
192625
+ /**
192626
+ * Discrete play counts the operator may pick; `null` when the camera gives a
192627
+ * range or does not count plays. Defaults to `null` so a provider that
192628
+ * predates plays (#589) reads as declaring none.
192629
+ */
192630
+ allowedPlays: array(number$1().int().positive()).nullable().default(null),
192631
+ /** Continuous range of play counts; `null` when listed or not counted. */
192632
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
192633
+ /** The camera's default play count; `null` when the camera does not count plays. */
192634
+ defaultPlays: number$1().int().positive().nullable().default(null),
191439
192635
  /** What the camera counts natively. */
191440
192636
  unit: _enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
191441
192637
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -191452,9 +192648,28 @@ var SirenStatusSchema = object({
191452
192648
  activeUntil: number$1().nullable(),
191453
192649
  /** Duration of the current / last activation, seconds; `null` when none yet. */
191454
192650
  durationSeconds: number$1().nullable(),
192651
+ /**
192652
+ * The play count of the current / last activation when it was asked in plays;
192653
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
192654
+ */
192655
+ plays: number$1().int().positive().nullable().default(null),
192656
+ /**
192657
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
192658
+ * not report — the siren may fall silent somewhat earlier or later.
192659
+ */
192660
+ activeUntilEstimated: boolean().default(false),
191455
192661
  /** Ms epoch of the last trigger (0 = never). */
191456
192662
  lastTriggeredAt: number$1()
191457
192663
  });
192664
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
192665
+ var SirenTriggerInputSchema = object({
192666
+ deviceId: number$1().int().nonnegative(),
192667
+ durationSeconds: number$1().positive().optional(),
192668
+ plays: number$1().int().positive().optional()
192669
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
192670
+ message: "a siren trigger takes durationSeconds or plays, not both",
192671
+ path: ["plays"]
192672
+ });
191458
192673
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
191459
192674
  /** Ms epoch of the last successful camera read of the options (0 = never). */
191460
192675
  lastFetchedAt: number$1() });
@@ -191471,13 +192686,20 @@ var sirenCapability = {
191471
192686
  auth: "protected"
191472
192687
  }),
191473
192688
  /**
191474
- * Sound the siren. Without `durationSeconds` the camera default applies.
191475
- * Answers the state at the moment of the trigger (`activeUntil` included).
192689
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
192690
+ * its range spelled out. Empty for a siren that counts seconds.
191476
192691
  */
191477
- trigger: method(object({
191478
- deviceId: number$1().int().nonnegative(),
191479
- durationSeconds: number$1().positive().optional()
191480
- }), SirenStatusSchema, {
192692
+ getPlayChoices: method(object({ deviceId: number$1().int().nonnegative() }), array(number$1().int().positive()), {
192693
+ kind: "query",
192694
+ auth: "protected"
192695
+ }),
192696
+ /**
192697
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
192698
+ * neither the camera default applies. A count on a siren that declares no
192699
+ * plays is refused. Answers the state at the moment of the trigger
192700
+ * (`activeUntil` included).
192701
+ */
192702
+ trigger: method(SirenTriggerInputSchema, SirenStatusSchema, {
191481
192703
  kind: "mutation",
191482
192704
  auth: "protected",
191483
192705
  actions: [{
@@ -191486,6 +192708,21 @@ var sirenCapability = {
191486
192708
  phrase: t("Sound {device}", "Fai suonare {device}"),
191487
192709
  icon: "siren",
191488
192710
  args: {}
192711
+ }, {
192712
+ id: "siren.triggerPlays",
192713
+ label: t("Sound the siren N times", "Fai suonare la sirena N volte"),
192714
+ phrase: t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
192715
+ icon: "siren",
192716
+ openArgs: [{
192717
+ key: "plays",
192718
+ label: t("Plays", "Riproduzioni"),
192719
+ offer: {
192720
+ kind: "dynamic",
192721
+ from: "method",
192722
+ method: "getPlayChoices",
192723
+ valueKind: "number"
192724
+ }
192725
+ }]
191489
192726
  }]
191490
192727
  }),
191491
192728
  /** Silence the siren now. */
@@ -192776,6 +194013,27 @@ var SwitchStatusSchema = object({
192776
194013
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
192777
194014
  lastChangedAt: number$1()
192778
194015
  });
194016
+ /**
194017
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
194018
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
194019
+ *
194020
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
194021
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
194022
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
194023
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
194024
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
194025
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
194026
+ * read that failed or is pending changes nothing (D315).
194027
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
194028
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
194029
+ * `power-source.forceRestart` uses it instead of off / wait / on.
194030
+ */
194031
+ var SwitchOptionsSchema = object({
194032
+ supportsSetState: boolean().default(true),
194033
+ supportsPowerCycle: boolean().default(false)
194034
+ });
194035
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
194036
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
192779
194037
  var switchCapability = {
192780
194038
  name: "switch",
192781
194039
  scope: "device",
@@ -192803,7 +194061,8 @@ var switchCapability = {
192803
194061
  field: "on",
192804
194062
  value: true
192805
194063
  },
192806
- args: { on: true }
194064
+ args: { on: true },
194065
+ offeredWhen: SWITCH_SETTABLE_GATE
192807
194066
  }, {
192808
194067
  id: "switch.off",
192809
194068
  label: t("Turn off", "Spegni"),
@@ -192813,9 +194072,16 @@ var switchCapability = {
192813
194072
  field: "on",
192814
194073
  value: false
192815
194074
  },
192816
- args: { on: false }
194075
+ args: { on: false },
194076
+ offeredWhen: SWITCH_SETTABLE_GATE
192817
194077
  }]
192818
194078
  }),
194079
+ getOptions: optionalMethod(object({ deviceId: number$1() }), SwitchOptionsSchema, { auth: "protected" }),
194080
+ powerCycle: optionalMethod(object({ deviceId: number$1() }), _void(), {
194081
+ kind: "mutation",
194082
+ auth: "protected",
194083
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
194084
+ }),
192819
194085
  toggle: optionalMethod(object({ deviceId: number$1() }), _void(), {
192820
194086
  kind: "mutation",
192821
194087
  auth: "protected",
@@ -192823,7 +194089,8 @@ var switchCapability = {
192823
194089
  id: "switch.toggle",
192824
194090
  label: t("Toggle", "Commuta"),
192825
194091
  phrase: t("Toggle {device}", "Commuta {device}"),
192826
- icon: "toggle-right"
194092
+ icon: "toggle-right",
194093
+ offeredWhen: SWITCH_SETTABLE_GATE
192827
194094
  }]
192828
194095
  })
192829
194096
  },
@@ -192845,6 +194112,16 @@ var switchCapability = {
192845
194112
  * not need to re-query the provider after a setState mutation.
192846
194113
  */
192847
194114
  runtimeState: SwitchStatusSchema,
194115
+ composedMethods: {
194116
+ getOptions: {
194117
+ kind: "answer",
194118
+ value: SWITCH_DEFAULT_OPTIONS
194119
+ },
194120
+ powerCycle: {
194121
+ kind: "refuse",
194122
+ reason: "a composed switch has no native power cycle"
194123
+ }
194124
+ },
192848
194125
  /**
192849
194126
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
192850
194127
  *
@@ -193018,6 +194295,26 @@ var switchCapability = {
193018
194295
  "switch.off": { icon: "plug" }
193019
194296
  },
193020
194297
  state: { on: { icon: "plug-zap" } }
194298
+ },
194299
+ [DeviceRole.PoePort]: {
194300
+ actions: {
194301
+ "switch.on": {
194302
+ label: t("Power on", "Alimenta"),
194303
+ phrase: t("Power on {device}", "Alimenta {device}"),
194304
+ icon: "plug-zap"
194305
+ },
194306
+ "switch.off": {
194307
+ label: t("Power off", "Togli alimentazione"),
194308
+ phrase: t("Power off {device}", "Togli alimentazione a {device}"),
194309
+ icon: "unplug"
194310
+ }
194311
+ },
194312
+ state: { on: {
194313
+ label: t("Powered", "Alimentata"),
194314
+ whenTrue: t("When {device} is powered", "Quando {device} viene alimentata"),
194315
+ whenFalse: t("When {device} loses power", "Quando {device} perde l’alimentazione"),
194316
+ icon: "plug-zap"
194317
+ } }
193021
194318
  }
193022
194319
  }
193023
194320
  }
@@ -193607,10 +194904,11 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
193607
194904
  /**
193608
194905
  * tags — the registry of tag STYLES and the one place that renames or removes a
193609
194906
  * tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
193610
- * labels (a core block, a scheduler, a template, an action, a device); only its
194907
+ * labels (a core block, a scheduler, a template, an action, a device, a
194908
+ * notification rule); only its
193611
194909
  * colour token and icon are registered here. Provided by the core-blocks builtin,
193612
- * the one place that knows every owner kind; devices are reached through
193613
- * `deviceManager` over `ctx.api`.
194910
+ * the one place that knows every owner kind; devices and notification rules
194911
+ * are reached through `deviceManager` / `notificationRules` over `ctx.api`.
193614
194912
  *
193615
194913
  * Tags compare trimmed and case-insensitively. `list` is the union of styled tags
193616
194914
  * and tags in use; a tag with no style answers a colour derived from its name and
@@ -193621,7 +194919,21 @@ var TagUsageCountsSchema = object({
193621
194919
  schedulers: number$1().int().nonnegative(),
193622
194920
  templates: number$1().int().nonnegative(),
193623
194921
  actions: number$1().int().nonnegative(),
193624
- devices: number$1().int().nonnegative()
194922
+ devices: number$1().int().nonnegative(),
194923
+ notificationRules: number$1().int().nonnegative()
194924
+ });
194925
+ /**
194926
+ * The counts `list` answers. An owner that could not be read (a forked addon
194927
+ * that is down, redeploying or not installed) is `null` — unknown, never `0`
194928
+ * (D393) — and `list` still answers with the other owners' tags.
194929
+ */
194930
+ var TagListCountsSchema = object({
194931
+ coreBlocks: number$1().int().nonnegative().nullable(),
194932
+ schedulers: number$1().int().nonnegative().nullable(),
194933
+ templates: number$1().int().nonnegative().nullable(),
194934
+ actions: number$1().int().nonnegative().nullable(),
194935
+ devices: number$1().int().nonnegative().nullable(),
194936
+ notificationRules: number$1().int().nonnegative().nullable()
193625
194937
  });
193626
194938
  var TagEntrySchema = object({
193627
194939
  name: TagNameSchema,
@@ -193629,7 +194941,8 @@ var TagEntrySchema = object({
193629
194941
  icon: IconKeySchema,
193630
194942
  /** `false` when the operator never chose a style: colour and icon are the derived defaults. */
193631
194943
  styled: boolean(),
193632
- counts: TagUsageCountsSchema
194944
+ /** Per owner kind; `null` = that owner could not be read on this call. */
194945
+ counts: TagListCountsSchema
193633
194946
  });
193634
194947
  method(object({}), array(TagEntrySchema), { auth: "protected" }), method(object({
193635
194948
  name: TagNameSchema,
@@ -194170,7 +195483,6 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
194170
195483
  });
194171
195484
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
194172
195485
  var ProfileSettingsSchemaBridge = unknown().nullable();
194173
- var ProfileSettingsBagSchema = record(string(), unknown());
194174
195486
  /**
194175
195487
  * A live terminal session hosted by the provider addon. Output and input do
194176
195488
  * NOT flow through the capability — they use the addon data plane
@@ -194189,7 +195501,11 @@ var TerminalSessionInfoSchema = object({
194189
195501
  cols: number$1().int().positive(),
194190
195502
  rows: number$1().int().positive(),
194191
195503
  /** ms-epoch the session's pty was spawned. */
194192
- startedAt: number$1()
195504
+ startedAt: number$1(),
195505
+ /** User id of the admin who opened it; `unattributed` when the caller was not passed. */
195506
+ openedBy: string().optional(),
195507
+ /** ms-epoch of the last pty input or output — what the idle timeout measures. */
195508
+ lastActivityAt: number$1().optional()
194193
195509
  });
194194
195510
  /**
194195
195511
  * A profile the operator may open — a pre-declared, allowlisted program
@@ -194209,39 +195525,6 @@ var TerminalProfileInfoSchema = object({
194209
195525
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
194210
195526
  settingsSchema: ProfileSettingsSchemaBridge.optional()
194211
195527
  });
194212
- /**
194213
- * A durable operator-created Terminal instance. Profiles are templates; only
194214
- * an instance declares a camera.
194215
- */
194216
- var TerminalInstanceInfoSchema = object({
194217
- instanceId: string(),
194218
- cameraStableId: string(),
194219
- nodeId: string(),
194220
- /**
194221
- * False while the node the instance is bound to is not in the cluster
194222
- * topology (forgotten, renamed, re-paired). The instance is kept; the
194223
- * operator re-points it on the Terminal page.
194224
- */
194225
- nodeInCluster: boolean(),
194226
- profileId: string(),
194227
- profileLabel: string(),
194228
- name: string(),
194229
- enabled: boolean(),
194230
- executable: string(),
194231
- args: array(string()).readonly(),
194232
- cwd: string(),
194233
- environment: array(string()).readonly(),
194234
- profileSettings: ProfileSettingsBagSchema
194235
- });
194236
- var TerminalLegacyCameraSchema = object({
194237
- stableId: string(),
194238
- nodeId: string(),
194239
- profileId: string(),
194240
- profileLabel: string(),
194241
- name: string(),
194242
- /** Only legacy monitor cameras can retain their historic stable identity. */
194243
- adoptable: boolean()
194244
- });
194245
195528
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
194246
195529
  seq: number$1().int().positive(),
194247
195530
  kind: literal("data"),
@@ -194269,13 +195552,7 @@ var TerminalOutputBatchSchema = object({
194269
195552
  snapshot: string().optional(),
194270
195553
  events: array(TerminalOutputEventSchema).readonly()
194271
195554
  });
194272
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
194273
- stableId: string().min(1),
194274
- name: string().trim().min(1).max(160).optional()
194275
- }), TerminalInstanceInfoSchema, {
194276
- kind: "mutation",
194277
- auth: "admin"
194278
- }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
195555
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
194279
195556
  profileId: string(),
194280
195557
  cols: number$1().int().positive(),
194281
195558
  rows: number$1().int().positive(),
@@ -196993,6 +198270,427 @@ DeviceType.Camera, method(object({ deviceId: number$1().int().nonnegative() }),
196993
198270
  deviceId: number$1().int().nonnegative(),
196994
198271
  sessionId: string()
196995
198272
  }), WebrtcSessionDebugSchema, { kind: "query" });
198273
+ var WorkloadStateSchema = _enum([
198274
+ "running",
198275
+ "paused",
198276
+ "stopped",
198277
+ "starting",
198278
+ "stopping",
198279
+ "crashed"
198280
+ ]);
198281
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
198282
+ var WORKLOAD_ROLES = [
198283
+ DeviceRole.Vm,
198284
+ DeviceRole.AppContainer,
198285
+ DeviceRole.Lxc,
198286
+ DeviceRole.App,
198287
+ DeviceRole.Host
198288
+ ];
198289
+ /**
198290
+ * What the workload uses. Every value is `null` when not reported (D393). A host
198291
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
198292
+ */
198293
+ var WorkloadResourcesSchema = object({
198294
+ /** CPU use, percent of the CPUs it may use (0–100). */
198295
+ cpuPercent: number$1().nullable().meta(readingMeta("percentage", { precision: 1 })),
198296
+ memoryUsedBytes: number$1().nullable().meta(readingMeta("information")),
198297
+ /**
198298
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
198299
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
198300
+ */
198301
+ memoryPercent: number$1().nullable().optional().meta(readingMeta("percentage", { precision: 1 })),
198302
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
198303
+ memoryLimitBytes: number$1().nullable().meta(readingMeta("information")),
198304
+ vcpus: number$1().nullable().meta(readingMeta("count")),
198305
+ diskUsedBytes: number$1().nullable().meta(readingMeta("information")),
198306
+ diskTotalBytes: number$1().nullable().meta(readingMeta("information")),
198307
+ /** Network received, kbit/s. */
198308
+ netRxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198309
+ /** Network sent, kbit/s. */
198310
+ netTxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198311
+ /** One-minute load average (a host). */
198312
+ load1: number$1().nullable().meta(readingMeta("index", { precision: 2 })),
198313
+ /** CPU / board temperature (a host). */
198314
+ temperature: number$1().nullable().meta(readingMeta("temperature", { precision: 1 }))
198315
+ });
198316
+ var WorkloadPortProtocolSchema = _enum(["tcp", "udp"]);
198317
+ /** One published port: the workload's own port and where the host exposes it. */
198318
+ var WorkloadPortSchema = object({
198319
+ port: number$1().int().meta(readingMeta("none")),
198320
+ /** The host port it is published on; null = not published. */
198321
+ hostPort: number$1().int().nullable().meta(readingMeta("none")),
198322
+ /** The host address it is bound to; null = every address. */
198323
+ hostIp: string().nullable(),
198324
+ protocol: WorkloadPortProtocolSchema
198325
+ });
198326
+ var WorkloadStatusSchema = object({
198327
+ /** null = unknown, never stopped (D393). */
198328
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
198329
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
198330
+ since: number$1().nullable().meta(readingMeta("none")),
198331
+ /** The `host` device this runs on, when the provider has adopted it. */
198332
+ hostDeviceId: number$1().int().nullable().meta(readingMeta("device")),
198333
+ /** The image a container runs (`nginx:1.27`). */
198334
+ image: string().nullable(),
198335
+ /** The operating system (a VM, an LXC, a host). */
198336
+ os: string().nullable(),
198337
+ /** The version or firmware it runs. */
198338
+ version: string().nullable(),
198339
+ /** Starts with its host; null when the platform does not say. */
198340
+ autostart: boolean().nullable(),
198341
+ resources: WorkloadResourcesSchema,
198342
+ ports: array(WorkloadPortSchema),
198343
+ /** The addresses it is reachable on (IPs or host names). */
198344
+ addresses: array(string()),
198345
+ /** A newer image / version exists. Installing it stays the `update` cap. */
198346
+ updateAvailable: boolean().nullable(),
198347
+ lastFetchedAt: number$1()
198348
+ });
198349
+ /**
198350
+ * What this device can do, probed by its provider (D14 honesty): a flag is
198351
+ * `true` only when the platform really serves it for THIS device.
198352
+ */
198353
+ var WorkloadOptionsSchema = object({
198354
+ supportsStart: boolean(),
198355
+ supportsStop: boolean(),
198356
+ supportsRestart: boolean(),
198357
+ /** Pause AND resume. */
198358
+ supportsPause: boolean(),
198359
+ supportsForceStop: boolean(),
198360
+ hasResources: boolean(),
198361
+ hasPorts: boolean(),
198362
+ hasAddresses: boolean(),
198363
+ hasAutostart: boolean(),
198364
+ hasUpdateCheck: boolean()
198365
+ });
198366
+ var WorkloadDeviceInputSchema = object({ deviceId: number$1().int().nonnegative() });
198367
+ var WorkloadTransitionEventDataSchema = object({
198368
+ deviceId: number$1(),
198369
+ state: WorkloadStateSchema,
198370
+ previous: WorkloadStateSchema,
198371
+ since: number$1().nullable()
198372
+ });
198373
+ EventCategory.WorkloadStarted, EventCategory.WorkloadStopped, EventCategory.WorkloadCrashed, EventCategory.WorkloadRecovered;
198374
+ var workloadCapability = {
198375
+ name: "workload",
198376
+ scope: "device",
198377
+ deviceNative: true,
198378
+ mode: "singleton",
198379
+ deviceTypes: [DeviceType.Workload],
198380
+ deviceRoles: { [DeviceType.Workload]: WORKLOAD_ROLES },
198381
+ /**
198382
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
198383
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
198384
+ * second on/off state. A device whose provider serves no start / stop gets no
198385
+ * switch.
198386
+ */
198387
+ power: {
198388
+ kind: "methods",
198389
+ field: "state",
198390
+ offValues: ["stopped", "crashed"],
198391
+ on: "start",
198392
+ off: "stop"
198393
+ },
198394
+ methods: {
198395
+ start: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198396
+ kind: "mutation",
198397
+ auth: "protected",
198398
+ actions: [{
198399
+ id: "workload.start",
198400
+ label: t("Start", "Avvia"),
198401
+ phrase: t("Start {device}", "Avvia {device}"),
198402
+ icon: "play",
198403
+ effect: {
198404
+ field: "state",
198405
+ value: "running"
198406
+ }
198407
+ }]
198408
+ }),
198409
+ stop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198410
+ kind: "mutation",
198411
+ auth: "protected",
198412
+ actions: [{
198413
+ id: "workload.stop",
198414
+ label: t("Stop", "Arresta"),
198415
+ phrase: t("Stop {device}", "Arresta {device}"),
198416
+ icon: "square",
198417
+ effect: {
198418
+ field: "state",
198419
+ value: "stopped"
198420
+ }
198421
+ }]
198422
+ }),
198423
+ restart: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198424
+ kind: "mutation",
198425
+ auth: "protected",
198426
+ actions: [{
198427
+ id: "workload.restart",
198428
+ label: t("Restart", "Riavvia"),
198429
+ phrase: t("Restart {device}", "Riavvia {device}"),
198430
+ icon: "rotate-ccw"
198431
+ }]
198432
+ }),
198433
+ pause: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198434
+ kind: "mutation",
198435
+ auth: "protected",
198436
+ actions: [{
198437
+ id: "workload.pause",
198438
+ label: t("Pause", "Metti in pausa"),
198439
+ phrase: t("Pause {device}", "Metti in pausa {device}"),
198440
+ icon: "pause",
198441
+ effect: {
198442
+ field: "state",
198443
+ value: "paused"
198444
+ }
198445
+ }]
198446
+ }),
198447
+ resume: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198448
+ kind: "mutation",
198449
+ auth: "protected",
198450
+ actions: [{
198451
+ id: "workload.resume",
198452
+ label: t("Resume", "Riprendi"),
198453
+ phrase: t("Resume {device}", "Riprendi {device}"),
198454
+ icon: "circle-play",
198455
+ effect: {
198456
+ field: "state",
198457
+ value: "running"
198458
+ }
198459
+ }]
198460
+ }),
198461
+ forceStop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198462
+ kind: "mutation",
198463
+ auth: "admin",
198464
+ actions: [{
198465
+ id: "workload.forceStop",
198466
+ label: t("Force stop", "Arresto forzato"),
198467
+ phrase: t("Force {device} to stop", "Forza l’arresto di {device}"),
198468
+ icon: "octagon-x",
198469
+ effect: {
198470
+ field: "state",
198471
+ value: "stopped"
198472
+ }
198473
+ }]
198474
+ }),
198475
+ /** What THIS device can do, probed — the UI is derived from it. */
198476
+ getOptions: method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
198477
+ },
198478
+ events: {
198479
+ onStarted: {
198480
+ data: WorkloadTransitionEventDataSchema,
198481
+ trigger: {
198482
+ category: EventCategory.WorkloadStarted,
198483
+ label: t("Started", "Avviato"),
198484
+ phrase: t("When {device} starts", "Quando {device} si avvia"),
198485
+ icon: "play"
198486
+ }
198487
+ },
198488
+ onStopped: {
198489
+ data: WorkloadTransitionEventDataSchema,
198490
+ trigger: {
198491
+ category: EventCategory.WorkloadStopped,
198492
+ label: t("Stopped", "Arrestato"),
198493
+ phrase: t("When {device} stops", "Quando {device} si arresta"),
198494
+ icon: "square"
198495
+ }
198496
+ },
198497
+ onCrashed: {
198498
+ data: WorkloadTransitionEventDataSchema,
198499
+ trigger: {
198500
+ category: EventCategory.WorkloadCrashed,
198501
+ label: t("Crashed", "Arrestato in modo anomalo"),
198502
+ phrase: t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
198503
+ icon: "triangle-alert"
198504
+ }
198505
+ },
198506
+ onRecovered: {
198507
+ data: WorkloadTransitionEventDataSchema,
198508
+ trigger: {
198509
+ category: EventCategory.WorkloadRecovered,
198510
+ label: t("Recovered", "Ripristinato"),
198511
+ phrase: t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
198512
+ icon: "heart-pulse"
198513
+ }
198514
+ }
198515
+ },
198516
+ status: {
198517
+ schema: WorkloadStatusSchema,
198518
+ kind: "poll"
198519
+ },
198520
+ runtimeState: WorkloadStatusSchema,
198521
+ /**
198522
+ * Runtime-state durability: **session** — the provider answers on its next
198523
+ * poll; the series are recorded, so a restart that clears the slice loses
198524
+ * nothing a reader needs. The events are judged from the first state seen.
198525
+ */
198526
+ durability: "session",
198527
+ /**
198528
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
198529
+ * the charts need no per-metric child device.
198530
+ */
198531
+ history: {
198532
+ primary: "resources.cpuPercent",
198533
+ priority: 40,
198534
+ fields: {
198535
+ state: { kind: "enum" },
198536
+ "resources.cpuPercent": {
198537
+ kind: "gauge",
198538
+ unit: "%",
198539
+ deadband: 2,
198540
+ displayName: "CPU"
198541
+ },
198542
+ "resources.memoryUsedBytes": {
198543
+ kind: "gauge",
198544
+ unit: "bytes",
198545
+ displayName: "Memory used"
198546
+ },
198547
+ "resources.memoryPercent": {
198548
+ kind: "gauge",
198549
+ unit: "%",
198550
+ deadband: 2,
198551
+ displayName: "Memory"
198552
+ },
198553
+ "resources.netRxKbps": {
198554
+ group: "network",
198555
+ kind: "gauge",
198556
+ unit: "kbps",
198557
+ displayName: "Network received"
198558
+ },
198559
+ "resources.netTxKbps": {
198560
+ group: "network",
198561
+ kind: "gauge",
198562
+ unit: "kbps",
198563
+ displayName: "Network sent"
198564
+ }
198565
+ }
198566
+ },
198567
+ volatileStateFields: ["lastFetchedAt"],
198568
+ vocabulary: {
198569
+ noun: t("Workload", "Carico di lavoro"),
198570
+ order: 2400,
198571
+ state: [
198572
+ {
198573
+ kind: "enum",
198574
+ field: "state",
198575
+ label: t("State", "Stato"),
198576
+ values: [
198577
+ {
198578
+ value: "running",
198579
+ label: t("Running", "In esecuzione"),
198580
+ phrase: t("When {device} is running", "Quando {device} è in esecuzione")
198581
+ },
198582
+ {
198583
+ value: "paused",
198584
+ label: t("Paused", "In pausa")
198585
+ },
198586
+ {
198587
+ value: "stopped",
198588
+ label: t("Stopped", "Arrestato"),
198589
+ phrase: t("When {device} is stopped", "Quando {device} è arrestato")
198590
+ },
198591
+ {
198592
+ value: "starting",
198593
+ label: t("Starting", "In avvio")
198594
+ },
198595
+ {
198596
+ value: "stopping",
198597
+ label: t("Stopping", "In arresto")
198598
+ },
198599
+ {
198600
+ value: "crashed",
198601
+ label: t("Crashed", "Arrestato in modo anomalo"),
198602
+ phrase: t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
198603
+ }
198604
+ ],
198605
+ icon: "activity"
198606
+ },
198607
+ {
198608
+ kind: "numeric",
198609
+ field: "resources.cpuPercent",
198610
+ quantity: t("the CPU use", "l'uso della CPU"),
198611
+ label: t("CPU", "CPU"),
198612
+ unit: "%",
198613
+ icon: "cpu"
198614
+ },
198615
+ {
198616
+ kind: "numeric",
198617
+ field: "resources.memoryPercent",
198618
+ quantity: t("the memory use", "l'uso della memoria"),
198619
+ label: t("Memory", "Memoria"),
198620
+ unit: "%",
198621
+ icon: "memory-stick"
198622
+ },
198623
+ {
198624
+ kind: "numeric",
198625
+ field: "resources.temperature",
198626
+ quantity: t("the temperature", "la temperatura"),
198627
+ label: t("Temperature", "Temperatura"),
198628
+ unit: "°C",
198629
+ icon: "thermometer"
198630
+ }
198631
+ ],
198632
+ overrides: { byRole: {
198633
+ [DeviceRole.Vm]: {
198634
+ actions: { "workload.start": { icon: "monitor" } },
198635
+ state: { state: { icon: "monitor" } }
198636
+ },
198637
+ [DeviceRole.AppContainer]: {
198638
+ actions: { "workload.start": { icon: "container" } },
198639
+ state: { state: { icon: "container" } }
198640
+ },
198641
+ [DeviceRole.Lxc]: {
198642
+ actions: { "workload.start": { icon: "box" } },
198643
+ state: { state: { icon: "box" } }
198644
+ },
198645
+ [DeviceRole.App]: {
198646
+ actions: { "workload.start": { icon: "app-window" } },
198647
+ state: { state: { icon: "app-window" } }
198648
+ },
198649
+ [DeviceRole.Host]: {
198650
+ actions: {
198651
+ "workload.start": {
198652
+ label: t("Power on", "Accendi"),
198653
+ phrase: t("Power on {device}", "Accendi {device}"),
198654
+ icon: "power"
198655
+ },
198656
+ "workload.stop": {
198657
+ label: t("Shut down", "Spegni"),
198658
+ phrase: t("Shut down {device}", "Spegni {device}"),
198659
+ icon: "power-off"
198660
+ },
198661
+ "workload.restart": {
198662
+ label: t("Reboot", "Riavvia"),
198663
+ phrase: t("Reboot {device}", "Riavvia {device}"),
198664
+ icon: "refresh-cw"
198665
+ }
198666
+ },
198667
+ state: { state: { icon: "server" } },
198668
+ events: {
198669
+ onStarted: {
198670
+ label: t("Came online", "Tornato in linea"),
198671
+ phrase: t("When {device} comes online", "Quando {device} torna in linea"),
198672
+ icon: "server"
198673
+ },
198674
+ onStopped: {
198675
+ label: t("Shut down", "Spento"),
198676
+ phrase: t("When {device} shuts down", "Quando {device} si spegne"),
198677
+ icon: "server-off"
198678
+ },
198679
+ onCrashed: {
198680
+ label: t("Went down", "Caduto"),
198681
+ phrase: t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
198682
+ icon: "server-crash"
198683
+ },
198684
+ onRecovered: {
198685
+ label: t("Came online", "Tornato in linea"),
198686
+ phrase: t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
198687
+ icon: "server"
198688
+ }
198689
+ }
198690
+ }
198691
+ } }
198692
+ }
198693
+ };
196996
198694
  /**
196997
198695
  * Per-zone occupancy aggregation produced by the analytics frame
196998
198696
  * processor on every inference result. Covers the full combinatorial
@@ -197613,34 +199311,36 @@ var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_K
197613
199311
  * Pure duration maths for the `siren` cap, shared by every provider so a
197614
199312
  * trigger and the countdown it publishes mean the same thing everywhere.
197615
199313
  */
199314
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
199315
+ var MAX_PLAY_CHOICES = 200;
197616
199316
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
197617
199317
  function sirenIdleStatus(previous) {
197618
199318
  return {
197619
199319
  active: false,
197620
199320
  activeUntil: null,
197621
199321
  durationSeconds: previous?.durationSeconds ?? null,
199322
+ plays: previous?.plays ?? null,
199323
+ activeUntilEstimated: false,
197622
199324
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
197623
199325
  };
197624
199326
  }
197625
- /** The state right after a timed trigger: sounding until `now + seconds`. */
197626
- function sirenTriggeredStatus(nowMs, seconds) {
199327
+ /**
199328
+ * The state right after a timed trigger: sounding until `now + seconds`. A
199329
+ * trigger asked in plays passes its count, and whether that end is an estimate.
199330
+ */
199331
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
197627
199332
  return {
197628
199333
  active: true,
197629
199334
  activeUntil: nowMs + Math.round(seconds * 1e3),
197630
199335
  durationSeconds: seconds,
199336
+ plays: activation?.plays ?? null,
199337
+ activeUntilEstimated: activation?.estimated ?? false,
197631
199338
  lastTriggeredAt: nowMs
197632
199339
  };
197633
199340
  }
197634
- /**
197635
- * The duration a trigger will really use: the request (or the camera default)
197636
- * snapped to what the camera allows — the nearest listed value, or clamped and
197637
- * stepped inside the range. Never longer or shorter than the camera can play.
197638
- */
197639
- function resolveSirenSeconds(options, requested) {
197640
- const wanted = requested ?? options.defaultSeconds;
197641
- const list = options.allowedSeconds;
199341
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
199342
+ function snap(list, range, wanted) {
197642
199343
  if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
197643
- const range = options.rangeSeconds;
197644
199344
  if (range !== null) {
197645
199345
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
197646
199346
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -197649,6 +199349,60 @@ function resolveSirenSeconds(options, requested) {
197649
199349
  return wanted;
197650
199350
  }
197651
199351
  /**
199352
+ * The duration a trigger will really use: the request (or the camera default)
199353
+ * snapped to what the camera allows — the nearest listed value, or clamped and
199354
+ * stepped inside the range. Never longer or shorter than the camera can play.
199355
+ */
199356
+ function resolveSirenSeconds(options, requested) {
199357
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
199358
+ }
199359
+ /**
199360
+ * The play count a trigger will really use, snapped like the seconds; `null`
199361
+ * when the camera declares no plays (it counts seconds).
199362
+ */
199363
+ function resolveSirenPlays(options, requested) {
199364
+ if (options.defaultPlays === null) return null;
199365
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
199366
+ }
199367
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
199368
+ function sirenPlayChoices(options) {
199369
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
199370
+ const range = options.rangePlays;
199371
+ if (range === null) return [];
199372
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
199373
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
199374
+ }
199375
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
199376
+ function playsEndIsEstimate(options) {
199377
+ return options.source !== SirenOptionsSource.Camera;
199378
+ }
199379
+ /**
199380
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
199381
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
199382
+ * snapping. Never both — the input schema refuses that before it gets here.
199383
+ */
199384
+ function planSirenTrigger(options, request) {
199385
+ if (request.plays !== void 0) {
199386
+ const plays = resolveSirenPlays(options, request.plays);
199387
+ if (plays === null) return {
199388
+ asked: "refused",
199389
+ reason: "this siren counts seconds, not plays"
199390
+ };
199391
+ const factor = options.secondsPerPlay;
199392
+ return {
199393
+ asked: "plays",
199394
+ plays,
199395
+ seconds: factor === null ? null : plays * factor,
199396
+ estimated: factor === null || playsEndIsEstimate(options)
199397
+ };
199398
+ }
199399
+ return {
199400
+ asked: "seconds",
199401
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
199402
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
199403
+ };
199404
+ }
199405
+ /**
197652
199406
  * Day-of-week names in the cap's index order (0 = Monday), for messages
197653
199407
  * an operator reads and for Hikvision's `<DayOfWeek>` element.
197654
199408
  */
@@ -198687,6 +200441,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
198687
200441
  irTransmitter: irTransmitterCapability,
198688
200442
  lawnMowerControl: lawnMowerControlCapability,
198689
200443
  lockControl: lockControlCapability,
200444
+ lowPowerSleep: lowPowerSleepCapability,
198690
200445
  mediaPlayer: mediaPlayerCapability,
198691
200446
  meter: meterCapability,
198692
200447
  motion: motionCapability,
@@ -198727,11 +200482,65 @@ var DEVICE_LOCAL_STATE_CAPS = {
198727
200482
  waterHeater: waterHeaterCapability,
198728
200483
  weather: weatherCapability,
198729
200484
  weatherStation: weatherStationCapability,
200485
+ workload: workloadCapability,
198730
200486
  zoneAnalytics: zoneAnalyticsCapability,
198731
200487
  zoneRules: zoneRulesCapability,
198732
200488
  zones: zonesCapability
198733
200489
  };
198734
200490
  /**
200491
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
200492
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
200493
+ * read keeps what was stored) — pass everything the provider read in one call.
200494
+ */
200495
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
200496
+ const { deviceId, logger, writer } = deps;
200497
+ const { unread, ...normaliseOptions } = options;
200498
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
200499
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
200500
+ tags: { deviceId },
200501
+ meta: {
200502
+ key: r.key,
200503
+ value: r.value,
200504
+ reason: r.reason
200505
+ }
200506
+ });
200507
+ const unreadKinds = new Set(unread ?? []);
200508
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
200509
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
200510
+ return {
200511
+ outcome: "nothing-to-declare",
200512
+ identifiers
200513
+ };
200514
+ }
200515
+ if (writer === void 0) {
200516
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
200517
+ return {
200518
+ outcome: "unavailable",
200519
+ identifiers
200520
+ };
200521
+ }
200522
+ try {
200523
+ await writer.mutate({
200524
+ deviceId,
200525
+ identifiers,
200526
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
200527
+ });
200528
+ return {
200529
+ outcome: "declared",
200530
+ identifiers
200531
+ };
200532
+ } catch (err) {
200533
+ logger.warn("identifiers not declared — setIdentifiers failed", {
200534
+ tags: { deviceId },
200535
+ meta: { error: errMsg$3(err) }
200536
+ });
200537
+ return {
200538
+ outcome: "failed",
200539
+ identifiers
200540
+ };
200541
+ }
200542
+ }
200543
+ /**
198735
200544
  * The edge between two readings, or `null` for no edge.
198736
200545
  *
198737
200546
  * - `null`/cold → `true` is a START (a fault already open at boot is one);
@@ -198783,6 +200592,8 @@ var BaseDevice = class {
198783
200592
  id;
198784
200593
  stableId;
198785
200594
  type;
200595
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
200596
+ statusIsExternal;
198786
200597
  name;
198787
200598
  parentDeviceId;
198788
200599
  role;
@@ -198931,21 +200742,26 @@ var BaseDevice = class {
198931
200742
  };
198932
200743
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
198933
200744
  ctx.bindRuntimeState?.(this.runtimeState);
198934
- ctx.registerNativeCap?.(deviceStatusCapability, {});
198935
- const seed = {
198936
- online: true,
198937
- lastChangedAt: Date.now()
198938
- };
198939
- this.runtimeState.setCapState("device-status", seed);
198940
- ctx.registerNativeCap?.(featureProbeCapability, {});
198941
- this.runtimeState.setCapState("feature-probe", {
198942
- flags: {},
198943
- deviceType: null,
198944
- model: null,
198945
- channelCount: null,
198946
- lastProbedAt: 0,
198947
- lastFetchedAt: 0
198948
- });
200745
+ this.statusIsExternal = options.deviceStatus === "external";
200746
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
200747
+ if (!this.statusIsExternal) {
200748
+ const seed = {
200749
+ online: true,
200750
+ lastChangedAt: Date.now()
200751
+ };
200752
+ this.runtimeState.setCapState("device-status", seed);
200753
+ }
200754
+ if (!this.statusIsExternal) {
200755
+ ctx.registerNativeCap?.(featureProbeCapability, {});
200756
+ this.runtimeState.setCapState("feature-probe", {
200757
+ flags: {},
200758
+ deviceType: null,
200759
+ model: null,
200760
+ channelCount: null,
200761
+ lastProbedAt: 0,
200762
+ lastFetchedAt: 0
200763
+ });
200764
+ }
198949
200765
  }
198950
200766
  deviceActions = /* @__PURE__ */ new Map();
198951
200767
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -198973,7 +200789,7 @@ var BaseDevice = class {
198973
200789
  * override to gate side effects on the transition.
198974
200790
  */
198975
200791
  markOnline(online) {
198976
- if (this.online === online) return;
200792
+ if (this.statusIsExternal || this.online === online) return;
198977
200793
  const next = {
198978
200794
  online,
198979
200795
  lastChangedAt: Date.now()
@@ -199043,6 +200859,24 @@ var BaseDevice = class {
199043
200859
  }));
199044
200860
  }
199045
200861
  /**
200862
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
200863
+ * machine uuid, hostname, IP — what a later step matches across integrations.
200864
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
200865
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
200866
+ * only from the provider that owns this device. Each kind it carries replaces
200867
+ * the stored one and each kind it lacks is removed — except the kinds listed in
200868
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
200869
+ * everything read in one call; a call where every kind is unread writes
200870
+ * nothing. Best-effort: never throws.
200871
+ */
200872
+ async declareIdentifiers(raw, options) {
200873
+ return declareDeviceIdentifiers({
200874
+ deviceId: this.id,
200875
+ logger: this.ctx.logger,
200876
+ writer: this.ctx.api.deviceManager?.setIdentifiers
200877
+ }, raw, options);
200878
+ }
200879
+ /**
199046
200880
  * Re-publish the device's current `features` array to the persisted
199047
200881
  * meta blob. Drivers call this after a probe finishes when the live
199048
200882
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -199247,6 +201081,7 @@ var BaseDevice = class {
199247
201081
  * `lastProbedAt`) once their probe actually succeeds.
199248
201082
  */
199249
201083
  async onProbe() {
201084
+ if (this.statusIsExternal) return;
199250
201085
  const base = this.runtimeState.getCapState("feature-probe") ?? {
199251
201086
  flags: {},
199252
201087
  deviceType: null,
@@ -200086,8 +201921,21 @@ var BaseDeviceProvider = class extends BaseAddon {
200086
201921
  return toDeviceSummary(device, this.addonId);
200087
201922
  }
200088
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
+ }
200089
201937
  DeviceType.HeatPump;
200090
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, 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;
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;
200091
201939
  new Set(Object.values(DeviceType));
200092
201940
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
200093
201941
  function contribution(cap, schema, build) {
@@ -200296,8 +202144,8 @@ var ALARM_MODES = [
200296
202144
  "vacation",
200297
202145
  "custom_bypass"
200298
202146
  ];
200299
- function alarmControls(state, modes, requiresCode) {
200300
- if (requiresCode) return [];
202147
+ function alarmControls(state, modes, codeRequired) {
202148
+ if (codeRequired) return [];
200301
202149
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
200302
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")));
200303
202151
  switch (state) {
@@ -200317,7 +202165,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
200317
202165
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
200318
202166
  return {
200319
202167
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
200320
- 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))],
200321
202169
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
200322
202170
  ...words === null ? {} : { tiles: {
200323
202171
  left: [{
@@ -202143,7 +203991,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
202143
203991
  ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
202144
203992
  ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
202145
203993
  ];
202146
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, 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;
203994
+ DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Fan, 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;
202147
203995
  /**
202148
203996
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
202149
203997
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -202787,8 +204635,8 @@ lookOf({
202787
204635
  standby: MUTED
202788
204636
  });
202789
204637
  DeviceType.Climate;
202790
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, 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;
202791
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
204638
+ DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Fan, 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;
204639
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
202792
204640
  Object.freeze({
202793
204641
  "accessories.getStatus": {
202794
204642
  capName: "accessories",
@@ -203700,13 +205548,6 @@ Object.freeze({
203700
205548
  access: "view",
203701
205549
  role: "viewer"
203702
205550
  },
203703
- "battery.wakeForStream": {
203704
- capName: "battery",
203705
- capScope: "device",
203706
- addonId: null,
203707
- access: "create",
203708
- role: "viewer"
203709
- },
203710
205551
  "binary.getStatus": {
203711
205552
  capName: "binary",
203712
205553
  capScope: "device",
@@ -205233,6 +207074,13 @@ Object.freeze({
205233
207074
  access: "view",
205234
207075
  role: "admin"
205235
207076
  },
207077
+ "deviceManager.listIdentityCandidates": {
207078
+ capName: "device-manager",
207079
+ capScope: "system",
207080
+ addonId: null,
207081
+ access: "view",
207082
+ role: "admin"
207083
+ },
205236
207084
  "deviceManager.listLocationDescriptions": {
205237
207085
  capName: "device-manager",
205238
207086
  capScope: "system",
@@ -205450,6 +207298,13 @@ Object.freeze({
205450
207298
  access: "create",
205451
207299
  role: "admin"
205452
207300
  },
207301
+ "deviceManager.setIdentifiers": {
207302
+ capName: "device-manager",
207303
+ capScope: "system",
207304
+ addonId: null,
207305
+ access: "create",
207306
+ role: "admin"
207307
+ },
205453
207308
  "deviceManager.setIntegrationId": {
205454
207309
  capName: "device-manager",
205455
207310
  capScope: "system",
@@ -207347,6 +209202,20 @@ Object.freeze({
207347
209202
  access: "view",
207348
209203
  role: "admin"
207349
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
+ },
207350
209219
  "mediaPlayer.channelDown": {
207351
209220
  capName: "media-player",
207352
209221
  capScope: "device",
@@ -208334,6 +210203,13 @@ Object.freeze({
208334
210203
  access: "view",
208335
210204
  role: "admin"
208336
210205
  },
210206
+ "notificationRules.listRuleTags": {
210207
+ capName: "notification-rules",
210208
+ capScope: "system",
210209
+ addonId: null,
210210
+ access: "view",
210211
+ role: "admin"
210212
+ },
208337
210213
  "notificationRules.listSnoozes": {
208338
210214
  capName: "notification-rules",
208339
210215
  capScope: "system",
@@ -208390,6 +210266,13 @@ Object.freeze({
208390
210266
  access: "create",
208391
210267
  role: "admin"
208392
210268
  },
210269
+ "notificationRules.setRuleTags": {
210270
+ capName: "notification-rules",
210271
+ capScope: "system",
210272
+ addonId: null,
210273
+ access: "create",
210274
+ role: "admin"
210275
+ },
208393
210276
  "notificationRules.testRule": {
208394
210277
  capName: "notification-rules",
208395
210278
  capScope: "system",
@@ -211008,6 +212891,13 @@ Object.freeze({
211008
212891
  access: "view",
211009
212892
  role: "admin"
211010
212893
  },
212894
+ "resync.resync": {
212895
+ capName: "resync",
212896
+ capScope: "device",
212897
+ addonId: null,
212898
+ access: "create",
212899
+ role: "admin"
212900
+ },
211011
212901
  "runningState.getStatus": {
211012
212902
  capName: "running-state",
211013
212903
  capScope: "device",
@@ -211358,6 +213248,13 @@ Object.freeze({
211358
213248
  access: "view",
211359
213249
  role: "viewer"
211360
213250
  },
213251
+ "siren.getPlayChoices": {
213252
+ capName: "siren",
213253
+ capScope: "device",
213254
+ addonId: null,
213255
+ access: "view",
213256
+ role: "viewer"
213257
+ },
211361
213258
  "siren.getStatus": {
211362
213259
  capName: "siren",
211363
213260
  capScope: "device",
@@ -212170,6 +214067,13 @@ Object.freeze({
212170
214067
  access: "view",
212171
214068
  role: "viewer"
212172
214069
  },
214070
+ "switch.getOptions": {
214071
+ capName: "switch",
214072
+ capScope: "device",
214073
+ addonId: null,
214074
+ access: "view",
214075
+ role: "viewer"
214076
+ },
212173
214077
  "switch.getStatus": {
212174
214078
  capName: "switch",
212175
214079
  capScope: "device",
@@ -212177,6 +214081,13 @@ Object.freeze({
212177
214081
  access: "view",
212178
214082
  role: "viewer"
212179
214083
  },
214084
+ "switch.powerCycle": {
214085
+ capName: "switch",
214086
+ capScope: "device",
214087
+ addonId: null,
214088
+ access: "create",
214089
+ role: "viewer"
214090
+ },
212180
214091
  "switch.setState": {
212181
214092
  capName: "switch",
212182
214093
  capScope: "device",
@@ -212380,13 +214291,6 @@ Object.freeze({
212380
214291
  access: "create",
212381
214292
  role: "admin"
212382
214293
  },
212383
- "terminalSession.adoptLegacyMonitor": {
212384
- capName: "terminal-session",
212385
- capScope: "system",
212386
- addonId: null,
212387
- access: "create",
212388
- role: "admin"
212389
- },
212390
214294
  "terminalSession.close": {
212391
214295
  capName: "terminal-session",
212392
214296
  capScope: "system",
@@ -212394,13 +214298,6 @@ Object.freeze({
212394
214298
  access: "create",
212395
214299
  role: "admin"
212396
214300
  },
212397
- "terminalSession.listLegacyCameras": {
212398
- capName: "terminal-session",
212399
- capScope: "system",
212400
- addonId: null,
212401
- access: "view",
212402
- role: "admin"
212403
- },
212404
214301
  "terminalSession.listProfiles": {
212405
214302
  capName: "terminal-session",
212406
214303
  capScope: "system",
@@ -213262,6 +215159,62 @@ Object.freeze({
213262
215159
  access: "view",
213263
215160
  role: "viewer"
213264
215161
  },
215162
+ "workload.forceStop": {
215163
+ capName: "workload",
215164
+ capScope: "device",
215165
+ addonId: null,
215166
+ access: "create",
215167
+ role: "admin"
215168
+ },
215169
+ "workload.getOptions": {
215170
+ capName: "workload",
215171
+ capScope: "device",
215172
+ addonId: null,
215173
+ access: "view",
215174
+ role: "viewer"
215175
+ },
215176
+ "workload.getStatus": {
215177
+ capName: "workload",
215178
+ capScope: "device",
215179
+ addonId: null,
215180
+ access: "view",
215181
+ role: "viewer"
215182
+ },
215183
+ "workload.pause": {
215184
+ capName: "workload",
215185
+ capScope: "device",
215186
+ addonId: null,
215187
+ access: "create",
215188
+ role: "viewer"
215189
+ },
215190
+ "workload.restart": {
215191
+ capName: "workload",
215192
+ capScope: "device",
215193
+ addonId: null,
215194
+ access: "create",
215195
+ role: "viewer"
215196
+ },
215197
+ "workload.resume": {
215198
+ capName: "workload",
215199
+ capScope: "device",
215200
+ addonId: null,
215201
+ access: "create",
215202
+ role: "viewer"
215203
+ },
215204
+ "workload.start": {
215205
+ capName: "workload",
215206
+ capScope: "device",
215207
+ addonId: null,
215208
+ access: "create",
215209
+ role: "viewer"
215210
+ },
215211
+ "workload.stop": {
215212
+ capName: "workload",
215213
+ capScope: "device",
215214
+ addonId: null,
215215
+ access: "create",
215216
+ role: "viewer"
215217
+ },
213265
215218
  "zoneAnalytics.getCameraHistory": {
213266
215219
  capName: "zone-analytics",
213267
215220
  capScope: "device",
@@ -213340,7 +215293,7 @@ Object.freeze({
213340
215293
  role: "admin"
213341
215294
  }
213342
215295
  });
213343
- DeviceFeature.BatteryOperated;
215296
+ DeviceFeature.Sleeps;
213344
215297
  function bound(cap, methods = [], authority = "reported") {
213345
215298
  return {
213346
215299
  kind: "cap",
@@ -213352,11 +215305,11 @@ function bound(cap, methods = [], authority = "reported") {
213352
215305
  function derived(cap, methods = []) {
213353
215306
  return bound(cap, methods, "derived");
213354
215307
  }
213355
- 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", [
213356
215309
  "startTalkSession",
213357
215310
  "pushTalkAudio",
213358
215311
  "endTalkSession"
213359
- ]), 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");
213360
215313
  var ALL_FEATURES = Object.values(DeviceFeature);
213361
215314
  new Set(ALL_FEATURES);
213362
215315
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -213398,8 +215351,8 @@ function offered(received) {
213398
215351
  };
213399
215352
  }
213400
215353
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
213401
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, 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;
213402
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
215354
+ DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, 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;
215355
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
213403
215356
  new Set(Object.values(DeviceType));
213404
215357
  new Set(Object.values(DeviceRole));
213405
215358
  var LAST_FETCHED_FIELD = "lastFetchedAt";
@@ -213704,11 +215657,6 @@ Object.freeze({
213704
215657
  form: "single",
213705
215658
  optional: false
213706
215659
  }],
213707
- "battery.wakeForStream": [{
213708
- name: "deviceId",
213709
- form: "single",
213710
- optional: false
213711
- }],
213712
215660
  "binary.getStatus": [{
213713
215661
  name: "deviceId",
213714
215662
  form: "single",
@@ -214253,6 +216201,11 @@ Object.freeze({
214253
216201
  form: "single",
214254
216202
  optional: false
214255
216203
  }],
216204
+ "deviceManager.setIdentifiers": [{
216205
+ name: "deviceId",
216206
+ form: "single",
216207
+ optional: false
216208
+ }],
214256
216209
  "deviceManager.setIntegrationId": [{
214257
216210
  name: "deviceId",
214258
216211
  form: "single",
@@ -214887,6 +216840,16 @@ Object.freeze({
214887
216840
  form: "single",
214888
216841
  optional: true
214889
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
+ }],
214890
216853
  "mediaPlayer.channelDown": [{
214891
216854
  name: "deviceId",
214892
216855
  form: "single",
@@ -216172,6 +218135,11 @@ Object.freeze({
216172
218135
  form: "single",
216173
218136
  optional: false
216174
218137
  }],
218138
+ "resync.resync": [{
218139
+ name: "deviceId",
218140
+ form: "single",
218141
+ optional: false
218142
+ }],
216175
218143
  "runningState.getStatus": [{
216176
218144
  name: "deviceId",
216177
218145
  form: "single",
@@ -216247,6 +218215,11 @@ Object.freeze({
216247
218215
  form: "single",
216248
218216
  optional: false
216249
218217
  }],
218218
+ "siren.getPlayChoices": [{
218219
+ name: "deviceId",
218220
+ form: "single",
218221
+ optional: false
218222
+ }],
216250
218223
  "siren.getStatus": [{
216251
218224
  name: "deviceId",
216252
218225
  form: "single",
@@ -216429,11 +218402,21 @@ Object.freeze({
216429
218402
  form: "single",
216430
218403
  optional: false
216431
218404
  }],
218405
+ "switch.getOptions": [{
218406
+ name: "deviceId",
218407
+ form: "single",
218408
+ optional: false
218409
+ }],
216432
218410
  "switch.getStatus": [{
216433
218411
  name: "deviceId",
216434
218412
  form: "single",
216435
218413
  optional: false
216436
218414
  }],
218415
+ "switch.powerCycle": [{
218416
+ name: "deviceId",
218417
+ form: "single",
218418
+ optional: false
218419
+ }],
216437
218420
  "switch.setState": [{
216438
218421
  name: "deviceId",
216439
218422
  form: "single",
@@ -216674,6 +218657,46 @@ Object.freeze({
216674
218657
  form: "single",
216675
218658
  optional: false
216676
218659
  }],
218660
+ "workload.forceStop": [{
218661
+ name: "deviceId",
218662
+ form: "single",
218663
+ optional: false
218664
+ }],
218665
+ "workload.getOptions": [{
218666
+ name: "deviceId",
218667
+ form: "single",
218668
+ optional: false
218669
+ }],
218670
+ "workload.getStatus": [{
218671
+ name: "deviceId",
218672
+ form: "single",
218673
+ optional: false
218674
+ }],
218675
+ "workload.pause": [{
218676
+ name: "deviceId",
218677
+ form: "single",
218678
+ optional: false
218679
+ }],
218680
+ "workload.restart": [{
218681
+ name: "deviceId",
218682
+ form: "single",
218683
+ optional: false
218684
+ }],
218685
+ "workload.resume": [{
218686
+ name: "deviceId",
218687
+ form: "single",
218688
+ optional: false
218689
+ }],
218690
+ "workload.start": [{
218691
+ name: "deviceId",
218692
+ form: "single",
218693
+ optional: false
218694
+ }],
218695
+ "workload.stop": [{
218696
+ name: "deviceId",
218697
+ form: "single",
218698
+ optional: false
218699
+ }],
216677
218700
  "zoneAnalytics.getCameraHistory": [{
216678
218701
  name: "deviceId",
216679
218702
  form: "single",
@@ -217890,6 +219913,8 @@ var TimelapseRuleInputSchema = object({
217890
219913
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
217891
219914
  priority: PriorityField.default(3),
217892
219915
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219916
+ /** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
219917
+ tags: TagsFieldSchema.optional(),
217893
219918
  targetOverrides: NcTargetOverridesSchema.optional()
217894
219919
  });
217895
219920
  object({
@@ -217908,6 +219933,8 @@ object({
217908
219933
  reportClasses: ReportClassesField.optional(),
217909
219934
  priority: PriorityField.optional(),
217910
219935
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219936
+ /** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
219937
+ tags: TagsFieldSchema.optional(),
217911
219938
  targetOverrides: NcTargetOverridesSchema.optional()
217912
219939
  });
217913
219940
  TimelapseRuleInputSchema.extend({
@@ -220069,7 +222096,8 @@ var STREAM_HEADERS = {
220069
222096
  [CLIP_STREAM_TRANSPORT_HEADER]: "forward-only"
220070
222097
  };
220071
222098
  /** The status a refusal answers. `404` = nothing here to serve; `409` = a
220072
- * clip that exists and cannot be served right now; `502` = the camera. */
222099
+ * clip that exists and cannot be served right now; `502` = the camera;
222100
+ * `504` = the camera did not come up inside the wake's bound. */
220073
222101
  function streamRefusalStatus(code) {
220074
222102
  switch (code) {
220075
222103
  case "unknown-device":
@@ -220079,6 +222107,7 @@ function streamRefusalStatus(code) {
220079
222107
  case "clip-in-progress": return 409;
220080
222108
  case "camera-refused":
220081
222109
  case "fetch-failed": return 502;
222110
+ case "wake-timeout": return 504;
220082
222111
  }
220083
222112
  }
220084
222113
  function createClipStreamHandler(deps) {
@@ -223083,7 +225112,7 @@ function createReolinkVideoclipsProvider(deps) {
223083
225112
  * actually carries. Refusing left the operator with `high` looking
223084
225113
  * unsupported, and left two transports behind one pointer.
223085
225114
  */
223086
- dialClipStream: async ({ deviceId, clipId, profile, audio }) => {
225115
+ dialClipStream: async ({ deviceId, clipId, profile, audio, wake }) => {
223087
225116
  const tags = { deviceId };
223088
225117
  const refuse = (code, detail, meta) => {
223089
225118
  deps.logger.warn("videoclips: refusing a clip stream dial", {
@@ -223122,7 +225151,8 @@ function createReolinkVideoclipsProvider(deps) {
223122
225151
  deviceId,
223123
225152
  row,
223124
225153
  twin: chosen.twin,
223125
- audio: askedAudio
225154
+ audio: askedAudio,
225155
+ ...wake !== void 0 ? { wake } : {}
223126
225156
  });
223127
225157
  if (outcome.kind === "refused") return refuse(outcome.code, outcome.detail, {
223128
225158
  clipKey,
@@ -223360,6 +225390,13 @@ function createReolinkVideoclipsProvider(deps) {
223360
225390
  * constructs a `ReolinkBaichuanApi`, and that is enforced by the provider spec
223361
225391
  * rather than by hope.
223362
225392
  */
225393
+ /**
225394
+ * How long an AUTHORISED clip read or dial waits for a sleeping standalone
225395
+ * battery camera to come up — the bound `wakeIfSleeping` already applies to
225396
+ * every other operator wake on this provider. Past it the read is refused
225397
+ * `wake-timeout`, naming this number, and no session is opened.
225398
+ */
225399
+ var CLIP_WAKE_TIMEOUT_MS = 15e3;
223363
225400
  function createClipService(deps) {
223364
225401
  const now = deps.now ?? (() => Date.now());
223365
225402
  const cache = new ClipCatalogCache({ now });
@@ -223391,6 +225428,21 @@ function createClipService(deps) {
223391
225428
  * a battery camera the operator authorised once.
223392
225429
  */
223393
225430
  const producing = /* @__PURE__ */ new Map();
225431
+ /**
225432
+ * One wake in flight per camera. The file map above de-duplicates a
225433
+ * production per twin; a dial and a read of DIFFERENT twins, or two dials,
225434
+ * would otherwise each send their own wake to the same radio.
225435
+ */
225436
+ const waking = /* @__PURE__ */ new Map();
225437
+ const wakeOnce = (deviceId) => {
225438
+ const inFlight = waking.get(deviceId);
225439
+ if (inFlight !== void 0) return inFlight;
225440
+ const started = deps.wakeDevice(deviceId, CLIP_WAKE_TIMEOUT_MS).finally(() => {
225441
+ waking.delete(deviceId);
225442
+ });
225443
+ waking.set(deviceId, started);
225444
+ return started;
225445
+ };
223394
225446
  const rowFor = (deviceId, clipKey) => {
223395
225447
  return cache.findBy(deviceId, (row) => row.clipKey === clipKey);
223396
225448
  };
@@ -223580,7 +225632,7 @@ function createClipService(deps) {
223580
225632
  const gateClipDevice = async (input) => {
223581
225633
  const { deviceId, clipKey, twin, path } = input;
223582
225634
  const tags = { deviceId };
223583
- const device = await deps.resolveDevice(deviceId);
225635
+ let device = await deps.resolveDevice(deviceId);
223584
225636
  if (device === null) {
223585
225637
  deps.logger.warn("videoclips: no Reolink camera here to fetch this clip from", {
223586
225638
  tags,
@@ -223622,9 +225674,47 @@ function createClipService(deps) {
223622
225674
  clipKey,
223623
225675
  twin,
223624
225676
  path,
223625
- branch: "wake-authorised"
225677
+ branch: "wake-authorised",
225678
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
223626
225679
  }
223627
225680
  });
225681
+ if (!await wakeOnce(deviceId)) {
225682
+ deps.logger.warn("videoclips: the authorised wake did not bring the camera up in time", {
225683
+ tags,
225684
+ meta: {
225685
+ clipKey,
225686
+ twin,
225687
+ path,
225688
+ branch: "wake-timeout",
225689
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
225690
+ }
225691
+ });
225692
+ return {
225693
+ kind: "refused",
225694
+ branch: "wake-timeout",
225695
+ code: "wake-timeout",
225696
+ detail: `device ${deviceId} was woken on the operator's authorisation and did not come up within ${CLIP_WAKE_TIMEOUT_MS} ms — the clip was not fetched`
225697
+ };
225698
+ }
225699
+ const awake = await deps.resolveDevice(deviceId);
225700
+ if (awake === null) {
225701
+ deps.logger.warn("videoclips: the camera left this runner while it was being woken", {
225702
+ tags,
225703
+ meta: {
225704
+ clipKey,
225705
+ twin,
225706
+ path,
225707
+ branch: "unknown-device"
225708
+ }
225709
+ });
225710
+ return {
225711
+ kind: "refused",
225712
+ branch: "unknown-device",
225713
+ code: "catalog-unreachable",
225714
+ detail: `device ${deviceId} is not a Reolink camera on this node`
225715
+ };
225716
+ }
225717
+ device = awake;
223628
225718
  }
223629
225719
  if (uidIsMissing(device)) {
223630
225720
  deps.logger.warn("videoclips: no uid for this camera — its clip cannot be addressed", {
@@ -223939,12 +226029,13 @@ function createClipService(deps) {
223939
226029
  }),
223940
226030
  prepareBytes,
223941
226031
  prepareOffer,
223942
- prepareStreamDial: async ({ deviceId, row, twin, audio }) => {
226032
+ prepareStreamDial: async ({ deviceId, row, twin, audio, wake }) => {
223943
226033
  const gate = await gateClipDevice({
223944
226034
  deviceId,
223945
226035
  clipKey: row.clipKey,
223946
226036
  twin,
223947
- path: "stream"
226037
+ path: "stream",
226038
+ ...wake !== void 0 ? { wake } : {}
223948
226039
  });
223949
226040
  if (gate.kind === "refused") return {
223950
226041
  kind: "refused",
@@ -225208,7 +227299,8 @@ function capDayNightModeToReolink(mode) {
225208
227299
  * `features = ['native-snapshot','rebootable']` because the `feature-probe`
225209
227300
  * slice had never been written.
225210
227301
  *
225211
- * 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:
225212
227304
  * - the viewer's battery badge + sleeping overlay (`use-cameras.ts` FEATURE
225213
227305
  * map) — without it the camera is drawn as an ordinary awake camera;
225214
227306
  * - the snapshot wrapper's sleep gate (`snapshot.addon.ts`
@@ -225222,10 +227314,19 @@ function capDayNightModeToReolink(mode) {
225222
227314
  * clears it). This makes the DERIVED answer sticky the same way, for the
225223
227315
  * window before any probe has ever succeeded.
225224
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
+ }
225225
227326
  function deriveReolinkCameraFeatures(inputs) {
225226
- const { probe, isBattery } = inputs;
227327
+ const { probe } = inputs;
225227
227328
  const out = [DeviceFeature.NativeSnapshot, DeviceFeature.Rebootable];
225228
- if (probe.hasBattery === true || isBattery) out.push(DeviceFeature.BatteryOperated);
227329
+ if (reolinkCameraSleeps(inputs)) out.push(DeviceFeature.BatteryOperated, DeviceFeature.Sleeps);
225229
227330
  if (probe.hasPtz === true) out.push(DeviceFeature.PanTiltZoom);
225230
227331
  if (probe.hasAutotrack === true) out.push(DeviceFeature.PtzAutotrack);
225231
227332
  if (probe.hasIntercom === true) out.push(DeviceFeature.TwoWayAudio);
@@ -227108,7 +229209,7 @@ function applyHubChildSections(sections, snapshot) {
227108
229209
  * costs when we get them wrong.
227109
229210
  *
227110
229211
  * `→ awake` (`WAKE_HYSTERESIS_MS`): expensive if wrong. Believing an asleep
227111
- * camera is awake un-gates every background probe and makes `wakeForStream`
229212
+ * camera is awake un-gates every background probe and makes `wakeUp`
227112
229213
  * early-out without actually waking. Keep the window >= the library's UDP
227113
229214
  * inference cycle (~12 s on battery cams with idle-disconnect) and >= its
227114
229215
  * `getIdleDisconnectTimeoutMs` (30 s default).
@@ -227145,7 +229246,7 @@ function isSummarySourced(source) {
227145
229246
  * the anti-flap window does not apply to it at all.
227146
229247
  * 3. A `confirmed-wake` in the `→ awake` direction is first-hand evidence
227147
229248
  * this process produced: gating it with the anti-flap window is what
227148
- * stranded 3825's mirror on "asleep" while `wakeForStream` answered
229249
+ * stranded 3825's mirror on "asleep" while `wakeUp` answered
227149
229250
  * `awoke: true`.
227150
229251
  * 4. Everything else is subject to the asymmetric hysteresis.
227151
229252
  * 5. A summary flip toward `sleeping` is refused while a first-hand
@@ -227944,6 +230045,13 @@ function buildReolinkSirenOptions(input) {
227944
230045
  step: secondsPerPlay
227945
230046
  },
227946
230047
  defaultSeconds: secondsForPlays(defaultPlays, secondsPerPlay),
230048
+ allowedPlays: null,
230049
+ rangePlays: {
230050
+ min: 1,
230051
+ max: 60,
230052
+ step: 1
230053
+ },
230054
+ defaultPlays,
227947
230055
  unit: SirenDurationUnit.Plays,
227948
230056
  secondsPerPlay,
227949
230057
  source: SirenOptionsSource.Fallback,
@@ -228204,9 +230312,9 @@ var SirenAccessory = class extends BaseDevice {
228204
230312
  });
228205
230313
  }
228206
230314
  /** Arms the countdown for a timed activation and clears the slice when it elapses. */
228207
- armSirenCountdown(seconds) {
230315
+ armSirenCountdown(seconds, activation) {
228208
230316
  this.clearSirenTimer();
228209
- this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds));
230317
+ this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds, activation));
228210
230318
  this.sirenTimer = setTimeout(() => {
228211
230319
  this.sirenTimer = null;
228212
230320
  this.writeSirenStatus(sirenIdleStatus(this.sirenView()));
@@ -228225,7 +230333,10 @@ var SirenAccessory = class extends BaseDevice {
228225
230333
  return;
228226
230334
  }
228227
230335
  if (plays !== void 0) {
228228
- this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay));
230336
+ this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay), {
230337
+ plays,
230338
+ estimated: true
230339
+ });
228229
230340
  return;
228230
230341
  }
228231
230342
  this.clearSirenTimer();
@@ -228233,6 +230344,8 @@ var SirenAccessory = class extends BaseDevice {
228233
230344
  active: true,
228234
230345
  activeUntil: null,
228235
230346
  durationSeconds: null,
230347
+ plays: null,
230348
+ activeUntilEstimated: false,
228236
230349
  lastTriggeredAt: Date.now()
228237
230350
  });
228238
230351
  }
@@ -228240,9 +230353,27 @@ var SirenAccessory = class extends BaseDevice {
228240
230353
  this.ctx.registerNativeCap(sirenCapability, {
228241
230354
  getStatus: async () => this.sirenView(),
228242
230355
  getOptions: async () => this.sirenOptions(),
228243
- trigger: async ({ deviceId, durationSeconds }) => {
230356
+ getPlayChoices: async () => sirenPlayChoices(this.sirenOptions()),
230357
+ trigger: async ({ deviceId, durationSeconds, plays: askedPlays }) => {
228244
230358
  if (deviceId !== this.id) return this.sirenView();
228245
- const plays = playsForSeconds(resolveSirenSeconds(this.sirenOptions(), durationSeconds), this.secondsPerPlay);
230359
+ const plan = planSirenTrigger(this.sirenOptions(), {
230360
+ durationSeconds,
230361
+ plays: askedPlays
230362
+ });
230363
+ if (plan.asked === "refused") {
230364
+ this.ctx.logger.warn("siren trigger refused", {
230365
+ tags: {
230366
+ deviceId: this.id,
230367
+ channel: this.channel
230368
+ },
230369
+ meta: {
230370
+ reason: plan.reason,
230371
+ plays: askedPlays
230372
+ }
230373
+ });
230374
+ throw new Error(`siren trigger refused: ${plan.reason}`);
230375
+ }
230376
+ const plays = plan.asked === "plays" ? plan.plays : playsForSeconds(plan.seconds, this.secondsPerPlay);
228246
230377
  const api = await this.api;
228247
230378
  try {
228248
230379
  await api.setSiren(this.channel, true, plays);
@@ -228266,7 +230397,8 @@ var SirenAccessory = class extends BaseDevice {
228266
230397
  channel: this.channel
228267
230398
  },
228268
230399
  meta: {
228269
- requested: durationSeconds ?? "default",
230400
+ requested: askedPlays ?? durationSeconds ?? "default",
230401
+ unit: plan.asked,
228270
230402
  plays,
228271
230403
  seconds: actualSeconds
228272
230404
  }
@@ -228275,7 +230407,10 @@ var SirenAccessory = class extends BaseDevice {
228275
230407
  on: true,
228276
230408
  lastChangedAt: Date.now()
228277
230409
  });
228278
- this.armSirenCountdown(actualSeconds);
230410
+ this.armSirenCountdown(actualSeconds, {
230411
+ plays: plan.asked === "plays" ? plays : null,
230412
+ estimated: plan.estimated
230413
+ });
228279
230414
  return this.sirenView();
228280
230415
  },
228281
230416
  stop: async ({ deviceId }) => {
@@ -228693,7 +230828,7 @@ async function populateReolinkMetadata(api, channel, target) {
228693
230828
  ...channelCount !== void 0 ? { channelCount } : {}
228694
230829
  };
228695
230830
  try {
228696
- await target.ctx.api?.deviceManager?.setMetadata?.mutate?.({
230831
+ await target.ctx.api.deviceManager?.setMetadata?.mutate({
228697
230832
  deviceId: target.id,
228698
230833
  patch
228699
230834
  });
@@ -228710,6 +230845,26 @@ async function populateReolinkMetadata(api, channel, target) {
228710
230845
  meta: { error: err instanceof Error ? err.message : String(err) }
228711
230846
  });
228712
230847
  }
230848
+ const hostRead = channel === void 0;
230849
+ const identifierMac = hostRead ? mac : void 0;
230850
+ const identifierIp = hostRead ? ip : void 0;
230851
+ const unread = hostRead ? [...mac === void 0 ? ["mac"] : [], ...ip === void 0 ? ["ip"] : []] : [];
230852
+ await declareDeviceIdentifiers({
230853
+ deviceId: target.id,
230854
+ logger: target.ctx.logger,
230855
+ writer: target.ctx.api.deviceManager?.setIdentifiers
230856
+ }, {
230857
+ mac: identifierMac ?? null,
230858
+ serial: info.serialNumber ? {
230859
+ manufacturer: "Reolink",
230860
+ serial: info.serialNumber
230861
+ } : null,
230862
+ vendorUid: target.uid ? {
230863
+ vendor: "reolink",
230864
+ id: target.uid
230865
+ } : null,
230866
+ ip: identifierIp ?? null
230867
+ }, { unread });
228713
230868
  const cachePatch = {};
228714
230869
  if (info.serialNumber) cachePatch["serialNumber"] = info.serialNumber;
228715
230870
  if (mac) cachePatch["mac"] = mac;
@@ -230697,10 +232852,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230697
232852
  return effectiveProbeFlags(this.hasProbed(), super.getProbeFlags(), this.config?.get("deviceCache"));
230698
232853
  }
230699
232854
  get features() {
230700
- return deriveReolinkCameraFeatures({
232855
+ return deriveReolinkCameraFeatures(this.featureInputs());
232856
+ }
232857
+ /** What the features and the battery / sleep registration both read. */
232858
+ featureInputs() {
232859
+ return {
230701
232860
  probe: this.getProbeFlags(),
230702
232861
  isBattery: this.isBattery
230703
- });
232862
+ };
230704
232863
  }
230705
232864
  /** Lazy-connected Baichuan API. Spans the lifetime of every active stream. */
230706
232865
  api = null;
@@ -230838,7 +232997,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230838
232997
  lastProactiveWakeAt = 0;
230839
232998
  /**
230840
232999
  * Minimum gap between two proactive wakes. Demand-driven wakes
230841
- * (`wakeForStream` from the broker, `wakeIfSleeping` behind an
233000
+ * (`wakeUp` from the broker, `wakeIfSleeping` behind an
230842
233001
  * operator action, the intercom pre-wake) bypass this entirely —
230843
233002
  * the operator asked, the operator gets the camera. Only
230844
233003
  * self-initiated wakes are rate-limited, so a thumbnail cache miss
@@ -231611,6 +233770,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231611
233770
  async wakeForClipCatalogRefresh() {
231612
233771
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
231613
233772
  }
233773
+ /**
233774
+ * Wake this camera because the OPERATOR asked for one of its clips — a
233775
+ * viewer pressing play, or an export — carrying `ClipWake` `authorised`.
233776
+ * The same forced wake `wakeIfSleeping` drives for a config button, under
233777
+ * the clip service's bound. Resolves whether the camera is up; never throws,
233778
+ * so the service can refuse `wake-timeout` by name.
233779
+ */
233780
+ async wakeForClipRead(timeoutMs) {
233781
+ return this.wakeIfSleeping(timeoutMs);
233782
+ }
231614
233783
  clipTimeZoneWarned = { done: false };
231615
233784
  getClipDeviceRef() {
231616
233785
  const configUid = this.config.get("uid");
@@ -231695,7 +233864,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231695
233864
  * (proactive config buttons such as Auto-configure email push). A
231696
233865
  * sleeping battery cam ignores Baichuan config round-trips, so clicking
231697
233866
  * "configure" would otherwise silently fail; this drives the same forced
231698
- * wake `wakeForStream` uses, then lets the caller proceed against a live
233867
+ * wake `wakeUp` uses, then lets the caller proceed against a live
231699
233868
  * camera. No-op for non-battery or already-awake cams. Best-effort:
231700
233869
  * returns whether the camera is (now) reachable/awake.
231701
233870
  */
@@ -232117,14 +234286,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232117
234286
  */
232118
234287
  registerBatteryIfSupported() {
232119
234288
  if (this.batteryRegistered) return;
232120
- if (!this.isBattery) return;
234289
+ if (!reolinkCameraSleeps(this.featureInputs())) return;
232121
234290
  this.batteryRegistered = true;
232122
- 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, {
232123
234296
  getStatus: async ({ deviceId }) => {
232124
234297
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
232125
- return this.state.battery;
234298
+ return sleepSliceOfBattery(this.state.battery);
232126
234299
  },
232127
- wakeForStream: async ({ deviceId, timeoutMs }) => {
234300
+ wakeUp: async ({ deviceId, timeoutMs }) => {
232128
234301
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
232129
234302
  const startedAt = Date.now();
232130
234303
  if (!this.sleeping) return {
@@ -232141,7 +234314,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232141
234314
  };
232142
234315
  }
232143
234316
  this.markWakeIssued();
232144
- this.ctx.logger.info("battery wakeForStream: cam sleeping — issuing wake", {
234317
+ this.ctx.logger.info("battery wakeUp: cam sleeping — issuing wake", {
232145
234318
  tags: { deviceId: this.id },
232146
234319
  meta: { timeoutMs }
232147
234320
  });
@@ -232154,7 +234327,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232154
234327
  attempts: 2
232155
234328
  });
232156
234329
  await sleep(1500);
232157
- })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
234330
+ })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeUp timeout")), timeoutMs))]);
232158
234331
  const CONFIRM_TIMEOUT_MS = 1e4;
232159
234332
  const CONFIRM_POLL_MS = 1e3;
232160
234333
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
@@ -232187,7 +234360,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232187
234360
  }
232188
234361
  const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
232189
234362
  if (observedAwake && this.commitSleepState(false, confirmSource)) {
232190
- this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
234363
+ this.ctx.logger.info("battery wakeUp: wake confirmed — driving wake transition", {
232191
234364
  tags: { deviceId: this.id },
232192
234365
  meta: {
232193
234366
  confirmMs: Date.now() - startedAt,
@@ -232196,7 +234369,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232196
234369
  });
232197
234370
  this.onWakeTransition(confirmSource).catch(() => {});
232198
234371
  } else if (!confirmed) {
232199
- 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", {
232200
234373
  tags: { deviceId: this.id },
232201
234374
  meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
232202
234375
  });
@@ -232208,7 +234381,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232208
234381
  }
232209
234382
  if (confirmed && !observedAwake && parent !== null) this.watchHubChildAwake(parent).catch(() => {});
232210
234383
  if (this.commitSleepState(false, "confirmed-wake")) {
232211
- this.ctx.logger.info("battery wakeForStream: answering awake — committing the mirror", {
234384
+ this.ctx.logger.info("battery wakeUp: answering awake — committing the mirror", {
232212
234385
  tags: { deviceId: this.id },
232213
234386
  meta: {
232214
234387
  confirmedMs: Date.now() - startedAt,
@@ -232222,7 +234395,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232222
234395
  durationMs: Date.now() - startedAt
232223
234396
  };
232224
234397
  } catch (err) {
232225
- 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", {
232226
234399
  tags: { deviceId: this.id },
232227
234400
  meta: {
232228
234401
  timeoutMs,
@@ -232245,11 +234418,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232245
234418
  });
232246
234419
  this.runtimeState.subscribeCap("battery", (slice) => {
232247
234420
  if (!slice) return;
234421
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(slice));
232248
234422
  this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnStatusChanged, this.eventSource(), {
232249
234423
  deviceId: this.id,
232250
234424
  status: slice
232251
234425
  }));
232252
234426
  });
234427
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(this.state.battery));
232253
234428
  this.refreshBatteryFromApi("register");
232254
234429
  }
232255
234430
  /**
@@ -232365,7 +234540,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232365
234540
  * `PROACTIVE_WAKE_COOLDOWN_MS` ago — the caller must then serve
232366
234541
  * whatever it has cached instead of reaching for the radio.
232367
234542
  *
232368
- * Demand-driven paths never call this: `wakeForStream` (a consumer
234543
+ * Demand-driven paths never call this: `wakeUp` (a consumer
232369
234544
  * wants live video), `wakeIfSleeping` (an operator clicked
232370
234545
  * something) and the intercom pre-wake all wake unconditionally.
232371
234546
  */
@@ -232404,7 +234579,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232404
234579
  try {
232405
234580
  if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
232406
234581
  if (this.commitSleepState(false, "hub-summary")) {
232407
- 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 } });
232408
234583
  this.onWakeTransition("hub-summary").catch(() => {});
232409
234584
  }
232410
234585
  return;
@@ -238438,6 +240613,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
238438
240613
  this.registerPtzAutotrackIfSupported();
238439
240614
  this.registerDoorbellIfSupported();
238440
240615
  this.registerIntercomIfSupported();
240616
+ this.registerBatteryIfSupported();
238441
240617
  this.ctx.logger.info("Reolink features probed + persisted", {
238442
240618
  tags: { deviceId: this.id },
238443
240619
  meta: {
@@ -239343,6 +241519,97 @@ var EmailPushBridge = class {
239343
241519
  function pickMailbox(list) {
239344
241520
  return list.find((b) => b.id === "smtp-inbound-default")?.id ?? list[0]?.id ?? null;
239345
241521
  }
241522
+ //#endregion
241523
+ //#region src/reolink-connection-test.ts
241524
+ /**
241525
+ * The Reolink NVR / Home Hub connection test (planning#581): log in over Baichuan with the
241526
+ * connection as the form holds it — the same login the hub session makes — and answer a typed
241527
+ * verdict with a reason.
241528
+ *
241529
+ * The library reports failures only by message. What they tell apart:
241530
+ * - a socket that never connected, or a login that timed out — the hub did not answer;
241531
+ * - `Baichuan login failed: empty reply` after the nonce exchange succeeded — the hub is there
241532
+ * and refused the username or password (a mains-powered hub does not sleep, and the test's
241533
+ * socket is fresh, so the library's other two guesses for this message do not apply);
241534
+ * - anything else — the login failed with the library's own words, inconclusive.
241535
+ * Whether the host is an NVR / Home Hub rather than a single camera is NOT a reason here: a hub
241536
+ * with no camera paired answers zero channels just like a camera would.
241537
+ */
241538
+ /** The bound on login plus the channel read; the test logs in once (no library retry). */
241539
+ var REOLINK_HUB_TEST_DEADLINE_MS = 2e4;
241540
+ /** A real Baichuan session, dialled the way `connectReolinkHub` dials one. */
241541
+ var liveReolinkHubProbe = (connection) => {
241542
+ const api = new ReolinkBaichuanApi({
241543
+ host: connection.host,
241544
+ port: connection.port,
241545
+ username: connection.username,
241546
+ password: connection.password,
241547
+ transport: connection.transport,
241548
+ ...connection.uid ? { uid: connection.uid } : {}
241549
+ });
241550
+ return {
241551
+ login: () => api.login(void 0, { maxAttempts: 1 }),
241552
+ channelCount: async () => {
241553
+ try {
241554
+ return (await api.getNvrChannelsSummary({ timeoutMs: 5e3 })).devices.length;
241555
+ } catch {
241556
+ return null;
241557
+ }
241558
+ },
241559
+ close: () => api.close({ reason: "connection-test" })
241560
+ };
241561
+ };
241562
+ /** The verdict for a failed login. */
241563
+ function reolinkHubFailureOf(err, connection) {
241564
+ const where = `${connection.host}:${connection.port}`;
241565
+ const message = errMsg$3(err);
241566
+ if (message.includes("login failed: empty reply")) return {
241567
+ success: false,
241568
+ status: "rejected",
241569
+ error: `reolink: the NVR / Home Hub refused the username or password (user "${connection.username}")`
241570
+ };
241571
+ if (isConnectivityFailure(err) || message.includes("connect timeout")) return {
241572
+ success: false,
241573
+ status: "inconclusive",
241574
+ error: `reolink: the NVR / Home Hub did not answer on ${where} (${message}) — check the host and the Baichuan port (9000 by default)`
241575
+ };
241576
+ return {
241577
+ success: false,
241578
+ status: "inconclusive",
241579
+ error: `reolink: the login to ${where} failed: ${message}`
241580
+ };
241581
+ }
241582
+ async function testReolinkHubConnection(connection, makeProbe, deadlineMs = REOLINK_HUB_TEST_DEADLINE_MS) {
241583
+ const started = Date.now();
241584
+ const probe = makeProbe(connection);
241585
+ let timer = null;
241586
+ const deadline = new Promise((resolve) => {
241587
+ timer = setTimeout(() => resolve({ kind: "deadline" }), deadlineMs);
241588
+ });
241589
+ const login = probe.login().then(() => ({ kind: "ok" }), (err) => ({
241590
+ kind: "error",
241591
+ err
241592
+ }));
241593
+ try {
241594
+ const outcome = await Promise.race([login, deadline]);
241595
+ if (outcome.kind === "error") return reolinkHubFailureOf(outcome.err, connection);
241596
+ if (outcome.kind === "deadline") return {
241597
+ success: false,
241598
+ status: "inconclusive",
241599
+ error: `reolink: the NVR / Home Hub did not complete a login on ${connection.host}:${connection.port} within ${Math.round(deadlineMs / 1e3)} s — check the host and the port`
241600
+ };
241601
+ const channels = await probe.channelCount();
241602
+ return {
241603
+ success: true,
241604
+ status: "validated",
241605
+ latencyMs: Date.now() - started,
241606
+ ...channels !== null ? { detail: `${channels} channels` } : {}
241607
+ };
241608
+ } finally {
241609
+ if (timer !== null) clearTimeout(timer);
241610
+ await probe.close().catch(() => null);
241611
+ }
241612
+ }
239346
241613
  var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239347
241614
  title: "Reolink integrations",
239348
241615
  schema: entryBody({
@@ -239362,6 +241629,44 @@ var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239362
241629
  });
239363
241630
  /** Every kind this addon declares, keyed by its name. */
239364
241631
  var reolinkRecordKinds = { connections: reolinkConnectionsEntryKind };
241632
+ /**
241633
+ * The connection test: the stored hub under the edited form. A saved password is never retyped
241634
+ * (the form hands back its redacted view), so the keychain value stands in.
241635
+ */
241636
+ async function testReolinkInstance(records, deps, input) {
241637
+ const handle = records.kind(reolinkConnectionsEntryKind);
241638
+ const stored = input.id === null ? null : (await handle.getResolved(input.id))?.data ?? null;
241639
+ const typed = input.values["password"];
241640
+ const password = typeof typed === "string" && typed !== "" && typed !== "__camstack_redacted__" ? typed : stored?.password;
241641
+ const merged = {};
241642
+ for (const [key, value] of Object.entries({
241643
+ ...stored,
241644
+ ...input.values,
241645
+ password
241646
+ })) {
241647
+ if (key === "name" || value === null || value === void 0) continue;
241648
+ merged[key] = value;
241649
+ }
241650
+ const read = readHubConnection(merged);
241651
+ switch (read.kind) {
241652
+ case "no-host": return {
241653
+ success: false,
241654
+ status: "inconclusive",
241655
+ error: "reolink: no NVR / Home Hub host on this integration — standalone cameras are tested one by one when they are added"
241656
+ };
241657
+ case "no-password": return {
241658
+ success: false,
241659
+ status: "rejected",
241660
+ error: "reolink: enter the NVR / Home Hub password"
241661
+ };
241662
+ case "password-locked": return {
241663
+ success: false,
241664
+ status: "inconclusive",
241665
+ error: "reolink: the stored password cannot be read right now (keychain unavailable)"
241666
+ };
241667
+ case "ok": return testReolinkHubConnection(read.connection, deps.makeHubProbe);
241668
+ }
241669
+ }
239365
241670
  /** The record body as the connection form's flat values: no name, no unset keys. */
239366
241671
  function hubSettingsOf(body) {
239367
241672
  const out = {};
@@ -239405,7 +241710,7 @@ function buildReolinkInstances(records, deps) {
239405
241710
  },
239406
241711
  instanceMode: "multiple",
239407
241712
  kind: "connection",
239408
- canTest: false,
241713
+ canTest: true,
239409
241714
  kinds: [{
239410
241715
  id: "connection",
239411
241716
  label: "Reolink",
@@ -239416,7 +241721,8 @@ function buildReolinkInstances(records, deps) {
239416
241721
  formSchema: () => buildHubInstanceSchema(),
239417
241722
  initialBody: (name) => ({ name }),
239418
241723
  configured: (body) => (body.host ?? "").length === 0 || (body.password ?? "").length > 0,
239419
- onChanged: () => deps.onChanged()
241724
+ onChanged: () => deps.onChanged(),
241725
+ test: (input) => testReolinkInstance(records, deps, input)
239420
241726
  });
239421
241727
  }
239422
241728
  /**
@@ -240921,6 +243227,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240921
243227
  resolveDevice: async (deviceId) => {
240922
243228
  const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
240923
243229
  return device instanceof ReolinkCamera ? device.getClipDeviceRef() : null;
243230
+ },
243231
+ wakeDevice: async (deviceId, timeoutMs) => {
243232
+ const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
243233
+ return device instanceof ReolinkCamera ? device.wakeForClipRead(timeoutMs) : false;
240924
243234
  }
240925
243235
  });
240926
243236
  regs.push({
@@ -240961,7 +243271,8 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240961
243271
  };
240962
243272
  const instances = buildReolinkInstances(records, {
240963
243273
  onChanged: () => this.reconcileIntegrations(),
240964
- registryEvidenceOf
243274
+ registryEvidenceOf,
243275
+ makeHubProbe: liveReolinkHubProbe
240965
243276
  });
240966
243277
  this.instances = instances;
240967
243278
  this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);