@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.mjs CHANGED
@@ -29160,7 +29160,7 @@ var require_lz4 = /* @__PURE__ */ __commonJSMin(((exports) => {
29160
29160
  };
29161
29161
  }));
29162
29162
  //#endregion
29163
- //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-DBCXE3EJ.js
29163
+ //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-BQPNG2XV.js
29164
29164
  var import_fxp = require_fxp();
29165
29165
  var import_lz4 = /* @__PURE__ */ __toESM(require_lz4(), 1);
29166
29166
  function bcHeaderLen(messageClass, buf, bodyLen) {
@@ -31131,6 +31131,7 @@ function createDebugGateLogger(base, enabled = false) {
31131
31131
  function isTalkCmd(cmdId) {
31132
31132
  return cmdId === 10 || cmdId === 11 || cmdId === 201 || cmdId === 202;
31133
31133
  }
31134
+ var DEFAULT_LOGIN_MAX_ATTEMPTS = 3;
31134
31135
  function toWireChannelId(channelId) {
31135
31136
  return channelId & 255;
31136
31137
  }
@@ -33939,9 +33940,11 @@ var BaichuanClient = class _BaichuanClient extends EventEmitter {
33939
33940
  /**
33940
33941
  * Login flow: legacy "upgrade" -> receive nonce/encryption -> modern login.
33941
33942
  */
33942
- async login(maxEncryption = "full_aes") {
33943
+ async login(maxEncryption = "full_aes", options = {}) {
33943
33944
  if (this.loggedIn) return;
33944
- const maxAttempts = 3;
33945
+ const requested = options.maxAttempts ?? DEFAULT_LOGIN_MAX_ATTEMPTS;
33946
+ if (!Number.isInteger(requested) || requested < 1) throw new RangeError(`login maxAttempts must be a positive integer, got ${requested}`);
33947
+ const maxAttempts = requested;
33945
33948
  let lastError;
33946
33949
  let effectiveMaxEncryption = maxEncryption;
33947
33950
  let effectiveHostChannelId = this.hostChannelId;
@@ -43215,8 +43218,8 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
43215
43218
  this.client.setIdleDisconnect(enabled);
43216
43219
  this.logger.debug?.(`[ReolinkBaichuanApi] setIdleDisconnect: ${enabled}`);
43217
43220
  }
43218
- async login(maxEncryption) {
43219
- await this.client.login(maxEncryption);
43221
+ async login(maxEncryption, options) {
43222
+ await this.client.login(maxEncryption, options);
43220
43223
  this.applyTransportDerivedDefaults();
43221
43224
  }
43222
43225
  /**
@@ -100687,7 +100690,7 @@ function parseBaichuanWebhookObject(mess) {
100687
100690
  return parsed;
100688
100691
  }
100689
100692
  //#endregion
100690
- //#region ../types/dist/event-category-Dhcd0TRH.mjs
100693
+ //#region ../types/dist/event-category-CY27-fF0.mjs
100691
100694
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100692
100695
  EventCategory["SystemBoot"] = "system.boot";
100693
100696
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101187,7 +101190,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101187
101190
  */
101188
101191
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
101189
101192
  /**
101190
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
101193
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
101191
101194
  * "wake in progress" window — between the Baichuan wake-up issue and
101192
101195
  * the camera's first dialed-back RTP packet. The stream-broker
101193
101196
  * manager subscribes to flip the per-broker placeholder reason to
@@ -101209,6 +101212,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101209
101212
  EventCategory["RunningStarted"] = "running.started";
101210
101213
  /** Mirrors `runningStateCapability.events.onFinished`. */
101211
101214
  EventCategory["RunningFinished"] = "running.finished";
101215
+ /** Mirrors `workloadCapability.events.onStarted` — a workload reached running (#585). */
101216
+ EventCategory["WorkloadStarted"] = "workload.started";
101217
+ /** Mirrors `workloadCapability.events.onStopped` — a running workload stopped cleanly. */
101218
+ EventCategory["WorkloadStopped"] = "workload.stopped";
101219
+ /** Mirrors `workloadCapability.events.onCrashed` — a workload stopped without a request. */
101220
+ EventCategory["WorkloadCrashed"] = "workload.crashed";
101221
+ /** Mirrors `workloadCapability.events.onRecovered` — a crashed workload runs again. */
101222
+ EventCategory["WorkloadRecovered"] = "workload.recovered";
101212
101223
  /** Mirrors `deviceRunsCapability.events.onRunOpened` - a durable run record opened. */
101213
101224
  EventCategory["DeviceRunOpened"] = "device-run.opened";
101214
101225
  /** Mirrors `deviceRunsCapability.events.onRunClosed` - a durable run record closed. */
@@ -101511,7 +101522,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101511
101522
  return EventCategory;
101512
101523
  }({});
101513
101524
  //#endregion
101514
- //#region ../types/dist/composed-stable-id-RvQIEpqg.mjs
101525
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
101515
101526
  /**
101516
101527
  import { errMsg } from '@camstack/types'
101517
101528
  * Extract a human-readable message from an unknown error value.
@@ -101643,15 +101654,26 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101643
101654
  * and the storage as branches of one bus. One read-only `energy-system` cap carries
101644
101655
  * every value; the storage is a field of it, never the `battery` cap (#513, #522). */
101645
101656
  DeviceType["EnergySystem"] = "energy-system";
101657
+ /** Something that RUNS on a machine, or the machine itself (#585): a VM, an app
101658
+ * container, an LXC, an app, or a host. The kind is the ROLE (D1033, D1056), never
101659
+ * a field; one `workload` cap carries the state, the controls and the resources. */
101660
+ DeviceType["Workload"] = "workload";
101646
101661
  return DeviceType;
101647
101662
  }({});
101648
101663
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101664
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
101649
101665
  DeviceFeature["BatteryOperated"] = "battery-operated";
101666
+ /**
101667
+ * The device goes into low-power sleep and must be WOKEN before it streams
101668
+ * (the `low-power-sleep` cap, `wakeUp`). A battery reading alone is
101669
+ * not this: a battery sensor reports charge and never sleeps (#459, Q2).
101670
+ */
101671
+ DeviceFeature["Sleeps"] = "sleeps";
101650
101672
  DeviceFeature["Rebootable"] = "rebootable";
101651
101673
  /**
101652
101674
  * Device supports an on-demand re-sync of its derived spec with its
101653
- * upstream source — drives the generic Re-sync button. The owning
101654
- * provider implements the action via the `device-adoption.resync` cap.
101675
+ * upstream source — drives the generic Re-sync button. Present when the
101676
+ * device has the `resync` cap bound (#459, Q6).
101655
101677
  */
101656
101678
  DeviceFeature["Resyncable"] = "resyncable";
101657
101679
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -101735,9 +101757,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101735
101757
  DeviceFeature["FanDirection"] = "fan-direction";
101736
101758
  /** Fan exposes an oscillation toggle. */
101737
101759
  DeviceFeature["FanOscillating"] = "fan-oscillating";
101738
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
101739
- * field on the UI lock-controls panel. */
101740
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
101741
101760
  /** Lock supports a latch-release ("open door") action distinct from
101742
101761
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
101743
101762
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -101768,8 +101787,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101768
101787
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
101769
101788
  /** Media player exposes power on / off. */
101770
101789
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
101771
- /** Alarm panel requires a PIN code on arm/disarm. */
101772
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
101773
101790
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
101774
101791
  * addition to a textual location. */
101775
101792
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -101789,15 +101806,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101789
101806
  /** Automation `trigger` accepts a skipCondition flag — fires the
101790
101807
  * automation's actions while bypassing its condition block. */
101791
101808
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
101792
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
101793
- * map tile in the vacuum UI. */
101794
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
101795
101809
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
101796
101810
  * switches group. */
101797
101811
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
101798
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
101799
- * mower map tile. */
101800
- DeviceFeature["MowerHasMap"] = "mower-has-map";
101801
101812
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101802
101813
  * spots) — gates the Mow action + map selectors. */
101803
101814
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -101863,6 +101874,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101863
101874
  * `light` type: the provider owns the type, and a light implies brightness
101864
101875
  * or colour this relay lacks. */
101865
101876
  DeviceRole["SwitchLight"] = "switch-light";
101877
+ /** One port of a network switch that powers the device behind it (PoE): on /
101878
+ * off feeds or cuts that power. Its link is `network-link`, its draw
101879
+ * `power-meter`. Restarting the powered device through the port is that
101880
+ * device's `power-source` cap, never a reboot of the port. */
101881
+ DeviceRole["PoePort"] = "poe-port";
101866
101882
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
101867
101883
  DeviceRole["ClimateAc"] = "climate-ac";
101868
101884
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -101943,6 +101959,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101943
101959
  /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
101944
101960
  * cap. A `DeviceType.Generic` device. */
101945
101961
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101962
+ /** A virtual machine on a hypervisor. */
101963
+ DeviceRole["Vm"] = "vm";
101964
+ /** An application container (Docker, Podman). */
101965
+ DeviceRole["AppContainer"] = "app-container";
101966
+ /** A system container (LXC). */
101967
+ DeviceRole["Lxc"] = "lxc";
101968
+ /** An application or service running on a host. */
101969
+ DeviceRole["App"] = "app";
101970
+ /** A machine that runs workloads or is an appliance with its own OS: a
101971
+ * server, a hypervisor, a gateway console, a CCU. */
101972
+ DeviceRole["Host"] = "host";
101946
101973
  return DeviceRole;
101947
101974
  }({});
101948
101975
  /**
@@ -102526,8 +102553,8 @@ var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
102526
102553
  function emoji() {
102527
102554
  return new RegExp(_emoji$1, "u");
102528
102555
  }
102529
- 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])$/;
102530
- 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}|:))$/;
102556
+ 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])$/;
102557
+ 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}|:))$/;
102531
102558
  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])$/;
102532
102559
  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])$/;
102533
102560
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
@@ -103201,12 +103228,12 @@ var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)
103201
103228
  $ZodStringFormat.init(inst, def);
103202
103229
  });
103203
103230
  var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
103204
- def.pattern ?? (def.pattern = ipv4);
103231
+ def.pattern ?? (def.pattern = ipv4$1);
103205
103232
  $ZodStringFormat.init(inst, def);
103206
103233
  inst._zod.bag.format = `ipv4`;
103207
103234
  });
103208
103235
  var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
103209
- def.pattern ?? (def.pattern = ipv6);
103236
+ def.pattern ?? (def.pattern = ipv6$1);
103210
103237
  $ZodStringFormat.init(inst, def);
103211
103238
  inst._zod.bag.format = `ipv6`;
103212
103239
  inst._zod.check = (payload) => {
@@ -106122,10 +106149,16 @@ var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
106122
106149
  $ZodIPv4.init(inst, def);
106123
106150
  ZodStringFormat.init(inst, def);
106124
106151
  });
106152
+ function ipv4(params) {
106153
+ return /* @__PURE__ */ _ipv4(ZodIPv4, params);
106154
+ }
106125
106155
  var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
106126
106156
  $ZodIPv6.init(inst, def);
106127
106157
  ZodStringFormat.init(inst, def);
106128
106158
  });
106159
+ function ipv6(params) {
106160
+ return /* @__PURE__ */ _ipv6(ZodIPv6, params);
106161
+ }
106129
106162
  var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
106130
106163
  $ZodCIDRv4.init(inst, def);
106131
106164
  ZodStringFormat.init(inst, def);
@@ -106763,7 +106796,7 @@ var ZodIssueCode = {
106763
106796
  var ZodFirstPartyTypeKind;
106764
106797
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106765
106798
  //#endregion
106766
- //#region ../types/dist/sleep-Ch7Q7UtE.mjs
106799
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
106767
106800
  /**
106768
106801
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106769
106802
  * window to float samples (D455).
@@ -111561,6 +111594,10 @@ var CAP_VOCABULARY_BY_NAME = {
111561
111594
  effect: {
111562
111595
  field: "on",
111563
111596
  value: true
111597
+ },
111598
+ offeredWhen: {
111599
+ method: "getOptions",
111600
+ field: "supportsSetState"
111564
111601
  }
111565
111602
  },
111566
111603
  {
@@ -111579,6 +111616,10 @@ var CAP_VOCABULARY_BY_NAME = {
111579
111616
  effect: {
111580
111617
  field: "on",
111581
111618
  value: false
111619
+ },
111620
+ offeredWhen: {
111621
+ method: "getOptions",
111622
+ field: "supportsSetState"
111582
111623
  }
111583
111624
  },
111584
111625
  {
@@ -111592,9 +111633,14 @@ var CAP_VOCABULARY_BY_NAME = {
111592
111633
  en: "Toggle {device}",
111593
111634
  it: "Commuta {device}"
111594
111635
  },
111595
- icon: "toggle-right"
111636
+ icon: "toggle-right",
111637
+ offeredWhen: {
111638
+ method: "getOptions",
111639
+ field: "supportsSetState"
111640
+ }
111596
111641
  }
111597
111642
  ],
111643
+ notOperatorFacing: { powerCycle: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own" },
111598
111644
  state: [{
111599
111645
  kind: "boolean",
111600
111646
  field: "on",
@@ -111853,6 +111899,47 @@ var CAP_VOCABULARY_BY_NAME = {
111853
111899
  "switch.off": { icon: "plug" }
111854
111900
  },
111855
111901
  state: { on: { icon: "plug-zap" } }
111902
+ },
111903
+ [DeviceRole.PoePort]: {
111904
+ actions: {
111905
+ "switch.on": {
111906
+ label: {
111907
+ en: "Power on",
111908
+ it: "Alimenta"
111909
+ },
111910
+ phrase: {
111911
+ en: "Power on {device}",
111912
+ it: "Alimenta {device}"
111913
+ },
111914
+ icon: "plug-zap"
111915
+ },
111916
+ "switch.off": {
111917
+ label: {
111918
+ en: "Power off",
111919
+ it: "Togli alimentazione"
111920
+ },
111921
+ phrase: {
111922
+ en: "Power off {device}",
111923
+ it: "Togli alimentazione a {device}"
111924
+ },
111925
+ icon: "unplug"
111926
+ }
111927
+ },
111928
+ state: { on: {
111929
+ label: {
111930
+ en: "Powered",
111931
+ it: "Alimentata"
111932
+ },
111933
+ whenTrue: {
111934
+ en: "When {device} is powered",
111935
+ it: "Quando {device} viene alimentata"
111936
+ },
111937
+ whenFalse: {
111938
+ en: "When {device} loses power",
111939
+ it: "Quando {device} perde l’alimentazione"
111940
+ },
111941
+ icon: "plug-zap"
111942
+ } }
111856
111943
  }
111857
111944
  }
111858
111945
  }
@@ -112572,7 +112659,11 @@ var CAP_VOCABULARY_BY_NAME = {
112572
112659
  en: "Power on {device}",
112573
112660
  it: "Dai corrente a {device}"
112574
112661
  },
112575
- icon: "power"
112662
+ icon: "power",
112663
+ offeredWhen: {
112664
+ method: "getStatus",
112665
+ field: "switchSettable"
112666
+ }
112576
112667
  },
112577
112668
  {
112578
112669
  id: "powerSource.off",
@@ -112585,7 +112676,11 @@ var CAP_VOCABULARY_BY_NAME = {
112585
112676
  en: "Cut the power of {device}",
112586
112677
  it: "Togli la corrente a {device}"
112587
112678
  },
112588
- icon: "power-off"
112679
+ icon: "power-off",
112680
+ offeredWhen: {
112681
+ method: "getStatus",
112682
+ field: "switchSettable"
112683
+ }
112589
112684
  },
112590
112685
  {
112591
112686
  id: "powerSource.forceRestart",
@@ -114355,37 +114450,66 @@ var CAP_VOCABULARY_BY_NAME = {
114355
114450
  en: "Siren",
114356
114451
  it: "Sirena"
114357
114452
  },
114358
- actions: [{
114359
- id: "siren.trigger",
114360
- method: "trigger",
114361
- label: {
114362
- en: "Sound the siren",
114363
- it: "Fai suonare la sirena"
114364
- },
114365
- phrase: {
114366
- en: "Sound {device}",
114367
- it: "Fai suonare {device}"
114368
- },
114369
- icon: "siren",
114370
- args: {}
114371
- }, {
114372
- id: "siren.stop",
114373
- method: "stop",
114374
- label: {
114375
- en: "Silence the siren",
114376
- it: "Zittisci la sirena"
114453
+ actions: [
114454
+ {
114455
+ id: "siren.trigger",
114456
+ method: "trigger",
114457
+ label: {
114458
+ en: "Sound the siren",
114459
+ it: "Fai suonare la sirena"
114460
+ },
114461
+ phrase: {
114462
+ en: "Sound {device}",
114463
+ it: "Fai suonare {device}"
114464
+ },
114465
+ icon: "siren",
114466
+ args: {}
114377
114467
  },
114378
- phrase: {
114379
- en: "Silence {device}",
114380
- it: "Zittisci {device}"
114468
+ {
114469
+ id: "siren.triggerPlays",
114470
+ method: "trigger",
114471
+ label: {
114472
+ en: "Sound the siren N times",
114473
+ it: "Fai suonare la sirena N volte"
114474
+ },
114475
+ phrase: {
114476
+ en: "Sound {device} {plays} times",
114477
+ it: "Fai suonare {device} {plays} volte"
114478
+ },
114479
+ icon: "siren",
114480
+ openArgs: [{
114481
+ key: "plays",
114482
+ label: {
114483
+ en: "Plays",
114484
+ it: "Riproduzioni"
114485
+ },
114486
+ offer: {
114487
+ kind: "dynamic",
114488
+ from: "method",
114489
+ method: "getPlayChoices",
114490
+ valueKind: "number"
114491
+ }
114492
+ }]
114381
114493
  },
114382
- icon: "siren",
114383
- args: {},
114384
- effect: {
114385
- field: "active",
114386
- value: false
114494
+ {
114495
+ id: "siren.stop",
114496
+ method: "stop",
114497
+ label: {
114498
+ en: "Silence the siren",
114499
+ it: "Zittisci la sirena"
114500
+ },
114501
+ phrase: {
114502
+ en: "Silence {device}",
114503
+ it: "Zittisci {device}"
114504
+ },
114505
+ icon: "siren",
114506
+ args: {},
114507
+ effect: {
114508
+ field: "active",
114509
+ value: false
114510
+ }
114387
114511
  }
114388
- }],
114512
+ ],
114389
114513
  state: [{
114390
114514
  kind: "boolean",
114391
114515
  field: "active",
@@ -116980,6 +117104,374 @@ var CAP_VOCABULARY_BY_NAME = {
116980
117104
  icon: "loader"
116981
117105
  }]
116982
117106
  },
117107
+ "workload": {
117108
+ scope: "device",
117109
+ noun: {
117110
+ en: "Workload",
117111
+ it: "Carico di lavoro"
117112
+ },
117113
+ actions: [
117114
+ {
117115
+ id: "workload.start",
117116
+ method: "start",
117117
+ label: {
117118
+ en: "Start",
117119
+ it: "Avvia"
117120
+ },
117121
+ phrase: {
117122
+ en: "Start {device}",
117123
+ it: "Avvia {device}"
117124
+ },
117125
+ icon: "play",
117126
+ effect: {
117127
+ field: "state",
117128
+ value: "running"
117129
+ }
117130
+ },
117131
+ {
117132
+ id: "workload.stop",
117133
+ method: "stop",
117134
+ label: {
117135
+ en: "Stop",
117136
+ it: "Arresta"
117137
+ },
117138
+ phrase: {
117139
+ en: "Stop {device}",
117140
+ it: "Arresta {device}"
117141
+ },
117142
+ icon: "square",
117143
+ effect: {
117144
+ field: "state",
117145
+ value: "stopped"
117146
+ }
117147
+ },
117148
+ {
117149
+ id: "workload.restart",
117150
+ method: "restart",
117151
+ label: {
117152
+ en: "Restart",
117153
+ it: "Riavvia"
117154
+ },
117155
+ phrase: {
117156
+ en: "Restart {device}",
117157
+ it: "Riavvia {device}"
117158
+ },
117159
+ icon: "rotate-ccw"
117160
+ },
117161
+ {
117162
+ id: "workload.pause",
117163
+ method: "pause",
117164
+ label: {
117165
+ en: "Pause",
117166
+ it: "Metti in pausa"
117167
+ },
117168
+ phrase: {
117169
+ en: "Pause {device}",
117170
+ it: "Metti in pausa {device}"
117171
+ },
117172
+ icon: "pause",
117173
+ effect: {
117174
+ field: "state",
117175
+ value: "paused"
117176
+ }
117177
+ },
117178
+ {
117179
+ id: "workload.resume",
117180
+ method: "resume",
117181
+ label: {
117182
+ en: "Resume",
117183
+ it: "Riprendi"
117184
+ },
117185
+ phrase: {
117186
+ en: "Resume {device}",
117187
+ it: "Riprendi {device}"
117188
+ },
117189
+ icon: "circle-play",
117190
+ effect: {
117191
+ field: "state",
117192
+ value: "running"
117193
+ }
117194
+ },
117195
+ {
117196
+ id: "workload.forceStop",
117197
+ method: "forceStop",
117198
+ label: {
117199
+ en: "Force stop",
117200
+ it: "Arresto forzato"
117201
+ },
117202
+ phrase: {
117203
+ en: "Force {device} to stop",
117204
+ it: "Forza l’arresto di {device}"
117205
+ },
117206
+ icon: "octagon-x",
117207
+ effect: {
117208
+ field: "state",
117209
+ value: "stopped"
117210
+ }
117211
+ }
117212
+ ],
117213
+ state: [
117214
+ {
117215
+ kind: "enum",
117216
+ field: "state",
117217
+ label: {
117218
+ en: "State",
117219
+ it: "Stato"
117220
+ },
117221
+ values: [
117222
+ {
117223
+ value: "running",
117224
+ label: {
117225
+ en: "Running",
117226
+ it: "In esecuzione"
117227
+ },
117228
+ phrase: {
117229
+ en: "When {device} is running",
117230
+ it: "Quando {device} è in esecuzione"
117231
+ }
117232
+ },
117233
+ {
117234
+ value: "paused",
117235
+ label: {
117236
+ en: "Paused",
117237
+ it: "In pausa"
117238
+ }
117239
+ },
117240
+ {
117241
+ value: "stopped",
117242
+ label: {
117243
+ en: "Stopped",
117244
+ it: "Arrestato"
117245
+ },
117246
+ phrase: {
117247
+ en: "When {device} is stopped",
117248
+ it: "Quando {device} è arrestato"
117249
+ }
117250
+ },
117251
+ {
117252
+ value: "starting",
117253
+ label: {
117254
+ en: "Starting",
117255
+ it: "In avvio"
117256
+ }
117257
+ },
117258
+ {
117259
+ value: "stopping",
117260
+ label: {
117261
+ en: "Stopping",
117262
+ it: "In arresto"
117263
+ }
117264
+ },
117265
+ {
117266
+ value: "crashed",
117267
+ label: {
117268
+ en: "Crashed",
117269
+ it: "Arrestato in modo anomalo"
117270
+ },
117271
+ phrase: {
117272
+ en: "When {device} has crashed",
117273
+ it: "Quando {device} è arrestato in modo anomalo"
117274
+ }
117275
+ }
117276
+ ],
117277
+ icon: "activity"
117278
+ },
117279
+ {
117280
+ kind: "numeric",
117281
+ field: "resources.cpuPercent",
117282
+ quantity: {
117283
+ en: "the CPU use",
117284
+ it: "l'uso della CPU"
117285
+ },
117286
+ label: {
117287
+ en: "CPU",
117288
+ it: "CPU"
117289
+ },
117290
+ unit: "%",
117291
+ icon: "cpu"
117292
+ },
117293
+ {
117294
+ kind: "numeric",
117295
+ field: "resources.memoryPercent",
117296
+ quantity: {
117297
+ en: "the memory use",
117298
+ it: "l'uso della memoria"
117299
+ },
117300
+ label: {
117301
+ en: "Memory",
117302
+ it: "Memoria"
117303
+ },
117304
+ unit: "%",
117305
+ icon: "memory-stick"
117306
+ },
117307
+ {
117308
+ kind: "numeric",
117309
+ field: "resources.temperature",
117310
+ quantity: {
117311
+ en: "the temperature",
117312
+ it: "la temperatura"
117313
+ },
117314
+ label: {
117315
+ en: "Temperature",
117316
+ it: "Temperatura"
117317
+ },
117318
+ unit: "°C",
117319
+ icon: "thermometer"
117320
+ }
117321
+ ],
117322
+ events: {
117323
+ onStarted: {
117324
+ category: EventCategory.WorkloadStarted,
117325
+ label: {
117326
+ en: "Started",
117327
+ it: "Avviato"
117328
+ },
117329
+ phrase: {
117330
+ en: "When {device} starts",
117331
+ it: "Quando {device} si avvia"
117332
+ },
117333
+ icon: "play"
117334
+ },
117335
+ onStopped: {
117336
+ category: EventCategory.WorkloadStopped,
117337
+ label: {
117338
+ en: "Stopped",
117339
+ it: "Arrestato"
117340
+ },
117341
+ phrase: {
117342
+ en: "When {device} stops",
117343
+ it: "Quando {device} si arresta"
117344
+ },
117345
+ icon: "square"
117346
+ },
117347
+ onCrashed: {
117348
+ category: EventCategory.WorkloadCrashed,
117349
+ label: {
117350
+ en: "Crashed",
117351
+ it: "Arrestato in modo anomalo"
117352
+ },
117353
+ phrase: {
117354
+ en: "When {device} stops without being asked",
117355
+ it: "Quando {device} si arresta senza che sia stato richiesto"
117356
+ },
117357
+ icon: "triangle-alert"
117358
+ },
117359
+ onRecovered: {
117360
+ category: EventCategory.WorkloadRecovered,
117361
+ label: {
117362
+ en: "Recovered",
117363
+ it: "Ripristinato"
117364
+ },
117365
+ phrase: {
117366
+ en: "When {device} runs again after a crash",
117367
+ it: "Quando {device} riparte dopo un arresto anomalo"
117368
+ },
117369
+ icon: "heart-pulse"
117370
+ }
117371
+ },
117372
+ overrides: { byRole: {
117373
+ [DeviceRole.Vm]: {
117374
+ actions: { "workload.start": { icon: "monitor" } },
117375
+ state: { state: { icon: "monitor" } }
117376
+ },
117377
+ [DeviceRole.AppContainer]: {
117378
+ actions: { "workload.start": { icon: "container" } },
117379
+ state: { state: { icon: "container" } }
117380
+ },
117381
+ [DeviceRole.Lxc]: {
117382
+ actions: { "workload.start": { icon: "box" } },
117383
+ state: { state: { icon: "box" } }
117384
+ },
117385
+ [DeviceRole.App]: {
117386
+ actions: { "workload.start": { icon: "app-window" } },
117387
+ state: { state: { icon: "app-window" } }
117388
+ },
117389
+ [DeviceRole.Host]: {
117390
+ actions: {
117391
+ "workload.start": {
117392
+ label: {
117393
+ en: "Power on",
117394
+ it: "Accendi"
117395
+ },
117396
+ phrase: {
117397
+ en: "Power on {device}",
117398
+ it: "Accendi {device}"
117399
+ },
117400
+ icon: "power"
117401
+ },
117402
+ "workload.stop": {
117403
+ label: {
117404
+ en: "Shut down",
117405
+ it: "Spegni"
117406
+ },
117407
+ phrase: {
117408
+ en: "Shut down {device}",
117409
+ it: "Spegni {device}"
117410
+ },
117411
+ icon: "power-off"
117412
+ },
117413
+ "workload.restart": {
117414
+ label: {
117415
+ en: "Reboot",
117416
+ it: "Riavvia"
117417
+ },
117418
+ phrase: {
117419
+ en: "Reboot {device}",
117420
+ it: "Riavvia {device}"
117421
+ },
117422
+ icon: "refresh-cw"
117423
+ }
117424
+ },
117425
+ state: { state: { icon: "server" } },
117426
+ events: {
117427
+ onStarted: {
117428
+ label: {
117429
+ en: "Came online",
117430
+ it: "Tornato in linea"
117431
+ },
117432
+ phrase: {
117433
+ en: "When {device} comes online",
117434
+ it: "Quando {device} torna in linea"
117435
+ },
117436
+ icon: "server"
117437
+ },
117438
+ onStopped: {
117439
+ label: {
117440
+ en: "Shut down",
117441
+ it: "Spento"
117442
+ },
117443
+ phrase: {
117444
+ en: "When {device} shuts down",
117445
+ it: "Quando {device} si spegne"
117446
+ },
117447
+ icon: "server-off"
117448
+ },
117449
+ onCrashed: {
117450
+ label: {
117451
+ en: "Went down",
117452
+ it: "Caduto"
117453
+ },
117454
+ phrase: {
117455
+ en: "When {device} goes down unexpectedly",
117456
+ it: "Quando {device} cade inaspettatamente"
117457
+ },
117458
+ icon: "server-crash"
117459
+ },
117460
+ onRecovered: {
117461
+ label: {
117462
+ en: "Came online",
117463
+ it: "Tornato in linea"
117464
+ },
117465
+ phrase: {
117466
+ en: "When {device} comes back online after going down",
117467
+ it: "Quando {device} torna in linea dopo essere caduto"
117468
+ },
117469
+ icon: "server"
117470
+ }
117471
+ }
117472
+ }
117473
+ } }
117474
+ },
116983
117475
  "accessories": {
116984
117476
  scope: "device",
116985
117477
  noun: {
@@ -117759,6 +118251,14 @@ var CAP_VOCABULARY_BY_NAME = {
117759
118251
  icon: "refresh-cw"
117760
118252
  }]
117761
118253
  },
118254
+ "resync": {
118255
+ scope: "device",
118256
+ noun: {
118257
+ en: "Re-sync",
118258
+ it: "Risincronizzazione"
118259
+ },
118260
+ notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
118261
+ },
117762
118262
  "recording": {
117763
118263
  scope: "device",
117764
118264
  noun: {
@@ -119770,7 +120270,6 @@ var CAP_VOCABULARY_BY_NAME = {
119770
120270
  en: "Battery",
119771
120271
  it: "Batteria"
119772
120272
  },
119773
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
119774
120273
  state: [
119775
120274
  {
119776
120275
  kind: "numeric",
@@ -119880,6 +120379,14 @@ var CAP_VOCABULARY_BY_NAME = {
119880
120379
  icon: "moon"
119881
120380
  }]
119882
120381
  },
120382
+ "low-power-sleep": {
120383
+ scope: "device",
120384
+ noun: {
120385
+ en: "Low-power sleep",
120386
+ it: "Sospensione a basso consumo"
120387
+ },
120388
+ notOperatorFacing: { wakeUp: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" }
120389
+ },
119883
120390
  "network-link": {
119884
120391
  scope: "device",
119885
120392
  noun: {
@@ -120628,6 +121135,15 @@ var PipelineStepInputSchema = lazy(() => object({
120628
121135
  }));
120629
121136
  /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
120630
121137
  var PipelineRunResultBridge = custom();
121138
+ /**
121139
+ * Whether a switch can be set (D1058), schema-free so the addon runner can import it from
121140
+ * `@camstack/types/addon` without loading the capability schema graph (D28).
121141
+ */
121142
+ /** The read that decides whether a switch is offered on/off (`offeredWhen` of its actions). */
121143
+ var SWITCH_SETTABLE_GATE = {
121144
+ method: "getOptions",
121145
+ field: "supportsSetState"
121146
+ };
120631
121147
  var StaticDirOutputSchema = object({ staticDir: string() });
120632
121148
  var VersionOutputSchema = object({ version: string() });
120633
121149
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" }), NOT_A_DEVICE.UI_PLUMBING;
@@ -120776,6 +121292,7 @@ var CAP_NAMES = Object.freeze([
120776
121292
  "log-channels",
120777
121293
  "log-destination",
120778
121294
  "login-method",
121295
+ "low-power-sleep",
120779
121296
  "media-player",
120780
121297
  "mesh-network",
120781
121298
  "meter",
@@ -120829,6 +121346,7 @@ var CAP_NAMES = Object.freeze([
120829
121346
  "records",
120830
121347
  "remote",
120831
121348
  "remote-layout-components",
121349
+ "resync",
120832
121350
  "running-state",
120833
121351
  "scene-monitor",
120834
121352
  "schedulers",
@@ -120875,6 +121393,7 @@ var CAP_NAMES = Object.freeze([
120875
121393
  "weather",
120876
121394
  "weather-station",
120877
121395
  "webrtc-session",
121396
+ "workload",
120878
121397
  "zone-analytics",
120879
121398
  "zone-rules",
120880
121399
  "zones"
@@ -120931,7 +121450,7 @@ Object.freeze({
120931
121450
  ]
120932
121451
  },
120933
121452
  {
120934
- "path": "requiresCode",
121453
+ "path": "codeRequired",
120935
121454
  "valueType": "boolean"
120936
121455
  }
120937
121456
  ],
@@ -121999,7 +122518,24 @@ Object.freeze({
121999
122518
  "jammed",
122000
122519
  "door-open"
122001
122520
  ]
122521
+ }, {
122522
+ "path": "codeRequired",
122523
+ "valueType": "boolean"
122002
122524
  }],
122525
+ "low-power-sleep": [
122526
+ {
122527
+ "path": "sleeping",
122528
+ "valueType": "boolean"
122529
+ },
122530
+ {
122531
+ "path": "lastContactAt",
122532
+ "valueType": "number"
122533
+ },
122534
+ {
122535
+ "path": "lastUpdated",
122536
+ "valueType": "number"
122537
+ }
122538
+ ],
122003
122539
  "media-player": [
122004
122540
  {
122005
122541
  "path": "state",
@@ -122177,6 +122713,14 @@ Object.freeze({
122177
122713
  "path": "ssid",
122178
122714
  "valueType": "string"
122179
122715
  },
122716
+ {
122717
+ "path": "speedKbps",
122718
+ "valueType": "number"
122719
+ },
122720
+ {
122721
+ "path": "linkUp",
122722
+ "valueType": "boolean"
122723
+ },
122180
122724
  {
122181
122725
  "path": "lastUpdated",
122182
122726
  "valueType": "number"
@@ -122573,6 +123117,14 @@ Object.freeze({
122573
123117
  "path": "durationSeconds",
122574
123118
  "valueType": "number"
122575
123119
  },
123120
+ {
123121
+ "path": "plays",
123122
+ "valueType": "number"
123123
+ },
123124
+ {
123125
+ "path": "activeUntilEstimated",
123126
+ "valueType": "boolean"
123127
+ },
122576
123128
  {
122577
123129
  "path": "lastTriggeredAt",
122578
123130
  "valueType": "number"
@@ -122975,6 +123527,92 @@ Object.freeze({
122975
123527
  "valueType": "number"
122976
123528
  }
122977
123529
  ],
123530
+ "workload": [
123531
+ {
123532
+ "path": "state",
123533
+ "valueType": "enum",
123534
+ "enumValues": [
123535
+ "running",
123536
+ "paused",
123537
+ "stopped",
123538
+ "starting",
123539
+ "stopping",
123540
+ "crashed"
123541
+ ]
123542
+ },
123543
+ {
123544
+ "path": "since",
123545
+ "valueType": "number"
123546
+ },
123547
+ {
123548
+ "path": "hostDeviceId",
123549
+ "valueType": "number"
123550
+ },
123551
+ {
123552
+ "path": "image",
123553
+ "valueType": "string"
123554
+ },
123555
+ {
123556
+ "path": "os",
123557
+ "valueType": "string"
123558
+ },
123559
+ {
123560
+ "path": "version",
123561
+ "valueType": "string"
123562
+ },
123563
+ {
123564
+ "path": "autostart",
123565
+ "valueType": "boolean"
123566
+ },
123567
+ {
123568
+ "path": "resources.cpuPercent",
123569
+ "valueType": "number"
123570
+ },
123571
+ {
123572
+ "path": "resources.memoryUsedBytes",
123573
+ "valueType": "number"
123574
+ },
123575
+ {
123576
+ "path": "resources.memoryPercent",
123577
+ "valueType": "number"
123578
+ },
123579
+ {
123580
+ "path": "resources.memoryLimitBytes",
123581
+ "valueType": "number"
123582
+ },
123583
+ {
123584
+ "path": "resources.vcpus",
123585
+ "valueType": "number"
123586
+ },
123587
+ {
123588
+ "path": "resources.diskUsedBytes",
123589
+ "valueType": "number"
123590
+ },
123591
+ {
123592
+ "path": "resources.diskTotalBytes",
123593
+ "valueType": "number"
123594
+ },
123595
+ {
123596
+ "path": "resources.netRxKbps",
123597
+ "valueType": "number"
123598
+ },
123599
+ {
123600
+ "path": "resources.netTxKbps",
123601
+ "valueType": "number"
123602
+ },
123603
+ {
123604
+ "path": "resources.load1",
123605
+ "valueType": "number"
123606
+ },
123607
+ {
123608
+ "path": "resources.temperature",
123609
+ "valueType": "number"
123610
+ },
123611
+ {
123612
+ "path": "updateAvailable",
123613
+ "valueType": "boolean"
123614
+ }
123615
+ ],
122978
123616
  "zone-analytics": [
122979
123617
  {
122980
123618
  "path": "ts",
@@ -123091,7 +123729,7 @@ function sleep(ms) {
123091
123729
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123092
123730
  }
123093
123731
  //#endregion
123094
- //#region ../types/dist/implemented-methods-C5FMXLGP.mjs
123732
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
123095
123733
  /**
123096
123734
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123097
123735
  *
@@ -124012,63 +124650,99 @@ var HelperMemberSchema = object({
124012
124650
  cap: string().min(1),
124013
124651
  fieldPath: string().min(1)
124014
124652
  });
124653
+ /** A group, a statistic, or an integral (D944). The composer runs all three. */
124654
+ var GroupHelperSpecSchema = object({
124655
+ kind: literal("group"),
124656
+ templateId: GroupTemplateIdSchema,
124657
+ aggregate: AggregateReducerSchema,
124658
+ members: array(HelperMemberSchema).min(1).max(64),
124659
+ /** Actuator groups only. Readings leave this unset. */
124660
+ active: ActiveCriterionSchema.optional()
124661
+ });
124662
+ var statisticHelperObject = object({
124663
+ kind: literal("statistic"),
124664
+ stat: _enum(STATISTIC_STATS),
124665
+ window: StatisticWindowSchema,
124666
+ source: HelperMemberSchema
124667
+ });
124668
+ var integralHelperObject = object({
124669
+ kind: literal("integral"),
124670
+ reset: _enum(RESET_PERIODS),
124671
+ output: _enum(["energy", "meter"]),
124672
+ source: HelperMemberSchema
124673
+ });
124674
+ var thresholdHelperObject = object({
124675
+ kind: literal("threshold"),
124676
+ source: HelperMemberSchema,
124677
+ high: number$1(),
124678
+ low: number$1(),
124679
+ onForMs: number$1().int().nonnegative(),
124680
+ offForMs: number$1().int().nonnegative()
124681
+ });
124682
+ var arithmeticHelperObject = object({
124683
+ kind: literal("arithmetic"),
124684
+ op: _enum([
124685
+ "sum",
124686
+ "difference",
124687
+ "ratio"
124688
+ ]),
124689
+ inputs: array(HelperMemberSchema).min(2).max(64)
124690
+ });
124691
+ var expressionHelperObject = object({
124692
+ kind: literal("expression"),
124693
+ expr: string().min(1),
124694
+ inputs: array(object({
124695
+ name: string().min(1),
124696
+ member: HelperMemberSchema
124697
+ })).min(1).max(64),
124698
+ output: _enum(["number", "boolean"])
124699
+ });
124700
+ var derivativeHelperObject = object({
124701
+ kind: literal("derivative"),
124702
+ window: RollingWindowSchema,
124703
+ per: _enum([
124704
+ "second",
124705
+ "minute",
124706
+ "hour"
124707
+ ]),
124708
+ source: HelperMemberSchema
124709
+ });
124710
+ /** The stream profiles a camera grid can publish. */
124711
+ var GRID_PROFILES = [
124712
+ "high",
124713
+ "mid",
124714
+ "low"
124715
+ ];
124716
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
124717
+ var GridRectSchema = object({
124718
+ x: number$1().min(0).max(1),
124719
+ y: number$1().min(0).max(1),
124720
+ width: number$1().gt(0).max(1),
124721
+ height: number$1().gt(0).max(1)
124722
+ });
124723
+ var GridCellSpecSchema = object({
124724
+ source: CompositionSourceRefSchema,
124725
+ region: GridRectSchema,
124726
+ cell: GridRectSchema
124727
+ });
124015
124728
  var HelperSpecSchema = discriminatedUnion("kind", [
124016
124729
  object({
124017
- kind: literal("group"),
124018
- templateId: GroupTemplateIdSchema,
124019
- aggregate: AggregateReducerSchema,
124020
- members: array(HelperMemberSchema).min(1).max(64),
124021
- /** Actuator groups only. Readings leave this unset. */
124022
- active: ActiveCriterionSchema.optional()
124730
+ kind: literal("grid"),
124731
+ fps: number$1().int().min(1).max(60),
124732
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
124733
+ cells: array(GridCellSpecSchema).max(16)
124023
124734
  }),
124024
124735
  object({
124025
- kind: literal("statistic"),
124026
- stat: _enum(STATISTIC_STATS),
124027
- window: StatisticWindowSchema,
124028
- source: HelperMemberSchema
124736
+ kind: literal("terminal"),
124737
+ terminalId: string().uuid()
124029
124738
  }),
124030
- object({
124031
- kind: literal("integral"),
124032
- reset: _enum(RESET_PERIODS),
124033
- output: _enum(["energy", "meter"]),
124034
- source: HelperMemberSchema
124035
- }),
124036
- object({
124037
- kind: literal("threshold"),
124038
- source: HelperMemberSchema,
124039
- high: number$1(),
124040
- low: number$1(),
124041
- onForMs: number$1().int().nonnegative(),
124042
- offForMs: number$1().int().nonnegative()
124043
- }),
124044
- object({
124045
- kind: literal("arithmetic"),
124046
- op: _enum([
124047
- "sum",
124048
- "difference",
124049
- "ratio"
124050
- ]),
124051
- inputs: array(HelperMemberSchema).min(2).max(64)
124052
- }),
124053
- object({
124054
- kind: literal("expression"),
124055
- expr: string().min(1),
124056
- inputs: array(object({
124057
- name: string().min(1),
124058
- member: HelperMemberSchema
124059
- })).min(1).max(64),
124060
- output: _enum(["number", "boolean"])
124061
- }),
124062
- object({
124063
- kind: literal("derivative"),
124064
- window: RollingWindowSchema,
124065
- per: _enum([
124066
- "second",
124067
- "minute",
124068
- "hour"
124069
- ]),
124070
- source: HelperMemberSchema
124071
- })
124739
+ GroupHelperSpecSchema,
124740
+ statisticHelperObject,
124741
+ integralHelperObject,
124742
+ thresholdHelperObject,
124743
+ arithmeticHelperObject,
124744
+ expressionHelperObject,
124745
+ derivativeHelperObject
124072
124746
  ]);
124073
124747
  /** Longest snippet a `code` source may carry (slice 4). */
124074
124748
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
@@ -150245,6 +150919,67 @@ object({
150245
150919
  /** Namespaces the client listed that no longer exist. */
150246
150920
  deleted: array(PreferenceNamespaceSchema)
150247
150921
  });
150922
+ /**
150923
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
150924
+ *
150925
+ * One entry per tRPC method the hub serves, capability and core routes alike,
150926
+ * read off the live router by the hub (never a hand-written list).
150927
+ */
150928
+ var ApiProcedureKindSchema = _enum([
150929
+ "query",
150930
+ "mutation",
150931
+ "subscription"
150932
+ ]);
150933
+ /** The gate a method runs behind. */
150934
+ var ApiProcedureTierSchema = _enum([
150935
+ "public",
150936
+ "protected",
150937
+ "admin"
150938
+ ]);
150939
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
150940
+ var ApiCatalogScopeSchema = object({
150941
+ capName: string(),
150942
+ capScope: _enum(["device", "system"]),
150943
+ access: _enum([
150944
+ "view",
150945
+ "create",
150946
+ "delete"
150947
+ ]),
150948
+ role: string()
150949
+ });
150950
+ var ApiCatalogEntrySchema = object({
150951
+ /** `<router>.<method>` — the tRPC path. */
150952
+ path: string(),
150953
+ router: string(),
150954
+ method: string(),
150955
+ kind: ApiProcedureKindSchema,
150956
+ tier: ApiProcedureTierSchema,
150957
+ source: _enum(["capability", "core"]),
150958
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
150959
+ scope: ApiCatalogScopeSchema.nullable(),
150960
+ hasInput: boolean()
150961
+ });
150962
+ /**
150963
+ * May the CALLER call a method. The list has no input, so a method reached
150964
+ * only through a device grant is `per-device`: the real call is allowed or
150965
+ * refused on the device its input names.
150966
+ */
150967
+ var ApiCallableSchema = _enum([
150968
+ "yes",
150969
+ "no",
150970
+ "per-device"
150971
+ ]);
150972
+ object({ methods: array(ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema })) });
150973
+ /** A JSON Schema document, as the explorer receives it. */
150974
+ var JsonSchemaDocumentSchema = record(string(), unknown());
150975
+ object({
150976
+ path: string(),
150977
+ hasInput: boolean(),
150978
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
150979
+ schema: JsonSchemaDocumentSchema.nullable(),
150980
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
150981
+ error: string().nullable()
150982
+ });
150248
150983
  _enum(["new-session", "step-up"]);
150249
150984
  /** The languages the hub's app landing pages are written in (D858). */
150250
150985
  var AppPageLangSchema = _enum(["en", "it"]);
@@ -153990,9 +154725,8 @@ var airQualitySensorCapability = {
153990
154725
  * Many panels require a PIN code on arm / disarm — the optional
153991
154726
  * `code` field on the methods passes it through to the upstream
153992
154727
  * service; it's NEVER persisted in the runtime slice or any event
153993
- * payload. The presence of a required code is signalled by
153994
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
153995
- * field without a slice fetch.
154728
+ * payload. Whether a code is required is the slice's `codeRequired`
154729
+ * (#459): `null` when the provider cannot tell (D393).
153996
154730
  *
153997
154731
  * `availableModes` mirrors HA's `supported_features`-derived arm
153998
154732
  * mode list — the UI renders only the buttons the panel accepts.
@@ -154031,9 +154765,13 @@ var AlarmPanelStatusSchema = object({
154031
154765
  /** Subset of arm modes the panel accepts. UI renders one button per
154032
154766
  * mode in this list. */
154033
154767
  availableModes: array(AlarmArmModeSchema),
154034
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
154035
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
154036
- requiresCode: boolean(),
154768
+ /**
154769
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
154770
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
154771
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
154772
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
154773
+ */
154774
+ codeRequired: boolean().nullable(),
154037
154775
  /** Ms epoch when the slice was last updated. */
154038
154776
  lastChangedAt: number$1()
154039
154777
  });
@@ -154090,7 +154828,7 @@ var alarmPanelCapability = {
154090
154828
  arm: method(object({
154091
154829
  deviceId: number$1().int().nonnegative(),
154092
154830
  mode: AlarmArmModeSchema,
154093
- /** Optional PIN code. Required when `requiresCode === true`.
154831
+ /** Optional PIN code. Required when `codeRequired === true`.
154094
154832
  * Passed through to the upstream service; never persisted. */
154095
154833
  code: string().min(1).optional()
154096
154834
  }), _void(), {
@@ -154207,7 +154945,7 @@ var alarmPanelCapability = {
154207
154945
  /**
154208
154946
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
154209
154947
  * full slice; renders an arm button per `availableModes` entry and
154210
- * a PIN field iff `requiresCode === true`.
154948
+ * a PIN field iff `codeRequired === true`.
154211
154949
  */
154212
154950
  runtimeState: AlarmPanelStatusSchema,
154213
154951
  /**
@@ -154218,6 +154956,13 @@ var alarmPanelCapability = {
154218
154956
  */
154219
154957
  durability: "restored",
154220
154958
  /**
154959
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
154960
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
154961
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
154962
+ * can be dropped after every node has booted once on a release that has it.
154963
+ */
154964
+ restoredFieldRenames: { requiresCode: "codeRequired" },
154965
+ /**
154221
154966
  * History (D850): the panel's lifecycle state as an `enum` series —
154222
154967
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
154223
154968
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -155415,9 +156160,9 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
155415
156160
  auth: "admin"
155416
156161
  });
155417
156162
  /**
155418
- * Battery status snapshot. Emitted by providers whose device is
155419
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
155420
- * future sensor/button accessories). Consumers build their own "low
156163
+ * Battery status snapshot. Emitted by providers whose device reports a
156164
+ * battery (`DeviceFeature.BatteryOperated`): battery cameras, sensors,
156165
+ * buttons. Whether the device SLEEPS is `low-power-sleep`, not this cap. Consumers build their own "low
155421
156166
  * battery" alerting on top — the cap deliberately does NOT enforce a
155422
156167
  * threshold.
155423
156168
  */
@@ -155574,47 +156319,12 @@ var batteryCapability = {
155574
156319
  deviceNative: true,
155575
156320
  mode: "singleton",
155576
156321
  deviceTypes: BATTERY_DEVICE_TYPES,
155577
- methods: {
155578
- /**
155579
- * Explicitly wake the camera from low-power sleep ahead of a
155580
- * streaming session start. Consumers that initiate a stream
155581
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
155582
- * RTCSession, snapshot wrappers) call this with a short timeout
155583
- * before establishing the media pipeline — the broker's own
155584
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
155585
- * during which the consumer renders a black screen. Pre-waking
155586
- * compresses that gap.
155587
- *
155588
- * Returns `awoke: true` when the firmware acknowledged the wake
155589
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
155590
- * the cap surface is unavailable (no Baichuan / firmware
155591
- * channel); the caller should still attempt the stream — the
155592
- * passive broker wake remains as fallback.
155593
- */
155594
- wakeForStream: method(object({
155595
- deviceId: number$1(),
155596
- /** Bound on the wait. Sensible range 3000–10000ms. */
155597
- timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
155598
- }), object({
155599
- awoke: boolean(),
155600
- durationMs: number$1()
155601
- }), {
155602
- kind: "mutation",
155603
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
155604
- }) },
155605
156322
  /**
155606
- * A composed provider (battery ADDED to a pet feeder or container that has
155607
- * no wake surface) answers `wakeForStream` with the same "unavailable"
155608
- * result the contract already defines above: "Returns `awoke: false` when
155609
- * … the cap surface is unavailable." (D663).
156323
+ * No methods: waking a sleeping camera is `low-power-sleep.wakeUp`
156324
+ * (#459, Q2). A battery reading says nothing about sleep — a battery sensor
156325
+ * reports charge and never needs waking.
155610
156326
  */
155611
- composedMethods: { wakeForStream: {
155612
- kind: "answer",
155613
- value: {
155614
- awoke: false,
155615
- durationMs: 0
155616
- }
155617
- } },
156327
+ methods: {},
155618
156328
  events: {
155619
156329
  /**
155620
156330
  * Emitted whenever the cached status changes (firmware push OR
@@ -156382,9 +157092,10 @@ var GridProfileOfferSchema = object({
156382
157092
  published: boolean()
156383
157093
  });
156384
157094
  var GridLayoutViewSchema = object({
156385
- /** The persisted grid row this camera was declared from. */
156386
- instanceId: string(),
157095
+ /** The grid block (planning#580) whose camera this is. */
157096
+ blockId: string(),
156387
157097
  deviceId: number$1().int().nonnegative(),
157098
+ /** The device row's name — the only name a grid has; it is renamed on the block or the device. */
156388
157099
  name: string(),
156389
157100
  /**
156390
157101
  * NO canvas size. A grid's resolution is not authored: each profile derives
@@ -156400,7 +157111,6 @@ var GridLayoutViewSchema = object({
156400
157111
  });
156401
157112
  var GridLayoutPatchSchema = object({
156402
157113
  deviceId: number$1().int().nonnegative(),
156403
- name: string().min(1).max(160).optional(),
156404
157114
  fps: number$1().int().min(1).max(60).optional(),
156405
157115
  /** Which profiles to publish. See `GridProfileOffer.published`. */
156406
157116
  publishedProfiles: array(_enum([
@@ -160130,7 +160840,7 @@ var mediaPlayerCapability = {
160130
160840
  ]
160131
160841
  }
160132
160842
  };
160133
- 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;
160843
+ 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;
160134
160844
  var NUMBER = {
160135
160845
  kind: "fixed",
160136
160846
  result: ["number"]
@@ -160580,7 +161290,7 @@ new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
160580
161290
  DeviceType.Camera;
160581
161291
  /**
160582
161292
  * The series a device card trends, per cap (`history.primary` + `history.priority`):
160583
- * 6 caps. The card shows the primary of the enabled cap with the highest priority.
161293
+ * 7 caps. The card shows the primary of the enabled cap with the highest priority.
160584
161294
  */
160585
161295
  var HISTORY_PRIMARY = {
160586
161296
  "climate-control": {
@@ -160606,6 +161316,10 @@ var HISTORY_PRIMARY = {
160606
161316
  "weather-station": {
160607
161317
  field: "temperature",
160608
161318
  priority: 60
161319
+ },
161320
+ "workload": {
161321
+ field: "resources.cpuPercent",
161322
+ priority: 40
160609
161323
  }
160610
161324
  };
160611
161325
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
@@ -160616,6 +161330,8 @@ var PowerSourceRefusalReasonSchema = _enum([
160616
161330
  "switch-unknown",
160617
161331
  "restart-in-progress",
160618
161332
  "switch-call-failed",
161333
+ "switch-options-unreadable",
161334
+ "not-settable",
160619
161335
  "switch-is-actuator"
160620
161336
  ]);
160621
161337
  var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
@@ -160632,6 +161348,14 @@ var PowerSourceInfoSchema = object({
160632
161348
  /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
160633
161349
  switchOn: boolean().nullable(),
160634
161350
  switchOnline: boolean().nullable(),
161351
+ /**
161352
+ * Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
161353
+ * without the method is a plain switch, `true`). `null` = not known: no link, the switch is
161354
+ * missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
161355
+ * withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
161356
+ * unknown keeps them (D315, D1058).
161357
+ */
161358
+ switchSettable: boolean().nullable().optional(),
160635
161359
  restartInProgress: boolean(),
160636
161360
  offSeconds: number$1().int()
160637
161361
  });
@@ -160689,6 +161413,11 @@ var powerSourceCustomize = {
160689
161413
  }]
160690
161414
  };
160691
161415
  var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
161416
+ /** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
161417
+ var POWER_SOURCE_SETTABLE_GATE = {
161418
+ method: "getStatus",
161419
+ field: "switchSettable"
161420
+ };
160692
161421
  var powerSourceCapability = {
160693
161422
  name: "power-source",
160694
161423
  scope: "device",
@@ -160703,7 +161432,8 @@ var powerSourceCapability = {
160703
161432
  id: "powerSource.on",
160704
161433
  label: t("Power on", "Dai corrente"),
160705
161434
  phrase: t("Power on {device}", "Dai corrente a {device}"),
160706
- icon: "power"
161435
+ icon: "power",
161436
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160707
161437
  }]
160708
161438
  }),
160709
161439
  powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -160713,7 +161443,8 @@ var powerSourceCapability = {
160713
161443
  id: "powerSource.off",
160714
161444
  label: t("Power off", "Togli corrente"),
160715
161445
  phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
160716
- icon: "power-off"
161446
+ icon: "power-off",
161447
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160717
161448
  }]
160718
161449
  }),
160719
161450
  forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -162426,6 +163157,268 @@ var SiteZoneSchema = object({
162426
163157
  * the ones that most want grouping. */
162427
163158
  locationKeys: array(string())
162428
163159
  });
163160
+ /**
163161
+ * Provider-declared device identifiers (D1059, planning#590).
163162
+ *
163163
+ * What a device IS, as its owning provider read it from the hardware: the keys a
163164
+ * later step matches across integrations to tell that two devices are the same
163165
+ * physical object. Separate from `DeviceMetadata` on purpose — metadata is a
163166
+ * free-form blob the operator can edit, identifiers are typed, normalised and
163167
+ * written ONLY by the provider that owns the device (`device-manager.
163168
+ * setIdentifiers`, owner-checked on the transport's caller stamp).
163169
+ *
163170
+ * | Key | Stored form | Strength |
163171
+ * | -------------- | ----------------------------------- | -------- |
163172
+ * | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
163173
+ * | `serial` | `<manufacturer>:<serial>` | strong |
163174
+ * | `machine-uuid` | SMBIOS / VM / container uuid | strong |
163175
+ * | `vendor-uid` | `<vendor>:<id>` | strong |
163176
+ * | `hostname` | lower-case, no domain | weak |
163177
+ * | `ip` | IPv4 / IPv6 | weak |
163178
+ *
163179
+ * Strength is a property of the KEY, derived by {@link identifierStrength} —
163180
+ * never stored, so it cannot drift from the table above. A weak key never links
163181
+ * two devices on its own.
163182
+ *
163183
+ * The schema refuses a value that is not in its stored form, so whatever is
163184
+ * persisted is already normalised. Build a declaration with
163185
+ * {@link normaliseIdentifiers}, which turns the raw values a driver read into
163186
+ * that form and names every value it refused.
163187
+ */
163188
+ var DEVICE_IDENTIFIER_KEYS = [
163189
+ "mac",
163190
+ "serial",
163191
+ "machine-uuid",
163192
+ "vendor-uid",
163193
+ "hostname",
163194
+ "ip"
163195
+ ];
163196
+ var DeviceIdentifierKeySchema = _enum(DEVICE_IDENTIFIER_KEYS);
163197
+ /** `read` — the provider read it from the device; `derived` — computed from something else it read. */
163198
+ var DeviceIdentifierOriginSchema = _enum(["read", "derived"]);
163199
+ var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
163200
+ /** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
163201
+ var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
163202
+ var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
163203
+ var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
163204
+ function entrySchema(value) {
163205
+ return object({
163206
+ value,
163207
+ origin: DeviceIdentifierOriginSchema,
163208
+ /** Epoch ms of the FIRST read that produced this value (and origin). A later
163209
+ * read of the same value does not move it — see {@link mergeIdentifiers}. */
163210
+ readAt: number$1().int().nonnegative()
163211
+ }).strict();
163212
+ }
163213
+ var MacEntrySchema = entrySchema(string().regex(MAC_PATTERN));
163214
+ var SerialEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163215
+ var MachineUuidEntrySchema = entrySchema(string().regex(MACHINE_UUID_PATTERN));
163216
+ var VendorUidEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163217
+ var HostnameEntrySchema = entrySchema(string().regex(HOSTNAME_PATTERN));
163218
+ var IpEntrySchema = entrySchema(union([ipv4(), ipv6()]));
163219
+ object({
163220
+ value: string().min(1),
163221
+ origin: DeviceIdentifierOriginSchema,
163222
+ readAt: number$1().int().nonnegative()
163223
+ }).strict();
163224
+ /** The typed declaration. Every key optional; `mac` the only one that holds several. */
163225
+ var DeviceIdentifiersSchema = object({
163226
+ mac: array(MacEntrySchema).min(1).readonly().optional(),
163227
+ serial: SerialEntrySchema.optional(),
163228
+ "machine-uuid": MachineUuidEntrySchema.optional(),
163229
+ "vendor-uid": VendorUidEntrySchema.optional(),
163230
+ hostname: HostnameEntrySchema.optional(),
163231
+ ip: IpEntrySchema.optional()
163232
+ }).strict();
163233
+ /** True when the declaration carries no key at all. */
163234
+ function isEmptyIdentifiers(identifiers) {
163235
+ return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
163236
+ }
163237
+ /** Values devices report when they do not know: never an identity. */
163238
+ var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
163239
+ var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
163240
+ function rejected(reason) {
163241
+ return {
163242
+ ok: false,
163243
+ reason
163244
+ };
163245
+ }
163246
+ /** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
163247
+ function normaliseMac(raw) {
163248
+ const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
163249
+ if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
163250
+ const mac = (hex.match(/../g) ?? []).join(":");
163251
+ if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
163252
+ return {
163253
+ ok: true,
163254
+ value: mac
163255
+ };
163256
+ }
163257
+ function slug$2(raw) {
163258
+ return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
163259
+ }
163260
+ function normalisePrefixed(prefixRaw, valueRaw, what) {
163261
+ const prefix = slug$2(prefixRaw);
163262
+ if (prefix.length === 0) return rejected(`no ${what}`);
163263
+ const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
163264
+ if (value.length === 0) return rejected("blank value");
163265
+ if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
163266
+ return {
163267
+ ok: true,
163268
+ value: `${prefix}:${value}`
163269
+ };
163270
+ }
163271
+ function normaliseMachineUuid(raw) {
163272
+ const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
163273
+ if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
163274
+ if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
163275
+ return {
163276
+ ok: true,
163277
+ value
163278
+ };
163279
+ }
163280
+ function isIp(value) {
163281
+ return union([ipv4(), ipv6()]).safeParse(value).success;
163282
+ }
163283
+ function normaliseHostname(raw) {
163284
+ const full = raw.trim().toLowerCase().replace(/\.$/, "");
163285
+ if (full.length === 0) return rejected("blank hostname");
163286
+ if (isIp(full)) return rejected("an address, not a hostname");
163287
+ const label = full.split(".")[0] ?? "";
163288
+ if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
163289
+ if (label === "localhost") return rejected("placeholder hostname");
163290
+ return {
163291
+ ok: true,
163292
+ value: label
163293
+ };
163294
+ }
163295
+ function normaliseIp(raw) {
163296
+ const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
163297
+ if (!isIp(value)) return rejected("not an IP address");
163298
+ if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
163299
+ return {
163300
+ ok: true,
163301
+ value
163302
+ };
163303
+ }
163304
+ function isBlank(value) {
163305
+ return value === null || value === void 0 || value.trim().length === 0;
163306
+ }
163307
+ /**
163308
+ * Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
163309
+ * with colons and de-duplicated, a hostname without its domain, an IP validated,
163310
+ * a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
163311
+ * cannot be normalised is left out and listed in `rejected` — the caller logs it
163312
+ * (with `tags: { deviceId }`), it is never dropped in silence.
163313
+ */
163314
+ function normaliseIdentifiers(raw, options = {}) {
163315
+ const readAt = options.readAt ?? Date.now();
163316
+ const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
163317
+ const entry = (key, value) => ({
163318
+ value,
163319
+ origin: originOf(key),
163320
+ readAt
163321
+ });
163322
+ const refused = [];
163323
+ const take = (key, input, result) => {
163324
+ if (result.ok) return entry(key, result.value);
163325
+ refused.push({
163326
+ key,
163327
+ value: input,
163328
+ reason: result.reason
163329
+ });
163330
+ };
163331
+ const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
163332
+ const macs = [];
163333
+ for (const input of macInputs) {
163334
+ if (isBlank(input)) continue;
163335
+ const taken = take("mac", input, normaliseMac(input));
163336
+ if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
163337
+ }
163338
+ 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"));
163339
+ 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"));
163340
+ const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
163341
+ const host = isBlank(raw.host) ? null : raw.host.trim();
163342
+ const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
163343
+ const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
163344
+ const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
163345
+ const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
163346
+ const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
163347
+ return {
163348
+ identifiers: {
163349
+ ...macs.length > 0 ? { mac: macs } : {},
163350
+ ...serial !== void 0 ? { serial } : {},
163351
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
163352
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
163353
+ ...hostname !== void 0 ? { hostname } : {},
163354
+ ...ip !== void 0 ? { ip } : {}
163355
+ },
163356
+ rejected: refused
163357
+ };
163358
+ }
163359
+ /**
163360
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
163361
+ *
163362
+ * Two devices brought by DIFFERENT integrations that share provider-declared
163363
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
163364
+ * physical object. This module holds the answer's shape; the device-manager
163365
+ * keeps the index that finds the pairs and the ONE rule that grades a match
163366
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
163367
+ *
163368
+ * The rule (operator, planning#590):
163369
+ *
163370
+ * | Matched keys | Confidence |
163371
+ * | ---------------------------------------------- | ----------- |
163372
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
163373
+ * | `mac` + `ip` | `auto` |
163374
+ * | exactly one strong kind | `proposal` |
163375
+ * | weak keys only (`hostname`, `ip`) | no candidate|
163376
+ *
163377
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
163378
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
163379
+ * no match.
163380
+ *
163381
+ * Read-only: a candidate is NOT a link. Links are step 3.
163382
+ */
163383
+ var IdentityConfidenceSchema = _enum(["auto", "proposal"]);
163384
+ /** One identifier both devices declared, with the same normalised value. */
163385
+ var IdentityMatchedKeySchema = object({
163386
+ key: DeviceIdentifierKeySchema,
163387
+ value: string()
163388
+ });
163389
+ /** One side of a pair: the device and the integration that brought it. */
163390
+ var IdentityCandidateDeviceSchema = object({
163391
+ deviceId: number$1().int(),
163392
+ addonId: string(),
163393
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
163394
+ integrationId: string().nullable()
163395
+ });
163396
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
163397
+ var IdentityCandidatePairSchema = object({
163398
+ a: IdentityCandidateDeviceSchema,
163399
+ b: IdentityCandidateDeviceSchema,
163400
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
163401
+ keys: array(IdentityMatchedKeySchema).readonly(),
163402
+ confidence: IdentityConfidenceSchema
163403
+ });
163404
+ /**
163405
+ * The answer of `device-manager.listIdentityCandidates`.
163406
+ *
163407
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
163408
+ * NOT an empty list (D315).
163409
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
163410
+ * devices with no identifiers on record: whether they match anything is
163411
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
163412
+ * identifiers and matched nobody.
163413
+ */
163414
+ var IdentityCandidatesSchema = discriminatedUnion("status", [object({
163415
+ status: literal("unknown"),
163416
+ reason: string()
163417
+ }), object({
163418
+ status: literal("answered"),
163419
+ pairs: array(IdentityCandidatePairSchema).readonly(),
163420
+ undeclaredDeviceIds: array(number$1().int()).readonly()
163421
+ })]);
162429
163422
  var DeviceSearchRequiresSchema = object({
162430
163423
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
162431
163424
  caps: array(string()).readonly().optional(),
@@ -162988,6 +163981,10 @@ var DeviceInfoSchema = object({
162988
163981
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
162989
163982
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
162990
163983
  metadata: record(string(), unknown()).nullable().optional(),
163984
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
163985
+ * the owning provider via `setIdentifiers`; read-only for the operator.
163986
+ * Absent ⇒ the provider declared none. */
163987
+ identifiers: DeviceIdentifiersSchema.optional(),
162991
163988
  /** Optional upstream-system identity + rendering envelope. See
162992
163989
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
162993
163990
  sourceInfo: SourceInfoSchema.optional(),
@@ -163139,6 +164136,8 @@ var DeviceMetaSchema = object({
163139
164136
  disabled: boolean(),
163140
164137
  parentDeviceId: number$1().nullable(),
163141
164138
  metadata: record(string(), unknown()).nullable().optional(),
164139
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
164140
+ identifiers: DeviceIdentifiersSchema.optional(),
163142
164141
  /** Optional upstream-system identity + rendering envelope. See
163143
164142
  * `SourceInfo`. Present when the device has been persisted with a
163144
164143
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -163452,6 +164451,17 @@ method(object({
163452
164451
  }), _void(), {
163453
164452
  kind: "mutation",
163454
164453
  auth: "admin"
164454
+ }), method(object({
164455
+ deviceId: number$1(),
164456
+ identifiers: DeviceIdentifiersSchema.nullable(),
164457
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
164458
+ unread: array(DeviceIdentifierKeySchema).optional()
164459
+ }), _void(), {
164460
+ kind: "mutation",
164461
+ auth: "admin"
164462
+ }), method(object({}), IdentityCandidatesSchema, {
164463
+ kind: "query",
164464
+ auth: "admin"
163455
164465
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
163456
164466
  kind: "mutation",
163457
164467
  auth: "admin"
@@ -168649,8 +169659,8 @@ var HeroSceneSchema = object({
168649
169659
  /** 0..1: volume, cover position, cycle progress. */
168650
169660
  level: number$1().min(0).max(1).nullable()
168651
169661
  });
168652
- 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;
168653
- 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;
169662
+ 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;
169663
+ 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;
168654
169664
  var HeroRowIdSchema = _enum([
168655
169665
  "progress",
168656
169666
  "run-for",
@@ -168879,8 +169889,12 @@ var HeroPowerSupplySlotSchema = object({
168879
169889
  /** Off asks for a confirmation while the device runs. */
168880
169890
  confirmOffWhileRunning: boolean(),
168881
169891
  running: boolean().nullable(),
168882
- powerOn: HeroActionSchema,
168883
- powerOff: HeroActionSchema,
169892
+ /**
169893
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
169894
+ * API key): power on / off would always be refused. The restart stays (D1058).
169895
+ */
169896
+ powerOn: HeroActionSchema.nullable(),
169897
+ powerOff: HeroActionSchema.nullable(),
168884
169898
  restart: HeroActionSchema
168885
169899
  });
168886
169900
  var HeroStateBackdropSchema = object({
@@ -172020,6 +173034,13 @@ var LockControlStatusSchema = object({
172020
173034
  "jammed",
172021
173035
  "door-open"
172022
173036
  ]),
173037
+ /**
173038
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
173039
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
173040
+ * (D393) — never `false`. `.optional()` so a restored slice written before
173041
+ * the field still parses; readers treat absent exactly like `null`.
173042
+ */
173043
+ codeRequired: boolean().nullable().optional(),
172023
173044
  /** Ms epoch when the slice was last updated. */
172024
173045
  lastChangedAt: number$1()
172025
173046
  });
@@ -172499,6 +173520,90 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
172499
173520
  ]);
172500
173521
  method(_void(), array(LoginMethodContributionSchema).readonly()), NOT_A_DEVICE.IDENTITY;
172501
173522
  /**
173523
+ * low-power-sleep — a device that goes into low-power sleep and must be WOKEN
173524
+ * before it streams (#459, Q2). A battery camera (Reolink Argus, a robot's
173525
+ * on-board camera) is one; a battery SENSOR is not: it reports charge on the
173526
+ * `battery` cap and never sleeps. The two meanings used to share
173527
+ * `DeviceFeature.BatteryOperated`; this cap is the one that answers "sleeps",
173528
+ * and `DeviceFeature.Sleeps` is derived from it being bound with
173529
+ * `wakeUp` implemented.
173530
+ *
173531
+ * The state is the sleep inputs (`deriveBatteryPresence`): whether the device
173532
+ * is asleep, and the last time it PROVED it was reachable. Read from this slice
173533
+ * by the stream broker (`readBatterySleepFacts`), the recorder
173534
+ * (`recordingWakeDeps`) and the snapshot builtin. The broker's per-device
173535
+ * mirror is still also fed by `BatteryOnStatusChanged` events.
173536
+ */
173537
+ var LowPowerSleepStatusSchema = object({
173538
+ /**
173539
+ * True while the firmware is in low-power mode. A provider MUST avoid polling
173540
+ * during sleep — a read wakes the device and drains charge.
173541
+ */
173542
+ sleeping: boolean().meta({ label: "Sleeping" }),
173543
+ /**
173544
+ * Ms epoch of the last time the device proved it was reachable, from
173545
+ * PASSIVE signals only (a completed round-trip, an observed wake, a push).
173546
+ * Absent = never since this slice was born. The only input that separates
173547
+ * "asleep" from "gone".
173548
+ */
173549
+ lastContactAt: number$1().optional(),
173550
+ /** Ms epoch of the last observation. */
173551
+ lastUpdated: number$1().meta(readingMeta("none"))
173552
+ });
173553
+ var lowPowerSleepCapability = {
173554
+ name: "low-power-sleep",
173555
+ scope: "device",
173556
+ deviceNative: true,
173557
+ mode: "singleton",
173558
+ deviceTypes: [DeviceType.Camera],
173559
+ methods: {
173560
+ /**
173561
+ * Explicitly wake the device from low-power sleep ahead of a streaming
173562
+ * session start. Consumers that initiate a stream against a sleeping
173563
+ * camera (wake-on-play, the recorder, HomeKit, Alexa, snapshot wrappers)
173564
+ * call this with a short timeout before establishing the media pipeline —
173565
+ * the broker's own passive wake-on-dial works but adds 5–7 seconds to
173566
+ * first-frame. Pre-waking compresses that gap.
173567
+ *
173568
+ * Returns `awoke: true` when the firmware acknowledged the wake before
173569
+ * `timeoutMs`, `awoke: false` when it timed out; the caller should still
173570
+ * attempt the stream — the passive broker wake remains as fallback.
173571
+ */
173572
+ wakeUp: method(object({
173573
+ deviceId: number$1(),
173574
+ /** Bound on the wait. Sensible range 3000–10000ms. */
173575
+ timeoutMs: number$1().int().min(500).max(3e4).default(8e3)
173576
+ }), object({
173577
+ awoke: boolean(),
173578
+ durationMs: number$1()
173579
+ }), {
173580
+ kind: "mutation",
173581
+ notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
173582
+ }) },
173583
+ status: {
173584
+ schema: LowPowerSleepStatusSchema,
173585
+ kind: "push",
173586
+ empty: {
173587
+ sleeping: false,
173588
+ lastUpdated: 0
173589
+ }
173590
+ },
173591
+ runtimeState: LowPowerSleepStatusSchema,
173592
+ /**
173593
+ * Runtime-state durability: **restored** — a sleeping camera may not report
173594
+ * for hours; the restored sleep inputs are the only thing the sleep gate and
173595
+ * the presence derivation have (the same argument as `battery`).
173596
+ */
173597
+ durability: "restored",
173598
+ /** History (D850): none — battery never recorded a sleep series either. */
173599
+ history: "none",
173600
+ volatileStateFields: ["lastUpdated"],
173601
+ vocabulary: {
173602
+ noun: t("Low-power sleep", "Sospensione a basso consumo"),
173603
+ order: 5245
173604
+ }
173605
+ };
173606
+ /**
172502
173607
  * mesh-network — collection cap for mesh-VPN providers.
172503
173608
  *
172504
173609
  * Different shape from `network-access` (public tunnels):
@@ -179640,6 +180745,19 @@ var NetworkLinkStatusSchema = object({
179640
180745
  rssi: number$1().optional().meta(readingMeta("signal-level")),
179641
180746
  /** Network name of a wireless link, when the firmware reports it. */
179642
180747
  ssid: string().optional(),
180748
+ /**
180749
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
180750
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
180751
+ * `null` = the port is down or the speed is not known; absent = the provider
180752
+ * never reports one.
180753
+ */
180754
+ speedKbps: number$1().nonnegative().nullable().optional().meta(readingMeta("bitrate")),
180755
+ /**
180756
+ * Whether the link is up. `type` names the medium, not its state, so a wired
180757
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
180758
+ * absent = the provider never reports it.
180759
+ */
180760
+ linkUp: boolean().nullable().optional(),
179643
180761
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
179644
180762
  lastUpdated: number$1().meta(readingMeta("none"))
179645
180763
  });
@@ -181844,7 +182962,32 @@ var NcRuleInputSchema = object({
181844
182962
  * authored before this field meant. An editor turns it off by writing
181845
182963
  * `false`, so it needs no `clear` key.
181846
182964
  */
181847
- askVerdict: boolean().optional()
182965
+ askVerdict: boolean().optional(),
182966
+ /**
182967
+ * Operator tags (D1054), kept on the rule like a core block's. Absent = no
182968
+ * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
182969
+ * does not name `tags` keeps the stored ones (the store merges), and an
182970
+ * editor empties them by sending `[]` (the store drops an empty list).
182971
+ * Renamed or removed fleet-wide only through the `tags` cap, which writes
182972
+ * here with `setRuleTags`.
182973
+ */
182974
+ tags: TagsFieldSchema.optional()
182975
+ });
182976
+ /**
182977
+ * The rule kinds that carry tags (D1054) — each one its own store. Every kind
182978
+ * labels its rules the same way; this names which store a tag write goes to.
182979
+ */
182980
+ var NcTaggedRuleKindSchema = _enum([
182981
+ "event",
182982
+ "summary",
182983
+ "timelapse",
182984
+ "calendar-events"
182985
+ ]);
182986
+ /** One rule's tags, as the `tags` cap reads them across every kind. */
182987
+ var NcRuleTagsEntrySchema = object({
182988
+ kind: NcTaggedRuleKindSchema,
182989
+ ruleId: string(),
182990
+ tags: array(string())
181848
182991
  });
181849
182992
  /**
181850
182993
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -182861,6 +184004,16 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
182861
184004
  }), object({ success: literal(true) }), {
182862
184005
  kind: "mutation",
182863
184006
  auth: "admin"
184007
+ }), method(object({}), object({ rules: array(NcRuleTagsEntrySchema) }), {
184008
+ kind: "query",
184009
+ auth: "admin"
184010
+ }), method(object({
184011
+ kind: NcTaggedRuleKindSchema,
184012
+ ruleId: string(),
184013
+ tags: TagsFieldSchema
184014
+ }), object({ success: literal(true) }), {
184015
+ kind: "mutation",
184016
+ auth: "admin"
182864
184017
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
182865
184018
  deviceId: number$1().int(),
182866
184019
  muted: boolean()
@@ -188864,7 +190017,18 @@ var videoclipsCapability = {
188864
190017
  * older than this field keeps working unchanged (D382 — an unstated
188865
190018
  * ask is zero).
188866
190019
  */
188867
- audio: ClipStreamAudioSchema.optional()
190020
+ audio: ClipStreamAudioSchema.optional(),
190021
+ /**
190022
+ * The operator's authorisation to wake a sleeping camera for this
190023
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
190024
+ * — the default — means a sleeping standalone battery camera is
190025
+ * REFUSED by name before any URL is minted. A caller sets it only
190026
+ * when a viewer itself asked for the clip (the broker's `playClip`);
190027
+ * a prefetch, a reconcile or a retry never does. With it, the
190028
+ * provider wakes the camera and waits under a bound; a camera that
190029
+ * does not come up is refused `wake-timeout`, naming the wait.
190030
+ */
190031
+ wake: ClipWakeSchema.optional()
188868
190032
  }), ClipStreamDialSchema, {
188869
190033
  kind: "query",
188870
190034
  auth: "protected"
@@ -189168,7 +190332,8 @@ _enum([
189168
190332
  "camera-refused",
189169
190333
  "fetch-failed",
189170
190334
  "too-large-to-transfer",
189171
- "wake-expired"
190335
+ "wake-expired",
190336
+ "wake-timeout"
189172
190337
  ]);
189173
190338
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
189174
190339
  function clipExportFailure(code, detail) {
@@ -190236,6 +191401,27 @@ var RemoteLayoutComponentSchema = object({
190236
191401
  });
190237
191402
  });
190238
191403
  method(object({}), array(RemoteLayoutComponentSchema), { auth: "protected" });
191404
+ /**
191405
+ * resync — a device whose derived spec can be re-aligned on demand with its
191406
+ * upstream source (#459, Q6). Registered by the containers an integration
191407
+ * adopted; `DeviceFeature.Resyncable` (the generic Re-sync button) is derived
191408
+ * from it being bound with `resync` implemented.
191409
+ *
191410
+ * The work itself stays where it is: the owning addon's `device-adoption`
191411
+ * provider, reached through `deviceManager.adoptionResync` (which also owns
191412
+ * the "resync from zero" child purge). A provider answers this method by
191413
+ * asking for exactly that — see `resyncThroughAdoption`.
191414
+ */
191415
+ var ResyncDeviceInputSchema = object({
191416
+ deviceId: number$1().int().nonnegative(),
191417
+ /** "Resync from zero": purge the accessory children before re-deriving. */
191418
+ resetToSource: boolean().optional()
191419
+ });
191420
+ DeviceType.Container, DeviceType.Workload, DeviceType.WeatherStation, method(ResyncDeviceInputSchema, ResyncResultSchema, {
191421
+ kind: "mutation",
191422
+ auth: "admin",
191423
+ notOperatorFacing: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action"
191424
+ });
190239
191425
  var RUNNING_POWER_START_DELAY_MS = 3e4;
190240
191426
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
190241
191427
  /**
@@ -191428,6 +192614,16 @@ var SirenOptionsSchema = object({
191428
192614
  rangeSeconds: SirenDurationRangeSchema.nullable(),
191429
192615
  /** The camera's default duration, seconds. */
191430
192616
  defaultSeconds: number$1().positive(),
192617
+ /**
192618
+ * Discrete play counts the operator may pick; `null` when the camera gives a
192619
+ * range or does not count plays. Defaults to `null` so a provider that
192620
+ * predates plays (#589) reads as declaring none.
192621
+ */
192622
+ allowedPlays: array(number$1().int().positive()).nullable().default(null),
192623
+ /** Continuous range of play counts; `null` when listed or not counted. */
192624
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
192625
+ /** The camera's default play count; `null` when the camera does not count plays. */
192626
+ defaultPlays: number$1().int().positive().nullable().default(null),
191431
192627
  /** What the camera counts natively. */
191432
192628
  unit: _enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
191433
192629
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -191444,9 +192640,28 @@ var SirenStatusSchema = object({
191444
192640
  activeUntil: number$1().nullable(),
191445
192641
  /** Duration of the current / last activation, seconds; `null` when none yet. */
191446
192642
  durationSeconds: number$1().nullable(),
192643
+ /**
192644
+ * The play count of the current / last activation when it was asked in plays;
192645
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
192646
+ */
192647
+ plays: number$1().int().positive().nullable().default(null),
192648
+ /**
192649
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
192650
+ * not report — the siren may fall silent somewhat earlier or later.
192651
+ */
192652
+ activeUntilEstimated: boolean().default(false),
191447
192653
  /** Ms epoch of the last trigger (0 = never). */
191448
192654
  lastTriggeredAt: number$1()
191449
192655
  });
192656
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
192657
+ var SirenTriggerInputSchema = object({
192658
+ deviceId: number$1().int().nonnegative(),
192659
+ durationSeconds: number$1().positive().optional(),
192660
+ plays: number$1().int().positive().optional()
192661
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
192662
+ message: "a siren trigger takes durationSeconds or plays, not both",
192663
+ path: ["plays"]
192664
+ });
191450
192665
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
191451
192666
  /** Ms epoch of the last successful camera read of the options (0 = never). */
191452
192667
  lastFetchedAt: number$1() });
@@ -191463,13 +192678,20 @@ var sirenCapability = {
191463
192678
  auth: "protected"
191464
192679
  }),
191465
192680
  /**
191466
- * Sound the siren. Without `durationSeconds` the camera default applies.
191467
- * Answers the state at the moment of the trigger (`activeUntil` included).
192681
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
192682
+ * its range spelled out. Empty for a siren that counts seconds.
191468
192683
  */
191469
- trigger: method(object({
191470
- deviceId: number$1().int().nonnegative(),
191471
- durationSeconds: number$1().positive().optional()
191472
- }), SirenStatusSchema, {
192684
+ getPlayChoices: method(object({ deviceId: number$1().int().nonnegative() }), array(number$1().int().positive()), {
192685
+ kind: "query",
192686
+ auth: "protected"
192687
+ }),
192688
+ /**
192689
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
192690
+ * neither the camera default applies. A count on a siren that declares no
192691
+ * plays is refused. Answers the state at the moment of the trigger
192692
+ * (`activeUntil` included).
192693
+ */
192694
+ trigger: method(SirenTriggerInputSchema, SirenStatusSchema, {
191473
192695
  kind: "mutation",
191474
192696
  auth: "protected",
191475
192697
  actions: [{
@@ -191478,6 +192700,21 @@ var sirenCapability = {
191478
192700
  phrase: t("Sound {device}", "Fai suonare {device}"),
191479
192701
  icon: "siren",
191480
192702
  args: {}
192703
+ }, {
192704
+ id: "siren.triggerPlays",
192705
+ label: t("Sound the siren N times", "Fai suonare la sirena N volte"),
192706
+ phrase: t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
192707
+ icon: "siren",
192708
+ openArgs: [{
192709
+ key: "plays",
192710
+ label: t("Plays", "Riproduzioni"),
192711
+ offer: {
192712
+ kind: "dynamic",
192713
+ from: "method",
192714
+ method: "getPlayChoices",
192715
+ valueKind: "number"
192716
+ }
192717
+ }]
191481
192718
  }]
191482
192719
  }),
191483
192720
  /** Silence the siren now. */
@@ -192768,6 +194005,27 @@ var SwitchStatusSchema = object({
192768
194005
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
192769
194006
  lastChangedAt: number$1()
192770
194007
  });
194008
+ /**
194009
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
194010
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
194011
+ *
194012
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
194013
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
194014
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
194015
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
194016
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
194017
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
194018
+ * read that failed or is pending changes nothing (D315).
194019
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
194020
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
194021
+ * `power-source.forceRestart` uses it instead of off / wait / on.
194022
+ */
194023
+ var SwitchOptionsSchema = object({
194024
+ supportsSetState: boolean().default(true),
194025
+ supportsPowerCycle: boolean().default(false)
194026
+ });
194027
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
194028
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
192771
194029
  var switchCapability = {
192772
194030
  name: "switch",
192773
194031
  scope: "device",
@@ -192795,7 +194053,8 @@ var switchCapability = {
192795
194053
  field: "on",
192796
194054
  value: true
192797
194055
  },
192798
- args: { on: true }
194056
+ args: { on: true },
194057
+ offeredWhen: SWITCH_SETTABLE_GATE
192799
194058
  }, {
192800
194059
  id: "switch.off",
192801
194060
  label: t("Turn off", "Spegni"),
@@ -192805,9 +194064,16 @@ var switchCapability = {
192805
194064
  field: "on",
192806
194065
  value: false
192807
194066
  },
192808
- args: { on: false }
194067
+ args: { on: false },
194068
+ offeredWhen: SWITCH_SETTABLE_GATE
192809
194069
  }]
192810
194070
  }),
194071
+ getOptions: optionalMethod(object({ deviceId: number$1() }), SwitchOptionsSchema, { auth: "protected" }),
194072
+ powerCycle: optionalMethod(object({ deviceId: number$1() }), _void(), {
194073
+ kind: "mutation",
194074
+ auth: "protected",
194075
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
194076
+ }),
192811
194077
  toggle: optionalMethod(object({ deviceId: number$1() }), _void(), {
192812
194078
  kind: "mutation",
192813
194079
  auth: "protected",
@@ -192815,7 +194081,8 @@ var switchCapability = {
192815
194081
  id: "switch.toggle",
192816
194082
  label: t("Toggle", "Commuta"),
192817
194083
  phrase: t("Toggle {device}", "Commuta {device}"),
192818
- icon: "toggle-right"
194084
+ icon: "toggle-right",
194085
+ offeredWhen: SWITCH_SETTABLE_GATE
192819
194086
  }]
192820
194087
  })
192821
194088
  },
@@ -192837,6 +194104,16 @@ var switchCapability = {
192837
194104
  * not need to re-query the provider after a setState mutation.
192838
194105
  */
192839
194106
  runtimeState: SwitchStatusSchema,
194107
+ composedMethods: {
194108
+ getOptions: {
194109
+ kind: "answer",
194110
+ value: SWITCH_DEFAULT_OPTIONS
194111
+ },
194112
+ powerCycle: {
194113
+ kind: "refuse",
194114
+ reason: "a composed switch has no native power cycle"
194115
+ }
194116
+ },
192840
194117
  /**
192841
194118
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
192842
194119
  *
@@ -193010,6 +194287,26 @@ var switchCapability = {
193010
194287
  "switch.off": { icon: "plug" }
193011
194288
  },
193012
194289
  state: { on: { icon: "plug-zap" } }
194290
+ },
194291
+ [DeviceRole.PoePort]: {
194292
+ actions: {
194293
+ "switch.on": {
194294
+ label: t("Power on", "Alimenta"),
194295
+ phrase: t("Power on {device}", "Alimenta {device}"),
194296
+ icon: "plug-zap"
194297
+ },
194298
+ "switch.off": {
194299
+ label: t("Power off", "Togli alimentazione"),
194300
+ phrase: t("Power off {device}", "Togli alimentazione a {device}"),
194301
+ icon: "unplug"
194302
+ }
194303
+ },
194304
+ state: { on: {
194305
+ label: t("Powered", "Alimentata"),
194306
+ whenTrue: t("When {device} is powered", "Quando {device} viene alimentata"),
194307
+ whenFalse: t("When {device} loses power", "Quando {device} perde l’alimentazione"),
194308
+ icon: "plug-zap"
194309
+ } }
193013
194310
  }
193014
194311
  }
193015
194312
  }
@@ -193599,10 +194896,11 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
193599
194896
  /**
193600
194897
  * tags — the registry of tag STYLES and the one place that renames or removes a
193601
194898
  * tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
193602
- * labels (a core block, a scheduler, a template, an action, a device); only its
194899
+ * labels (a core block, a scheduler, a template, an action, a device, a
194900
+ * notification rule); only its
193603
194901
  * colour token and icon are registered here. Provided by the core-blocks builtin,
193604
- * the one place that knows every owner kind; devices are reached through
193605
- * `deviceManager` over `ctx.api`.
194902
+ * the one place that knows every owner kind; devices and notification rules
194903
+ * are reached through `deviceManager` / `notificationRules` over `ctx.api`.
193606
194904
  *
193607
194905
  * Tags compare trimmed and case-insensitively. `list` is the union of styled tags
193608
194906
  * and tags in use; a tag with no style answers a colour derived from its name and
@@ -193613,7 +194911,21 @@ var TagUsageCountsSchema = object({
193613
194911
  schedulers: number$1().int().nonnegative(),
193614
194912
  templates: number$1().int().nonnegative(),
193615
194913
  actions: number$1().int().nonnegative(),
193616
- devices: number$1().int().nonnegative()
194914
+ devices: number$1().int().nonnegative(),
194915
+ notificationRules: number$1().int().nonnegative()
194916
+ });
194917
+ /**
194918
+ * The counts `list` answers. An owner that could not be read (a forked addon
194919
+ * that is down, redeploying or not installed) is `null` — unknown, never `0`
194920
+ * (D393) — and `list` still answers with the other owners' tags.
194921
+ */
194922
+ var TagListCountsSchema = object({
194923
+ coreBlocks: number$1().int().nonnegative().nullable(),
194924
+ schedulers: number$1().int().nonnegative().nullable(),
194925
+ templates: number$1().int().nonnegative().nullable(),
194926
+ actions: number$1().int().nonnegative().nullable(),
194927
+ devices: number$1().int().nonnegative().nullable(),
194928
+ notificationRules: number$1().int().nonnegative().nullable()
193617
194929
  });
193618
194930
  var TagEntrySchema = object({
193619
194931
  name: TagNameSchema,
@@ -193621,7 +194933,8 @@ var TagEntrySchema = object({
193621
194933
  icon: IconKeySchema,
193622
194934
  /** `false` when the operator never chose a style: colour and icon are the derived defaults. */
193623
194935
  styled: boolean(),
193624
- counts: TagUsageCountsSchema
194936
+ /** Per owner kind; `null` = that owner could not be read on this call. */
194937
+ counts: TagListCountsSchema
193625
194938
  });
193626
194939
  method(object({}), array(TagEntrySchema), { auth: "protected" }), method(object({
193627
194940
  name: TagNameSchema,
@@ -194162,7 +195475,6 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
194162
195475
  });
194163
195476
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
194164
195477
  var ProfileSettingsSchemaBridge = unknown().nullable();
194165
- var ProfileSettingsBagSchema = record(string(), unknown());
194166
195478
  /**
194167
195479
  * A live terminal session hosted by the provider addon. Output and input do
194168
195480
  * NOT flow through the capability — they use the addon data plane
@@ -194181,7 +195493,11 @@ var TerminalSessionInfoSchema = object({
194181
195493
  cols: number$1().int().positive(),
194182
195494
  rows: number$1().int().positive(),
194183
195495
  /** ms-epoch the session's pty was spawned. */
194184
- startedAt: number$1()
195496
+ startedAt: number$1(),
195497
+ /** User id of the admin who opened it; `unattributed` when the caller was not passed. */
195498
+ openedBy: string().optional(),
195499
+ /** ms-epoch of the last pty input or output — what the idle timeout measures. */
195500
+ lastActivityAt: number$1().optional()
194185
195501
  });
194186
195502
  /**
194187
195503
  * A profile the operator may open — a pre-declared, allowlisted program
@@ -194201,39 +195517,6 @@ var TerminalProfileInfoSchema = object({
194201
195517
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
194202
195518
  settingsSchema: ProfileSettingsSchemaBridge.optional()
194203
195519
  });
194204
- /**
194205
- * A durable operator-created Terminal instance. Profiles are templates; only
194206
- * an instance declares a camera.
194207
- */
194208
- var TerminalInstanceInfoSchema = object({
194209
- instanceId: string(),
194210
- cameraStableId: string(),
194211
- nodeId: string(),
194212
- /**
194213
- * False while the node the instance is bound to is not in the cluster
194214
- * topology (forgotten, renamed, re-paired). The instance is kept; the
194215
- * operator re-points it on the Terminal page.
194216
- */
194217
- nodeInCluster: boolean(),
194218
- profileId: string(),
194219
- profileLabel: string(),
194220
- name: string(),
194221
- enabled: boolean(),
194222
- executable: string(),
194223
- args: array(string()).readonly(),
194224
- cwd: string(),
194225
- environment: array(string()).readonly(),
194226
- profileSettings: ProfileSettingsBagSchema
194227
- });
194228
- var TerminalLegacyCameraSchema = object({
194229
- stableId: string(),
194230
- nodeId: string(),
194231
- profileId: string(),
194232
- profileLabel: string(),
194233
- name: string(),
194234
- /** Only legacy monitor cameras can retain their historic stable identity. */
194235
- adoptable: boolean()
194236
- });
194237
195520
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
194238
195521
  seq: number$1().int().positive(),
194239
195522
  kind: literal("data"),
@@ -194261,13 +195544,7 @@ var TerminalOutputBatchSchema = object({
194261
195544
  snapshot: string().optional(),
194262
195545
  events: array(TerminalOutputEventSchema).readonly()
194263
195546
  });
194264
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
194265
- stableId: string().min(1),
194266
- name: string().trim().min(1).max(160).optional()
194267
- }), TerminalInstanceInfoSchema, {
194268
- kind: "mutation",
194269
- auth: "admin"
194270
- }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
195547
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
194271
195548
  profileId: string(),
194272
195549
  cols: number$1().int().positive(),
194273
195550
  rows: number$1().int().positive(),
@@ -196985,6 +198262,427 @@ DeviceType.Camera, method(object({ deviceId: number$1().int().nonnegative() }),
196985
198262
  deviceId: number$1().int().nonnegative(),
196986
198263
  sessionId: string()
196987
198264
  }), WebrtcSessionDebugSchema, { kind: "query" });
198265
+ var WorkloadStateSchema = _enum([
198266
+ "running",
198267
+ "paused",
198268
+ "stopped",
198269
+ "starting",
198270
+ "stopping",
198271
+ "crashed"
198272
+ ]);
198273
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
198274
+ var WORKLOAD_ROLES = [
198275
+ DeviceRole.Vm,
198276
+ DeviceRole.AppContainer,
198277
+ DeviceRole.Lxc,
198278
+ DeviceRole.App,
198279
+ DeviceRole.Host
198280
+ ];
198281
+ /**
198282
+ * What the workload uses. Every value is `null` when not reported (D393). A host
198283
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
198284
+ */
198285
+ var WorkloadResourcesSchema = object({
198286
+ /** CPU use, percent of the CPUs it may use (0–100). */
198287
+ cpuPercent: number$1().nullable().meta(readingMeta("percentage", { precision: 1 })),
198288
+ memoryUsedBytes: number$1().nullable().meta(readingMeta("information")),
198289
+ /**
198290
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
198291
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
198292
+ */
198293
+ memoryPercent: number$1().nullable().optional().meta(readingMeta("percentage", { precision: 1 })),
198294
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
198295
+ memoryLimitBytes: number$1().nullable().meta(readingMeta("information")),
198296
+ vcpus: number$1().nullable().meta(readingMeta("count")),
198297
+ diskUsedBytes: number$1().nullable().meta(readingMeta("information")),
198298
+ diskTotalBytes: number$1().nullable().meta(readingMeta("information")),
198299
+ /** Network received, kbit/s. */
198300
+ netRxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198301
+ /** Network sent, kbit/s. */
198302
+ netTxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198303
+ /** One-minute load average (a host). */
198304
+ load1: number$1().nullable().meta(readingMeta("index", { precision: 2 })),
198305
+ /** CPU / board temperature (a host). */
198306
+ temperature: number$1().nullable().meta(readingMeta("temperature", { precision: 1 }))
198307
+ });
198308
+ var WorkloadPortProtocolSchema = _enum(["tcp", "udp"]);
198309
+ /** One published port: the workload's own port and where the host exposes it. */
198310
+ var WorkloadPortSchema = object({
198311
+ port: number$1().int().meta(readingMeta("none")),
198312
+ /** The host port it is published on; null = not published. */
198313
+ hostPort: number$1().int().nullable().meta(readingMeta("none")),
198314
+ /** The host address it is bound to; null = every address. */
198315
+ hostIp: string().nullable(),
198316
+ protocol: WorkloadPortProtocolSchema
198317
+ });
198318
+ var WorkloadStatusSchema = object({
198319
+ /** null = unknown, never stopped (D393). */
198320
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
198321
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
198322
+ since: number$1().nullable().meta(readingMeta("none")),
198323
+ /** The `host` device this runs on, when the provider has adopted it. */
198324
+ hostDeviceId: number$1().int().nullable().meta(readingMeta("device")),
198325
+ /** The image a container runs (`nginx:1.27`). */
198326
+ image: string().nullable(),
198327
+ /** The operating system (a VM, an LXC, a host). */
198328
+ os: string().nullable(),
198329
+ /** The version or firmware it runs. */
198330
+ version: string().nullable(),
198331
+ /** Starts with its host; null when the platform does not say. */
198332
+ autostart: boolean().nullable(),
198333
+ resources: WorkloadResourcesSchema,
198334
+ ports: array(WorkloadPortSchema),
198335
+ /** The addresses it is reachable on (IPs or host names). */
198336
+ addresses: array(string()),
198337
+ /** A newer image / version exists. Installing it stays the `update` cap. */
198338
+ updateAvailable: boolean().nullable(),
198339
+ lastFetchedAt: number$1()
198340
+ });
198341
+ /**
198342
+ * What this device can do, probed by its provider (D14 honesty): a flag is
198343
+ * `true` only when the platform really serves it for THIS device.
198344
+ */
198345
+ var WorkloadOptionsSchema = object({
198346
+ supportsStart: boolean(),
198347
+ supportsStop: boolean(),
198348
+ supportsRestart: boolean(),
198349
+ /** Pause AND resume. */
198350
+ supportsPause: boolean(),
198351
+ supportsForceStop: boolean(),
198352
+ hasResources: boolean(),
198353
+ hasPorts: boolean(),
198354
+ hasAddresses: boolean(),
198355
+ hasAutostart: boolean(),
198356
+ hasUpdateCheck: boolean()
198357
+ });
198358
+ var WorkloadDeviceInputSchema = object({ deviceId: number$1().int().nonnegative() });
198359
+ var WorkloadTransitionEventDataSchema = object({
198360
+ deviceId: number$1(),
198361
+ state: WorkloadStateSchema,
198362
+ previous: WorkloadStateSchema,
198363
+ since: number$1().nullable()
198364
+ });
198365
+ EventCategory.WorkloadStarted, EventCategory.WorkloadStopped, EventCategory.WorkloadCrashed, EventCategory.WorkloadRecovered;
198366
+ var workloadCapability = {
198367
+ name: "workload",
198368
+ scope: "device",
198369
+ deviceNative: true,
198370
+ mode: "singleton",
198371
+ deviceTypes: [DeviceType.Workload],
198372
+ deviceRoles: { [DeviceType.Workload]: WORKLOAD_ROLES },
198373
+ /**
198374
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
198375
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
198376
+ * second on/off state. A device whose provider serves no start / stop gets no
198377
+ * switch.
198378
+ */
198379
+ power: {
198380
+ kind: "methods",
198381
+ field: "state",
198382
+ offValues: ["stopped", "crashed"],
198383
+ on: "start",
198384
+ off: "stop"
198385
+ },
198386
+ methods: {
198387
+ start: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198388
+ kind: "mutation",
198389
+ auth: "protected",
198390
+ actions: [{
198391
+ id: "workload.start",
198392
+ label: t("Start", "Avvia"),
198393
+ phrase: t("Start {device}", "Avvia {device}"),
198394
+ icon: "play",
198395
+ effect: {
198396
+ field: "state",
198397
+ value: "running"
198398
+ }
198399
+ }]
198400
+ }),
198401
+ stop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198402
+ kind: "mutation",
198403
+ auth: "protected",
198404
+ actions: [{
198405
+ id: "workload.stop",
198406
+ label: t("Stop", "Arresta"),
198407
+ phrase: t("Stop {device}", "Arresta {device}"),
198408
+ icon: "square",
198409
+ effect: {
198410
+ field: "state",
198411
+ value: "stopped"
198412
+ }
198413
+ }]
198414
+ }),
198415
+ restart: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198416
+ kind: "mutation",
198417
+ auth: "protected",
198418
+ actions: [{
198419
+ id: "workload.restart",
198420
+ label: t("Restart", "Riavvia"),
198421
+ phrase: t("Restart {device}", "Riavvia {device}"),
198422
+ icon: "rotate-ccw"
198423
+ }]
198424
+ }),
198425
+ pause: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198426
+ kind: "mutation",
198427
+ auth: "protected",
198428
+ actions: [{
198429
+ id: "workload.pause",
198430
+ label: t("Pause", "Metti in pausa"),
198431
+ phrase: t("Pause {device}", "Metti in pausa {device}"),
198432
+ icon: "pause",
198433
+ effect: {
198434
+ field: "state",
198435
+ value: "paused"
198436
+ }
198437
+ }]
198438
+ }),
198439
+ resume: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198440
+ kind: "mutation",
198441
+ auth: "protected",
198442
+ actions: [{
198443
+ id: "workload.resume",
198444
+ label: t("Resume", "Riprendi"),
198445
+ phrase: t("Resume {device}", "Riprendi {device}"),
198446
+ icon: "circle-play",
198447
+ effect: {
198448
+ field: "state",
198449
+ value: "running"
198450
+ }
198451
+ }]
198452
+ }),
198453
+ forceStop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198454
+ kind: "mutation",
198455
+ auth: "admin",
198456
+ actions: [{
198457
+ id: "workload.forceStop",
198458
+ label: t("Force stop", "Arresto forzato"),
198459
+ phrase: t("Force {device} to stop", "Forza l’arresto di {device}"),
198460
+ icon: "octagon-x",
198461
+ effect: {
198462
+ field: "state",
198463
+ value: "stopped"
198464
+ }
198465
+ }]
198466
+ }),
198467
+ /** What THIS device can do, probed — the UI is derived from it. */
198468
+ getOptions: method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
198469
+ },
198470
+ events: {
198471
+ onStarted: {
198472
+ data: WorkloadTransitionEventDataSchema,
198473
+ trigger: {
198474
+ category: EventCategory.WorkloadStarted,
198475
+ label: t("Started", "Avviato"),
198476
+ phrase: t("When {device} starts", "Quando {device} si avvia"),
198477
+ icon: "play"
198478
+ }
198479
+ },
198480
+ onStopped: {
198481
+ data: WorkloadTransitionEventDataSchema,
198482
+ trigger: {
198483
+ category: EventCategory.WorkloadStopped,
198484
+ label: t("Stopped", "Arrestato"),
198485
+ phrase: t("When {device} stops", "Quando {device} si arresta"),
198486
+ icon: "square"
198487
+ }
198488
+ },
198489
+ onCrashed: {
198490
+ data: WorkloadTransitionEventDataSchema,
198491
+ trigger: {
198492
+ category: EventCategory.WorkloadCrashed,
198493
+ label: t("Crashed", "Arrestato in modo anomalo"),
198494
+ phrase: t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
198495
+ icon: "triangle-alert"
198496
+ }
198497
+ },
198498
+ onRecovered: {
198499
+ data: WorkloadTransitionEventDataSchema,
198500
+ trigger: {
198501
+ category: EventCategory.WorkloadRecovered,
198502
+ label: t("Recovered", "Ripristinato"),
198503
+ phrase: t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
198504
+ icon: "heart-pulse"
198505
+ }
198506
+ }
198507
+ },
198508
+ status: {
198509
+ schema: WorkloadStatusSchema,
198510
+ kind: "poll"
198511
+ },
198512
+ runtimeState: WorkloadStatusSchema,
198513
+ /**
198514
+ * Runtime-state durability: **session** — the provider answers on its next
198515
+ * poll; the series are recorded, so a restart that clears the slice loses
198516
+ * nothing a reader needs. The events are judged from the first state seen.
198517
+ */
198518
+ durability: "session",
198519
+ /**
198520
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
198521
+ * the charts need no per-metric child device.
198522
+ */
198523
+ history: {
198524
+ primary: "resources.cpuPercent",
198525
+ priority: 40,
198526
+ fields: {
198527
+ state: { kind: "enum" },
198528
+ "resources.cpuPercent": {
198529
+ kind: "gauge",
198530
+ unit: "%",
198531
+ deadband: 2,
198532
+ displayName: "CPU"
198533
+ },
198534
+ "resources.memoryUsedBytes": {
198535
+ kind: "gauge",
198536
+ unit: "bytes",
198537
+ displayName: "Memory used"
198538
+ },
198539
+ "resources.memoryPercent": {
198540
+ kind: "gauge",
198541
+ unit: "%",
198542
+ deadband: 2,
198543
+ displayName: "Memory"
198544
+ },
198545
+ "resources.netRxKbps": {
198546
+ group: "network",
198547
+ kind: "gauge",
198548
+ unit: "kbps",
198549
+ displayName: "Network received"
198550
+ },
198551
+ "resources.netTxKbps": {
198552
+ group: "network",
198553
+ kind: "gauge",
198554
+ unit: "kbps",
198555
+ displayName: "Network sent"
198556
+ }
198557
+ }
198558
+ },
198559
+ volatileStateFields: ["lastFetchedAt"],
198560
+ vocabulary: {
198561
+ noun: t("Workload", "Carico di lavoro"),
198562
+ order: 2400,
198563
+ state: [
198564
+ {
198565
+ kind: "enum",
198566
+ field: "state",
198567
+ label: t("State", "Stato"),
198568
+ values: [
198569
+ {
198570
+ value: "running",
198571
+ label: t("Running", "In esecuzione"),
198572
+ phrase: t("When {device} is running", "Quando {device} è in esecuzione")
198573
+ },
198574
+ {
198575
+ value: "paused",
198576
+ label: t("Paused", "In pausa")
198577
+ },
198578
+ {
198579
+ value: "stopped",
198580
+ label: t("Stopped", "Arrestato"),
198581
+ phrase: t("When {device} is stopped", "Quando {device} è arrestato")
198582
+ },
198583
+ {
198584
+ value: "starting",
198585
+ label: t("Starting", "In avvio")
198586
+ },
198587
+ {
198588
+ value: "stopping",
198589
+ label: t("Stopping", "In arresto")
198590
+ },
198591
+ {
198592
+ value: "crashed",
198593
+ label: t("Crashed", "Arrestato in modo anomalo"),
198594
+ phrase: t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
198595
+ }
198596
+ ],
198597
+ icon: "activity"
198598
+ },
198599
+ {
198600
+ kind: "numeric",
198601
+ field: "resources.cpuPercent",
198602
+ quantity: t("the CPU use", "l'uso della CPU"),
198603
+ label: t("CPU", "CPU"),
198604
+ unit: "%",
198605
+ icon: "cpu"
198606
+ },
198607
+ {
198608
+ kind: "numeric",
198609
+ field: "resources.memoryPercent",
198610
+ quantity: t("the memory use", "l'uso della memoria"),
198611
+ label: t("Memory", "Memoria"),
198612
+ unit: "%",
198613
+ icon: "memory-stick"
198614
+ },
198615
+ {
198616
+ kind: "numeric",
198617
+ field: "resources.temperature",
198618
+ quantity: t("the temperature", "la temperatura"),
198619
+ label: t("Temperature", "Temperatura"),
198620
+ unit: "°C",
198621
+ icon: "thermometer"
198622
+ }
198623
+ ],
198624
+ overrides: { byRole: {
198625
+ [DeviceRole.Vm]: {
198626
+ actions: { "workload.start": { icon: "monitor" } },
198627
+ state: { state: { icon: "monitor" } }
198628
+ },
198629
+ [DeviceRole.AppContainer]: {
198630
+ actions: { "workload.start": { icon: "container" } },
198631
+ state: { state: { icon: "container" } }
198632
+ },
198633
+ [DeviceRole.Lxc]: {
198634
+ actions: { "workload.start": { icon: "box" } },
198635
+ state: { state: { icon: "box" } }
198636
+ },
198637
+ [DeviceRole.App]: {
198638
+ actions: { "workload.start": { icon: "app-window" } },
198639
+ state: { state: { icon: "app-window" } }
198640
+ },
198641
+ [DeviceRole.Host]: {
198642
+ actions: {
198643
+ "workload.start": {
198644
+ label: t("Power on", "Accendi"),
198645
+ phrase: t("Power on {device}", "Accendi {device}"),
198646
+ icon: "power"
198647
+ },
198648
+ "workload.stop": {
198649
+ label: t("Shut down", "Spegni"),
198650
+ phrase: t("Shut down {device}", "Spegni {device}"),
198651
+ icon: "power-off"
198652
+ },
198653
+ "workload.restart": {
198654
+ label: t("Reboot", "Riavvia"),
198655
+ phrase: t("Reboot {device}", "Riavvia {device}"),
198656
+ icon: "refresh-cw"
198657
+ }
198658
+ },
198659
+ state: { state: { icon: "server" } },
198660
+ events: {
198661
+ onStarted: {
198662
+ label: t("Came online", "Tornato in linea"),
198663
+ phrase: t("When {device} comes online", "Quando {device} torna in linea"),
198664
+ icon: "server"
198665
+ },
198666
+ onStopped: {
198667
+ label: t("Shut down", "Spento"),
198668
+ phrase: t("When {device} shuts down", "Quando {device} si spegne"),
198669
+ icon: "server-off"
198670
+ },
198671
+ onCrashed: {
198672
+ label: t("Went down", "Caduto"),
198673
+ phrase: t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
198674
+ icon: "server-crash"
198675
+ },
198676
+ onRecovered: {
198677
+ label: t("Came online", "Tornato in linea"),
198678
+ phrase: t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
198679
+ icon: "server"
198680
+ }
198681
+ }
198682
+ }
198683
+ } }
198684
+ }
198685
+ };
196988
198686
  /**
196989
198687
  * Per-zone occupancy aggregation produced by the analytics frame
196990
198688
  * processor on every inference result. Covers the full combinatorial
@@ -197605,34 +199303,36 @@ var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_K
197605
199303
  * Pure duration maths for the `siren` cap, shared by every provider so a
197606
199304
  * trigger and the countdown it publishes mean the same thing everywhere.
197607
199305
  */
199306
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
199307
+ var MAX_PLAY_CHOICES = 200;
197608
199308
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
197609
199309
  function sirenIdleStatus(previous) {
197610
199310
  return {
197611
199311
  active: false,
197612
199312
  activeUntil: null,
197613
199313
  durationSeconds: previous?.durationSeconds ?? null,
199314
+ plays: previous?.plays ?? null,
199315
+ activeUntilEstimated: false,
197614
199316
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
197615
199317
  };
197616
199318
  }
197617
- /** The state right after a timed trigger: sounding until `now + seconds`. */
197618
- function sirenTriggeredStatus(nowMs, seconds) {
199319
+ /**
199320
+ * The state right after a timed trigger: sounding until `now + seconds`. A
199321
+ * trigger asked in plays passes its count, and whether that end is an estimate.
199322
+ */
199323
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
197619
199324
  return {
197620
199325
  active: true,
197621
199326
  activeUntil: nowMs + Math.round(seconds * 1e3),
197622
199327
  durationSeconds: seconds,
199328
+ plays: activation?.plays ?? null,
199329
+ activeUntilEstimated: activation?.estimated ?? false,
197623
199330
  lastTriggeredAt: nowMs
197624
199331
  };
197625
199332
  }
197626
- /**
197627
- * The duration a trigger will really use: the request (or the camera default)
197628
- * snapped to what the camera allows — the nearest listed value, or clamped and
197629
- * stepped inside the range. Never longer or shorter than the camera can play.
197630
- */
197631
- function resolveSirenSeconds(options, requested) {
197632
- const wanted = requested ?? options.defaultSeconds;
197633
- const list = options.allowedSeconds;
199333
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
199334
+ function snap(list, range, wanted) {
197634
199335
  if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
197635
- const range = options.rangeSeconds;
197636
199336
  if (range !== null) {
197637
199337
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
197638
199338
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -197641,6 +199341,60 @@ function resolveSirenSeconds(options, requested) {
197641
199341
  return wanted;
197642
199342
  }
197643
199343
  /**
199344
+ * The duration a trigger will really use: the request (or the camera default)
199345
+ * snapped to what the camera allows — the nearest listed value, or clamped and
199346
+ * stepped inside the range. Never longer or shorter than the camera can play.
199347
+ */
199348
+ function resolveSirenSeconds(options, requested) {
199349
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
199350
+ }
199351
+ /**
199352
+ * The play count a trigger will really use, snapped like the seconds; `null`
199353
+ * when the camera declares no plays (it counts seconds).
199354
+ */
199355
+ function resolveSirenPlays(options, requested) {
199356
+ if (options.defaultPlays === null) return null;
199357
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
199358
+ }
199359
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
199360
+ function sirenPlayChoices(options) {
199361
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
199362
+ const range = options.rangePlays;
199363
+ if (range === null) return [];
199364
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
199365
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
199366
+ }
199367
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
199368
+ function playsEndIsEstimate(options) {
199369
+ return options.source !== SirenOptionsSource.Camera;
199370
+ }
199371
+ /**
199372
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
199373
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
199374
+ * snapping. Never both — the input schema refuses that before it gets here.
199375
+ */
199376
+ function planSirenTrigger(options, request) {
199377
+ if (request.plays !== void 0) {
199378
+ const plays = resolveSirenPlays(options, request.plays);
199379
+ if (plays === null) return {
199380
+ asked: "refused",
199381
+ reason: "this siren counts seconds, not plays"
199382
+ };
199383
+ const factor = options.secondsPerPlay;
199384
+ return {
199385
+ asked: "plays",
199386
+ plays,
199387
+ seconds: factor === null ? null : plays * factor,
199388
+ estimated: factor === null || playsEndIsEstimate(options)
199389
+ };
199390
+ }
199391
+ return {
199392
+ asked: "seconds",
199393
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
199394
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
199395
+ };
199396
+ }
199397
+ /**
197644
199398
  * Day-of-week names in the cap's index order (0 = Monday), for messages
197645
199399
  * an operator reads and for Hikvision's `<DayOfWeek>` element.
197646
199400
  */
@@ -198679,6 +200433,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
198679
200433
  irTransmitter: irTransmitterCapability,
198680
200434
  lawnMowerControl: lawnMowerControlCapability,
198681
200435
  lockControl: lockControlCapability,
200436
+ lowPowerSleep: lowPowerSleepCapability,
198682
200437
  mediaPlayer: mediaPlayerCapability,
198683
200438
  meter: meterCapability,
198684
200439
  motion: motionCapability,
@@ -198719,11 +200474,65 @@ var DEVICE_LOCAL_STATE_CAPS = {
198719
200474
  waterHeater: waterHeaterCapability,
198720
200475
  weather: weatherCapability,
198721
200476
  weatherStation: weatherStationCapability,
200477
+ workload: workloadCapability,
198722
200478
  zoneAnalytics: zoneAnalyticsCapability,
198723
200479
  zoneRules: zoneRulesCapability,
198724
200480
  zones: zonesCapability
198725
200481
  };
198726
200482
  /**
200483
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
200484
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
200485
+ * read keeps what was stored) — pass everything the provider read in one call.
200486
+ */
200487
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
200488
+ const { deviceId, logger, writer } = deps;
200489
+ const { unread, ...normaliseOptions } = options;
200490
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
200491
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
200492
+ tags: { deviceId },
200493
+ meta: {
200494
+ key: r.key,
200495
+ value: r.value,
200496
+ reason: r.reason
200497
+ }
200498
+ });
200499
+ const unreadKinds = new Set(unread ?? []);
200500
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
200501
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
200502
+ return {
200503
+ outcome: "nothing-to-declare",
200504
+ identifiers
200505
+ };
200506
+ }
200507
+ if (writer === void 0) {
200508
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
200509
+ return {
200510
+ outcome: "unavailable",
200511
+ identifiers
200512
+ };
200513
+ }
200514
+ try {
200515
+ await writer.mutate({
200516
+ deviceId,
200517
+ identifiers,
200518
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
200519
+ });
200520
+ return {
200521
+ outcome: "declared",
200522
+ identifiers
200523
+ };
200524
+ } catch (err) {
200525
+ logger.warn("identifiers not declared — setIdentifiers failed", {
200526
+ tags: { deviceId },
200527
+ meta: { error: errMsg$3(err) }
200528
+ });
200529
+ return {
200530
+ outcome: "failed",
200531
+ identifiers
200532
+ };
200533
+ }
200534
+ }
200535
+ /**
198727
200536
  * The edge between two readings, or `null` for no edge.
198728
200537
  *
198729
200538
  * - `null`/cold → `true` is a START (a fault already open at boot is one);
@@ -198775,6 +200584,8 @@ var BaseDevice = class {
198775
200584
  id;
198776
200585
  stableId;
198777
200586
  type;
200587
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
200588
+ statusIsExternal;
198778
200589
  name;
198779
200590
  parentDeviceId;
198780
200591
  role;
@@ -198923,21 +200734,26 @@ var BaseDevice = class {
198923
200734
  };
198924
200735
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
198925
200736
  ctx.bindRuntimeState?.(this.runtimeState);
198926
- ctx.registerNativeCap?.(deviceStatusCapability, {});
198927
- const seed = {
198928
- online: true,
198929
- lastChangedAt: Date.now()
198930
- };
198931
- this.runtimeState.setCapState("device-status", seed);
198932
- ctx.registerNativeCap?.(featureProbeCapability, {});
198933
- this.runtimeState.setCapState("feature-probe", {
198934
- flags: {},
198935
- deviceType: null,
198936
- model: null,
198937
- channelCount: null,
198938
- lastProbedAt: 0,
198939
- lastFetchedAt: 0
198940
- });
200737
+ this.statusIsExternal = options.deviceStatus === "external";
200738
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
200739
+ if (!this.statusIsExternal) {
200740
+ const seed = {
200741
+ online: true,
200742
+ lastChangedAt: Date.now()
200743
+ };
200744
+ this.runtimeState.setCapState("device-status", seed);
200745
+ }
200746
+ if (!this.statusIsExternal) {
200747
+ ctx.registerNativeCap?.(featureProbeCapability, {});
200748
+ this.runtimeState.setCapState("feature-probe", {
200749
+ flags: {},
200750
+ deviceType: null,
200751
+ model: null,
200752
+ channelCount: null,
200753
+ lastProbedAt: 0,
200754
+ lastFetchedAt: 0
200755
+ });
200756
+ }
198941
200757
  }
198942
200758
  deviceActions = /* @__PURE__ */ new Map();
198943
200759
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -198965,7 +200781,7 @@ var BaseDevice = class {
198965
200781
  * override to gate side effects on the transition.
198966
200782
  */
198967
200783
  markOnline(online) {
198968
- if (this.online === online) return;
200784
+ if (this.statusIsExternal || this.online === online) return;
198969
200785
  const next = {
198970
200786
  online,
198971
200787
  lastChangedAt: Date.now()
@@ -199035,6 +200851,24 @@ var BaseDevice = class {
199035
200851
  }));
199036
200852
  }
199037
200853
  /**
200854
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
200855
+ * machine uuid, hostname, IP — what a later step matches across integrations.
200856
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
200857
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
200858
+ * only from the provider that owns this device. Each kind it carries replaces
200859
+ * the stored one and each kind it lacks is removed — except the kinds listed in
200860
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
200861
+ * everything read in one call; a call where every kind is unread writes
200862
+ * nothing. Best-effort: never throws.
200863
+ */
200864
+ async declareIdentifiers(raw, options) {
200865
+ return declareDeviceIdentifiers({
200866
+ deviceId: this.id,
200867
+ logger: this.ctx.logger,
200868
+ writer: this.ctx.api.deviceManager?.setIdentifiers
200869
+ }, raw, options);
200870
+ }
200871
+ /**
199038
200872
  * Re-publish the device's current `features` array to the persisted
199039
200873
  * meta blob. Drivers call this after a probe finishes when the live
199040
200874
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -199239,6 +201073,7 @@ var BaseDevice = class {
199239
201073
  * `lastProbedAt`) once their probe actually succeeds.
199240
201074
  */
199241
201075
  async onProbe() {
201076
+ if (this.statusIsExternal) return;
199242
201077
  const base = this.runtimeState.getCapState("feature-probe") ?? {
199243
201078
  flags: {},
199244
201079
  deviceType: null,
@@ -200078,8 +201913,21 @@ var BaseDeviceProvider = class extends BaseAddon {
200078
201913
  return toDeviceSummary(device, this.addonId);
200079
201914
  }
200080
201915
  };
201916
+ /**
201917
+ * The `low-power-sleep` slice a provider projects from the `battery` slice it
201918
+ * already keeps: the sleep inputs, nothing else. One fact, one writer — the
201919
+ * provider's battery bookkeeping stays the source until the sleep state gets
201920
+ * its own writer.
201921
+ */
201922
+ function sleepSliceOfBattery(status) {
201923
+ return {
201924
+ sleeping: status.sleeping,
201925
+ ...status.lastContactAt !== void 0 ? { lastContactAt: status.lastContactAt } : {},
201926
+ lastUpdated: status.lastUpdated
201927
+ };
201928
+ }
200081
201929
  DeviceType.HeatPump;
200082
- 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;
201930
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
200083
201931
  new Set(Object.values(DeviceType));
200084
201932
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
200085
201933
  function contribution(cap, schema, build) {
@@ -200288,8 +202136,8 @@ var ALARM_MODES = [
200288
202136
  "vacation",
200289
202137
  "custom_bypass"
200290
202138
  ];
200291
- function alarmControls(state, modes, requiresCode) {
200292
- if (requiresCode) return [];
202139
+ function alarmControls(state, modes, codeRequired) {
202140
+ if (codeRequired) return [];
200293
202141
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
200294
202142
  const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
200295
202143
  switch (state) {
@@ -200309,7 +202157,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
200309
202157
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
200310
202158
  return {
200311
202159
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
200312
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
202160
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
200313
202161
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
200314
202162
  ...words === null ? {} : { tiles: {
200315
202163
  left: [{
@@ -202135,7 +203983,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
202135
203983
  ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
202136
203984
  ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
202137
203985
  ];
202138
- 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;
203986
+ 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;
202139
203987
  /**
202140
203988
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
202141
203989
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -202779,8 +204627,8 @@ lookOf({
202779
204627
  standby: MUTED
202780
204628
  });
202781
204629
  DeviceType.Climate;
202782
- 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;
202783
- 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;
204630
+ 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;
204631
+ 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;
202784
204632
  Object.freeze({
202785
204633
  "accessories.getStatus": {
202786
204634
  capName: "accessories",
@@ -203692,13 +205540,6 @@ Object.freeze({
203692
205540
  access: "view",
203693
205541
  role: "viewer"
203694
205542
  },
203695
- "battery.wakeForStream": {
203696
- capName: "battery",
203697
- capScope: "device",
203698
- addonId: null,
203699
- access: "create",
203700
- role: "viewer"
203701
- },
203702
205543
  "binary.getStatus": {
203703
205544
  capName: "binary",
203704
205545
  capScope: "device",
@@ -205225,6 +207066,13 @@ Object.freeze({
205225
207066
  access: "view",
205226
207067
  role: "admin"
205227
207068
  },
207069
+ "deviceManager.listIdentityCandidates": {
207070
+ capName: "device-manager",
207071
+ capScope: "system",
207072
+ addonId: null,
207073
+ access: "view",
207074
+ role: "admin"
207075
+ },
205228
207076
  "deviceManager.listLocationDescriptions": {
205229
207077
  capName: "device-manager",
205230
207078
  capScope: "system",
@@ -205442,6 +207290,13 @@ Object.freeze({
205442
207290
  access: "create",
205443
207291
  role: "admin"
205444
207292
  },
207293
+ "deviceManager.setIdentifiers": {
207294
+ capName: "device-manager",
207295
+ capScope: "system",
207296
+ addonId: null,
207297
+ access: "create",
207298
+ role: "admin"
207299
+ },
205445
207300
  "deviceManager.setIntegrationId": {
205446
207301
  capName: "device-manager",
205447
207302
  capScope: "system",
@@ -207339,6 +209194,20 @@ Object.freeze({
207339
209194
  access: "view",
207340
209195
  role: "admin"
207341
209196
  },
209197
+ "lowPowerSleep.getStatus": {
209198
+ capName: "low-power-sleep",
209199
+ capScope: "device",
209200
+ addonId: null,
209201
+ access: "view",
209202
+ role: "viewer"
209203
+ },
209204
+ "lowPowerSleep.wakeUp": {
209205
+ capName: "low-power-sleep",
209206
+ capScope: "device",
209207
+ addonId: null,
209208
+ access: "create",
209209
+ role: "viewer"
209210
+ },
207342
209211
  "mediaPlayer.channelDown": {
207343
209212
  capName: "media-player",
207344
209213
  capScope: "device",
@@ -208326,6 +210195,13 @@ Object.freeze({
208326
210195
  access: "view",
208327
210196
  role: "admin"
208328
210197
  },
210198
+ "notificationRules.listRuleTags": {
210199
+ capName: "notification-rules",
210200
+ capScope: "system",
210201
+ addonId: null,
210202
+ access: "view",
210203
+ role: "admin"
210204
+ },
208329
210205
  "notificationRules.listSnoozes": {
208330
210206
  capName: "notification-rules",
208331
210207
  capScope: "system",
@@ -208382,6 +210258,13 @@ Object.freeze({
208382
210258
  access: "create",
208383
210259
  role: "admin"
208384
210260
  },
210261
+ "notificationRules.setRuleTags": {
210262
+ capName: "notification-rules",
210263
+ capScope: "system",
210264
+ addonId: null,
210265
+ access: "create",
210266
+ role: "admin"
210267
+ },
208385
210268
  "notificationRules.testRule": {
208386
210269
  capName: "notification-rules",
208387
210270
  capScope: "system",
@@ -211000,6 +212883,13 @@ Object.freeze({
211000
212883
  access: "view",
211001
212884
  role: "admin"
211002
212885
  },
212886
+ "resync.resync": {
212887
+ capName: "resync",
212888
+ capScope: "device",
212889
+ addonId: null,
212890
+ access: "create",
212891
+ role: "admin"
212892
+ },
211003
212893
  "runningState.getStatus": {
211004
212894
  capName: "running-state",
211005
212895
  capScope: "device",
@@ -211350,6 +213240,13 @@ Object.freeze({
211350
213240
  access: "view",
211351
213241
  role: "viewer"
211352
213242
  },
213243
+ "siren.getPlayChoices": {
213244
+ capName: "siren",
213245
+ capScope: "device",
213246
+ addonId: null,
213247
+ access: "view",
213248
+ role: "viewer"
213249
+ },
211353
213250
  "siren.getStatus": {
211354
213251
  capName: "siren",
211355
213252
  capScope: "device",
@@ -212162,6 +214059,13 @@ Object.freeze({
212162
214059
  access: "view",
212163
214060
  role: "viewer"
212164
214061
  },
214062
+ "switch.getOptions": {
214063
+ capName: "switch",
214064
+ capScope: "device",
214065
+ addonId: null,
214066
+ access: "view",
214067
+ role: "viewer"
214068
+ },
212165
214069
  "switch.getStatus": {
212166
214070
  capName: "switch",
212167
214071
  capScope: "device",
@@ -212169,6 +214073,13 @@ Object.freeze({
212169
214073
  access: "view",
212170
214074
  role: "viewer"
212171
214075
  },
214076
+ "switch.powerCycle": {
214077
+ capName: "switch",
214078
+ capScope: "device",
214079
+ addonId: null,
214080
+ access: "create",
214081
+ role: "viewer"
214082
+ },
212172
214083
  "switch.setState": {
212173
214084
  capName: "switch",
212174
214085
  capScope: "device",
@@ -212372,13 +214283,6 @@ Object.freeze({
212372
214283
  access: "create",
212373
214284
  role: "admin"
212374
214285
  },
212375
- "terminalSession.adoptLegacyMonitor": {
212376
- capName: "terminal-session",
212377
- capScope: "system",
212378
- addonId: null,
212379
- access: "create",
212380
- role: "admin"
212381
- },
212382
214286
  "terminalSession.close": {
212383
214287
  capName: "terminal-session",
212384
214288
  capScope: "system",
@@ -212386,13 +214290,6 @@ Object.freeze({
212386
214290
  access: "create",
212387
214291
  role: "admin"
212388
214292
  },
212389
- "terminalSession.listLegacyCameras": {
212390
- capName: "terminal-session",
212391
- capScope: "system",
212392
- addonId: null,
212393
- access: "view",
212394
- role: "admin"
212395
- },
212396
214293
  "terminalSession.listProfiles": {
212397
214294
  capName: "terminal-session",
212398
214295
  capScope: "system",
@@ -213254,6 +215151,62 @@ Object.freeze({
213254
215151
  access: "view",
213255
215152
  role: "viewer"
213256
215153
  },
215154
+ "workload.forceStop": {
215155
+ capName: "workload",
215156
+ capScope: "device",
215157
+ addonId: null,
215158
+ access: "create",
215159
+ role: "admin"
215160
+ },
215161
+ "workload.getOptions": {
215162
+ capName: "workload",
215163
+ capScope: "device",
215164
+ addonId: null,
215165
+ access: "view",
215166
+ role: "viewer"
215167
+ },
215168
+ "workload.getStatus": {
215169
+ capName: "workload",
215170
+ capScope: "device",
215171
+ addonId: null,
215172
+ access: "view",
215173
+ role: "viewer"
215174
+ },
215175
+ "workload.pause": {
215176
+ capName: "workload",
215177
+ capScope: "device",
215178
+ addonId: null,
215179
+ access: "create",
215180
+ role: "viewer"
215181
+ },
215182
+ "workload.restart": {
215183
+ capName: "workload",
215184
+ capScope: "device",
215185
+ addonId: null,
215186
+ access: "create",
215187
+ role: "viewer"
215188
+ },
215189
+ "workload.resume": {
215190
+ capName: "workload",
215191
+ capScope: "device",
215192
+ addonId: null,
215193
+ access: "create",
215194
+ role: "viewer"
215195
+ },
215196
+ "workload.start": {
215197
+ capName: "workload",
215198
+ capScope: "device",
215199
+ addonId: null,
215200
+ access: "create",
215201
+ role: "viewer"
215202
+ },
215203
+ "workload.stop": {
215204
+ capName: "workload",
215205
+ capScope: "device",
215206
+ addonId: null,
215207
+ access: "create",
215208
+ role: "viewer"
215209
+ },
213257
215210
  "zoneAnalytics.getCameraHistory": {
213258
215211
  capName: "zone-analytics",
213259
215212
  capScope: "device",
@@ -213332,7 +215285,7 @@ Object.freeze({
213332
215285
  role: "admin"
213333
215286
  }
213334
215287
  });
213335
- DeviceFeature.BatteryOperated;
215288
+ DeviceFeature.Sleeps;
213336
215289
  function bound(cap, methods = [], authority = "reported") {
213337
215290
  return {
213338
215291
  kind: "cap",
@@ -213344,11 +215297,11 @@ function bound(cap, methods = [], authority = "reported") {
213344
215297
  function derived(cap, methods = []) {
213345
215298
  return bound(cap, methods, "derived");
213346
215299
  }
213347
- DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
215300
+ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep", ["wakeUp"]), DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, derived("resync", ["resync"]), DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
213348
215301
  "startTalkSession",
213349
215302
  "pushTalkAudio",
213350
215303
  "endTalkSession"
213351
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockPinRequired, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.AlarmPinRequired, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasMap, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasMap, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
215304
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
213352
215305
  var ALL_FEATURES = Object.values(DeviceFeature);
213353
215306
  new Set(ALL_FEATURES);
213354
215307
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -213390,8 +215343,8 @@ function offered(received) {
213390
215343
  };
213391
215344
  }
213392
215345
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
213393
- 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;
213394
- 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;
215346
+ 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;
215347
+ 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;
213395
215348
  new Set(Object.values(DeviceType));
213396
215349
  new Set(Object.values(DeviceRole));
213397
215350
  var LAST_FETCHED_FIELD = "lastFetchedAt";
@@ -213696,11 +215649,6 @@ Object.freeze({
213696
215649
  form: "single",
213697
215650
  optional: false
213698
215651
  }],
213699
- "battery.wakeForStream": [{
213700
- name: "deviceId",
213701
- form: "single",
213702
- optional: false
213703
- }],
213704
215652
  "binary.getStatus": [{
213705
215653
  name: "deviceId",
213706
215654
  form: "single",
@@ -214245,6 +216193,11 @@ Object.freeze({
214245
216193
  form: "single",
214246
216194
  optional: false
214247
216195
  }],
216196
+ "deviceManager.setIdentifiers": [{
216197
+ name: "deviceId",
216198
+ form: "single",
216199
+ optional: false
216200
+ }],
214248
216201
  "deviceManager.setIntegrationId": [{
214249
216202
  name: "deviceId",
214250
216203
  form: "single",
@@ -214879,6 +216832,16 @@ Object.freeze({
214879
216832
  form: "single",
214880
216833
  optional: true
214881
216834
  }],
216835
+ "lowPowerSleep.getStatus": [{
216836
+ name: "deviceId",
216837
+ form: "single",
216838
+ optional: false
216839
+ }],
216840
+ "lowPowerSleep.wakeUp": [{
216841
+ name: "deviceId",
216842
+ form: "single",
216843
+ optional: false
216844
+ }],
214882
216845
  "mediaPlayer.channelDown": [{
214883
216846
  name: "deviceId",
214884
216847
  form: "single",
@@ -216164,6 +218127,11 @@ Object.freeze({
216164
218127
  form: "single",
216165
218128
  optional: false
216166
218129
  }],
218130
+ "resync.resync": [{
218131
+ name: "deviceId",
218132
+ form: "single",
218133
+ optional: false
218134
+ }],
216167
218135
  "runningState.getStatus": [{
216168
218136
  name: "deviceId",
216169
218137
  form: "single",
@@ -216239,6 +218207,11 @@ Object.freeze({
216239
218207
  form: "single",
216240
218208
  optional: false
216241
218209
  }],
218210
+ "siren.getPlayChoices": [{
218211
+ name: "deviceId",
218212
+ form: "single",
218213
+ optional: false
218214
+ }],
216242
218215
  "siren.getStatus": [{
216243
218216
  name: "deviceId",
216244
218217
  form: "single",
@@ -216421,11 +218394,21 @@ Object.freeze({
216421
218394
  form: "single",
216422
218395
  optional: false
216423
218396
  }],
218397
+ "switch.getOptions": [{
218398
+ name: "deviceId",
218399
+ form: "single",
218400
+ optional: false
218401
+ }],
216424
218402
  "switch.getStatus": [{
216425
218403
  name: "deviceId",
216426
218404
  form: "single",
216427
218405
  optional: false
216428
218406
  }],
218407
+ "switch.powerCycle": [{
218408
+ name: "deviceId",
218409
+ form: "single",
218410
+ optional: false
218411
+ }],
216429
218412
  "switch.setState": [{
216430
218413
  name: "deviceId",
216431
218414
  form: "single",
@@ -216666,6 +218649,46 @@ Object.freeze({
216666
218649
  form: "single",
216667
218650
  optional: false
216668
218651
  }],
218652
+ "workload.forceStop": [{
218653
+ name: "deviceId",
218654
+ form: "single",
218655
+ optional: false
218656
+ }],
218657
+ "workload.getOptions": [{
218658
+ name: "deviceId",
218659
+ form: "single",
218660
+ optional: false
218661
+ }],
218662
+ "workload.getStatus": [{
218663
+ name: "deviceId",
218664
+ form: "single",
218665
+ optional: false
218666
+ }],
218667
+ "workload.pause": [{
218668
+ name: "deviceId",
218669
+ form: "single",
218670
+ optional: false
218671
+ }],
218672
+ "workload.restart": [{
218673
+ name: "deviceId",
218674
+ form: "single",
218675
+ optional: false
218676
+ }],
218677
+ "workload.resume": [{
218678
+ name: "deviceId",
218679
+ form: "single",
218680
+ optional: false
218681
+ }],
218682
+ "workload.start": [{
218683
+ name: "deviceId",
218684
+ form: "single",
218685
+ optional: false
218686
+ }],
218687
+ "workload.stop": [{
218688
+ name: "deviceId",
218689
+ form: "single",
218690
+ optional: false
218691
+ }],
216669
218692
  "zoneAnalytics.getCameraHistory": [{
216670
218693
  name: "deviceId",
216671
218694
  form: "single",
@@ -217882,6 +219905,8 @@ var TimelapseRuleInputSchema = object({
217882
219905
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
217883
219906
  priority: PriorityField.default(3),
217884
219907
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219908
+ /** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
219909
+ tags: TagsFieldSchema.optional(),
217885
219910
  targetOverrides: NcTargetOverridesSchema.optional()
217886
219911
  });
217887
219912
  object({
@@ -217900,6 +219925,8 @@ object({
217900
219925
  reportClasses: ReportClassesField.optional(),
217901
219926
  priority: PriorityField.optional(),
217902
219927
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219928
+ /** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
219929
+ tags: TagsFieldSchema.optional(),
217903
219930
  targetOverrides: NcTargetOverridesSchema.optional()
217904
219931
  });
217905
219932
  TimelapseRuleInputSchema.extend({
@@ -220061,7 +222088,8 @@ var STREAM_HEADERS = {
220061
222088
  [CLIP_STREAM_TRANSPORT_HEADER]: "forward-only"
220062
222089
  };
220063
222090
  /** The status a refusal answers. `404` = nothing here to serve; `409` = a
220064
- * clip that exists and cannot be served right now; `502` = the camera. */
222091
+ * clip that exists and cannot be served right now; `502` = the camera;
222092
+ * `504` = the camera did not come up inside the wake's bound. */
220065
222093
  function streamRefusalStatus(code) {
220066
222094
  switch (code) {
220067
222095
  case "unknown-device":
@@ -220071,6 +222099,7 @@ function streamRefusalStatus(code) {
220071
222099
  case "clip-in-progress": return 409;
220072
222100
  case "camera-refused":
220073
222101
  case "fetch-failed": return 502;
222102
+ case "wake-timeout": return 504;
220074
222103
  }
220075
222104
  }
220076
222105
  function createClipStreamHandler(deps) {
@@ -223075,7 +225104,7 @@ function createReolinkVideoclipsProvider(deps) {
223075
225104
  * actually carries. Refusing left the operator with `high` looking
223076
225105
  * unsupported, and left two transports behind one pointer.
223077
225106
  */
223078
- dialClipStream: async ({ deviceId, clipId, profile, audio }) => {
225107
+ dialClipStream: async ({ deviceId, clipId, profile, audio, wake }) => {
223079
225108
  const tags = { deviceId };
223080
225109
  const refuse = (code, detail, meta) => {
223081
225110
  deps.logger.warn("videoclips: refusing a clip stream dial", {
@@ -223114,7 +225143,8 @@ function createReolinkVideoclipsProvider(deps) {
223114
225143
  deviceId,
223115
225144
  row,
223116
225145
  twin: chosen.twin,
223117
- audio: askedAudio
225146
+ audio: askedAudio,
225147
+ ...wake !== void 0 ? { wake } : {}
223118
225148
  });
223119
225149
  if (outcome.kind === "refused") return refuse(outcome.code, outcome.detail, {
223120
225150
  clipKey,
@@ -223352,6 +225382,13 @@ function createReolinkVideoclipsProvider(deps) {
223352
225382
  * constructs a `ReolinkBaichuanApi`, and that is enforced by the provider spec
223353
225383
  * rather than by hope.
223354
225384
  */
225385
+ /**
225386
+ * How long an AUTHORISED clip read or dial waits for a sleeping standalone
225387
+ * battery camera to come up — the bound `wakeIfSleeping` already applies to
225388
+ * every other operator wake on this provider. Past it the read is refused
225389
+ * `wake-timeout`, naming this number, and no session is opened.
225390
+ */
225391
+ var CLIP_WAKE_TIMEOUT_MS = 15e3;
223355
225392
  function createClipService(deps) {
223356
225393
  const now = deps.now ?? (() => Date.now());
223357
225394
  const cache = new ClipCatalogCache({ now });
@@ -223383,6 +225420,21 @@ function createClipService(deps) {
223383
225420
  * a battery camera the operator authorised once.
223384
225421
  */
223385
225422
  const producing = /* @__PURE__ */ new Map();
225423
+ /**
225424
+ * One wake in flight per camera. The file map above de-duplicates a
225425
+ * production per twin; a dial and a read of DIFFERENT twins, or two dials,
225426
+ * would otherwise each send their own wake to the same radio.
225427
+ */
225428
+ const waking = /* @__PURE__ */ new Map();
225429
+ const wakeOnce = (deviceId) => {
225430
+ const inFlight = waking.get(deviceId);
225431
+ if (inFlight !== void 0) return inFlight;
225432
+ const started = deps.wakeDevice(deviceId, CLIP_WAKE_TIMEOUT_MS).finally(() => {
225433
+ waking.delete(deviceId);
225434
+ });
225435
+ waking.set(deviceId, started);
225436
+ return started;
225437
+ };
223386
225438
  const rowFor = (deviceId, clipKey) => {
223387
225439
  return cache.findBy(deviceId, (row) => row.clipKey === clipKey);
223388
225440
  };
@@ -223572,7 +225624,7 @@ function createClipService(deps) {
223572
225624
  const gateClipDevice = async (input) => {
223573
225625
  const { deviceId, clipKey, twin, path } = input;
223574
225626
  const tags = { deviceId };
223575
- const device = await deps.resolveDevice(deviceId);
225627
+ let device = await deps.resolveDevice(deviceId);
223576
225628
  if (device === null) {
223577
225629
  deps.logger.warn("videoclips: no Reolink camera here to fetch this clip from", {
223578
225630
  tags,
@@ -223614,9 +225666,47 @@ function createClipService(deps) {
223614
225666
  clipKey,
223615
225667
  twin,
223616
225668
  path,
223617
- branch: "wake-authorised"
225669
+ branch: "wake-authorised",
225670
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
223618
225671
  }
223619
225672
  });
225673
+ if (!await wakeOnce(deviceId)) {
225674
+ deps.logger.warn("videoclips: the authorised wake did not bring the camera up in time", {
225675
+ tags,
225676
+ meta: {
225677
+ clipKey,
225678
+ twin,
225679
+ path,
225680
+ branch: "wake-timeout",
225681
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
225682
+ }
225683
+ });
225684
+ return {
225685
+ kind: "refused",
225686
+ branch: "wake-timeout",
225687
+ code: "wake-timeout",
225688
+ 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`
225689
+ };
225690
+ }
225691
+ const awake = await deps.resolveDevice(deviceId);
225692
+ if (awake === null) {
225693
+ deps.logger.warn("videoclips: the camera left this runner while it was being woken", {
225694
+ tags,
225695
+ meta: {
225696
+ clipKey,
225697
+ twin,
225698
+ path,
225699
+ branch: "unknown-device"
225700
+ }
225701
+ });
225702
+ return {
225703
+ kind: "refused",
225704
+ branch: "unknown-device",
225705
+ code: "catalog-unreachable",
225706
+ detail: `device ${deviceId} is not a Reolink camera on this node`
225707
+ };
225708
+ }
225709
+ device = awake;
223620
225710
  }
223621
225711
  if (uidIsMissing(device)) {
223622
225712
  deps.logger.warn("videoclips: no uid for this camera — its clip cannot be addressed", {
@@ -223931,12 +226021,13 @@ function createClipService(deps) {
223931
226021
  }),
223932
226022
  prepareBytes,
223933
226023
  prepareOffer,
223934
- prepareStreamDial: async ({ deviceId, row, twin, audio }) => {
226024
+ prepareStreamDial: async ({ deviceId, row, twin, audio, wake }) => {
223935
226025
  const gate = await gateClipDevice({
223936
226026
  deviceId,
223937
226027
  clipKey: row.clipKey,
223938
226028
  twin,
223939
- path: "stream"
226029
+ path: "stream",
226030
+ ...wake !== void 0 ? { wake } : {}
223940
226031
  });
223941
226032
  if (gate.kind === "refused") return {
223942
226033
  kind: "refused",
@@ -225200,7 +227291,8 @@ function capDayNightModeToReolink(mode) {
225200
227291
  * `features = ['native-snapshot','rebootable']` because the `feature-probe`
225201
227292
  * slice had never been written.
225202
227293
  *
225203
- * That miss is not cosmetic. `DeviceFeature.BatteryOperated` is the gate for:
227294
+ * That miss is not cosmetic. `DeviceFeature.BatteryOperated` (and, since #459,
227295
+ * `DeviceFeature.Sleeps` beside it) is the gate for:
225204
227296
  * - the viewer's battery badge + sleeping overlay (`use-cameras.ts` FEATURE
225205
227297
  * map) — without it the camera is drawn as an ordinary awake camera;
225206
227298
  * - the snapshot wrapper's sleep gate (`snapshot.addon.ts`
@@ -225214,10 +227306,19 @@ function capDayNightModeToReolink(mode) {
225214
227306
  * clears it). This makes the DERIVED answer sticky the same way, for the
225215
227307
  * window before any probe has ever succeeded.
225216
227308
  */
227309
+ /**
227310
+ * The ONE Reolink answer to "is this a battery camera that sleeps" (#459, Q2).
227311
+ * The published features (`BatteryOperated` + `Sleeps`) and the registration
227312
+ * of the `battery` and `low-power-sleep` caps both ask it, so a camera that
227313
+ * claims `Sleeps` in the stream catalog is also one the registry can wake.
227314
+ */
227315
+ function reolinkCameraSleeps(inputs) {
227316
+ return inputs.probe.hasBattery === true || inputs.isBattery;
227317
+ }
225217
227318
  function deriveReolinkCameraFeatures(inputs) {
225218
- const { probe, isBattery } = inputs;
227319
+ const { probe } = inputs;
225219
227320
  const out = [DeviceFeature.NativeSnapshot, DeviceFeature.Rebootable];
225220
- if (probe.hasBattery === true || isBattery) out.push(DeviceFeature.BatteryOperated);
227321
+ if (reolinkCameraSleeps(inputs)) out.push(DeviceFeature.BatteryOperated, DeviceFeature.Sleeps);
225221
227322
  if (probe.hasPtz === true) out.push(DeviceFeature.PanTiltZoom);
225222
227323
  if (probe.hasAutotrack === true) out.push(DeviceFeature.PtzAutotrack);
225223
227324
  if (probe.hasIntercom === true) out.push(DeviceFeature.TwoWayAudio);
@@ -227100,7 +229201,7 @@ function applyHubChildSections(sections, snapshot) {
227100
229201
  * costs when we get them wrong.
227101
229202
  *
227102
229203
  * `→ awake` (`WAKE_HYSTERESIS_MS`): expensive if wrong. Believing an asleep
227103
- * camera is awake un-gates every background probe and makes `wakeForStream`
229204
+ * camera is awake un-gates every background probe and makes `wakeUp`
227104
229205
  * early-out without actually waking. Keep the window >= the library's UDP
227105
229206
  * inference cycle (~12 s on battery cams with idle-disconnect) and >= its
227106
229207
  * `getIdleDisconnectTimeoutMs` (30 s default).
@@ -227137,7 +229238,7 @@ function isSummarySourced(source) {
227137
229238
  * the anti-flap window does not apply to it at all.
227138
229239
  * 3. A `confirmed-wake` in the `→ awake` direction is first-hand evidence
227139
229240
  * this process produced: gating it with the anti-flap window is what
227140
- * stranded 3825's mirror on "asleep" while `wakeForStream` answered
229241
+ * stranded 3825's mirror on "asleep" while `wakeUp` answered
227141
229242
  * `awoke: true`.
227142
229243
  * 4. Everything else is subject to the asymmetric hysteresis.
227143
229244
  * 5. A summary flip toward `sleeping` is refused while a first-hand
@@ -227936,6 +230037,13 @@ function buildReolinkSirenOptions(input) {
227936
230037
  step: secondsPerPlay
227937
230038
  },
227938
230039
  defaultSeconds: secondsForPlays(defaultPlays, secondsPerPlay),
230040
+ allowedPlays: null,
230041
+ rangePlays: {
230042
+ min: 1,
230043
+ max: 60,
230044
+ step: 1
230045
+ },
230046
+ defaultPlays,
227939
230047
  unit: SirenDurationUnit.Plays,
227940
230048
  secondsPerPlay,
227941
230049
  source: SirenOptionsSource.Fallback,
@@ -228196,9 +230304,9 @@ var SirenAccessory = class extends BaseDevice {
228196
230304
  });
228197
230305
  }
228198
230306
  /** Arms the countdown for a timed activation and clears the slice when it elapses. */
228199
- armSirenCountdown(seconds) {
230307
+ armSirenCountdown(seconds, activation) {
228200
230308
  this.clearSirenTimer();
228201
- this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds));
230309
+ this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds, activation));
228202
230310
  this.sirenTimer = setTimeout(() => {
228203
230311
  this.sirenTimer = null;
228204
230312
  this.writeSirenStatus(sirenIdleStatus(this.sirenView()));
@@ -228217,7 +230325,10 @@ var SirenAccessory = class extends BaseDevice {
228217
230325
  return;
228218
230326
  }
228219
230327
  if (plays !== void 0) {
228220
- this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay));
230328
+ this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay), {
230329
+ plays,
230330
+ estimated: true
230331
+ });
228221
230332
  return;
228222
230333
  }
228223
230334
  this.clearSirenTimer();
@@ -228225,6 +230336,8 @@ var SirenAccessory = class extends BaseDevice {
228225
230336
  active: true,
228226
230337
  activeUntil: null,
228227
230338
  durationSeconds: null,
230339
+ plays: null,
230340
+ activeUntilEstimated: false,
228228
230341
  lastTriggeredAt: Date.now()
228229
230342
  });
228230
230343
  }
@@ -228232,9 +230345,27 @@ var SirenAccessory = class extends BaseDevice {
228232
230345
  this.ctx.registerNativeCap(sirenCapability, {
228233
230346
  getStatus: async () => this.sirenView(),
228234
230347
  getOptions: async () => this.sirenOptions(),
228235
- trigger: async ({ deviceId, durationSeconds }) => {
230348
+ getPlayChoices: async () => sirenPlayChoices(this.sirenOptions()),
230349
+ trigger: async ({ deviceId, durationSeconds, plays: askedPlays }) => {
228236
230350
  if (deviceId !== this.id) return this.sirenView();
228237
- const plays = playsForSeconds(resolveSirenSeconds(this.sirenOptions(), durationSeconds), this.secondsPerPlay);
230351
+ const plan = planSirenTrigger(this.sirenOptions(), {
230352
+ durationSeconds,
230353
+ plays: askedPlays
230354
+ });
230355
+ if (plan.asked === "refused") {
230356
+ this.ctx.logger.warn("siren trigger refused", {
230357
+ tags: {
230358
+ deviceId: this.id,
230359
+ channel: this.channel
230360
+ },
230361
+ meta: {
230362
+ reason: plan.reason,
230363
+ plays: askedPlays
230364
+ }
230365
+ });
230366
+ throw new Error(`siren trigger refused: ${plan.reason}`);
230367
+ }
230368
+ const plays = plan.asked === "plays" ? plan.plays : playsForSeconds(plan.seconds, this.secondsPerPlay);
228238
230369
  const api = await this.api;
228239
230370
  try {
228240
230371
  await api.setSiren(this.channel, true, plays);
@@ -228258,7 +230389,8 @@ var SirenAccessory = class extends BaseDevice {
228258
230389
  channel: this.channel
228259
230390
  },
228260
230391
  meta: {
228261
- requested: durationSeconds ?? "default",
230392
+ requested: askedPlays ?? durationSeconds ?? "default",
230393
+ unit: plan.asked,
228262
230394
  plays,
228263
230395
  seconds: actualSeconds
228264
230396
  }
@@ -228267,7 +230399,10 @@ var SirenAccessory = class extends BaseDevice {
228267
230399
  on: true,
228268
230400
  lastChangedAt: Date.now()
228269
230401
  });
228270
- this.armSirenCountdown(actualSeconds);
230402
+ this.armSirenCountdown(actualSeconds, {
230403
+ plays: plan.asked === "plays" ? plays : null,
230404
+ estimated: plan.estimated
230405
+ });
228271
230406
  return this.sirenView();
228272
230407
  },
228273
230408
  stop: async ({ deviceId }) => {
@@ -228685,7 +230820,7 @@ async function populateReolinkMetadata(api, channel, target) {
228685
230820
  ...channelCount !== void 0 ? { channelCount } : {}
228686
230821
  };
228687
230822
  try {
228688
- await target.ctx.api?.deviceManager?.setMetadata?.mutate?.({
230823
+ await target.ctx.api.deviceManager?.setMetadata?.mutate({
228689
230824
  deviceId: target.id,
228690
230825
  patch
228691
230826
  });
@@ -228702,6 +230837,26 @@ async function populateReolinkMetadata(api, channel, target) {
228702
230837
  meta: { error: err instanceof Error ? err.message : String(err) }
228703
230838
  });
228704
230839
  }
230840
+ const hostRead = channel === void 0;
230841
+ const identifierMac = hostRead ? mac : void 0;
230842
+ const identifierIp = hostRead ? ip : void 0;
230843
+ const unread = hostRead ? [...mac === void 0 ? ["mac"] : [], ...ip === void 0 ? ["ip"] : []] : [];
230844
+ await declareDeviceIdentifiers({
230845
+ deviceId: target.id,
230846
+ logger: target.ctx.logger,
230847
+ writer: target.ctx.api.deviceManager?.setIdentifiers
230848
+ }, {
230849
+ mac: identifierMac ?? null,
230850
+ serial: info.serialNumber ? {
230851
+ manufacturer: "Reolink",
230852
+ serial: info.serialNumber
230853
+ } : null,
230854
+ vendorUid: target.uid ? {
230855
+ vendor: "reolink",
230856
+ id: target.uid
230857
+ } : null,
230858
+ ip: identifierIp ?? null
230859
+ }, { unread });
228705
230860
  const cachePatch = {};
228706
230861
  if (info.serialNumber) cachePatch["serialNumber"] = info.serialNumber;
228707
230862
  if (mac) cachePatch["mac"] = mac;
@@ -230689,10 +232844,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230689
232844
  return effectiveProbeFlags(this.hasProbed(), super.getProbeFlags(), this.config?.get("deviceCache"));
230690
232845
  }
230691
232846
  get features() {
230692
- return deriveReolinkCameraFeatures({
232847
+ return deriveReolinkCameraFeatures(this.featureInputs());
232848
+ }
232849
+ /** What the features and the battery / sleep registration both read. */
232850
+ featureInputs() {
232851
+ return {
230693
232852
  probe: this.getProbeFlags(),
230694
232853
  isBattery: this.isBattery
230695
- });
232854
+ };
230696
232855
  }
230697
232856
  /** Lazy-connected Baichuan API. Spans the lifetime of every active stream. */
230698
232857
  api = null;
@@ -230830,7 +232989,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230830
232989
  lastProactiveWakeAt = 0;
230831
232990
  /**
230832
232991
  * Minimum gap between two proactive wakes. Demand-driven wakes
230833
- * (`wakeForStream` from the broker, `wakeIfSleeping` behind an
232992
+ * (`wakeUp` from the broker, `wakeIfSleeping` behind an
230834
232993
  * operator action, the intercom pre-wake) bypass this entirely —
230835
232994
  * the operator asked, the operator gets the camera. Only
230836
232995
  * self-initiated wakes are rate-limited, so a thumbnail cache miss
@@ -231603,6 +233762,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231603
233762
  async wakeForClipCatalogRefresh() {
231604
233763
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
231605
233764
  }
233765
+ /**
233766
+ * Wake this camera because the OPERATOR asked for one of its clips — a
233767
+ * viewer pressing play, or an export — carrying `ClipWake` `authorised`.
233768
+ * The same forced wake `wakeIfSleeping` drives for a config button, under
233769
+ * the clip service's bound. Resolves whether the camera is up; never throws,
233770
+ * so the service can refuse `wake-timeout` by name.
233771
+ */
233772
+ async wakeForClipRead(timeoutMs) {
233773
+ return this.wakeIfSleeping(timeoutMs);
233774
+ }
231606
233775
  clipTimeZoneWarned = { done: false };
231607
233776
  getClipDeviceRef() {
231608
233777
  const configUid = this.config.get("uid");
@@ -231687,7 +233856,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231687
233856
  * (proactive config buttons such as Auto-configure email push). A
231688
233857
  * sleeping battery cam ignores Baichuan config round-trips, so clicking
231689
233858
  * "configure" would otherwise silently fail; this drives the same forced
231690
- * wake `wakeForStream` uses, then lets the caller proceed against a live
233859
+ * wake `wakeUp` uses, then lets the caller proceed against a live
231691
233860
  * camera. No-op for non-battery or already-awake cams. Best-effort:
231692
233861
  * returns whether the camera is (now) reachable/awake.
231693
233862
  */
@@ -232109,14 +234278,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232109
234278
  */
232110
234279
  registerBatteryIfSupported() {
232111
234280
  if (this.batteryRegistered) return;
232112
- if (!this.isBattery) return;
234281
+ if (!reolinkCameraSleeps(this.featureInputs())) return;
232113
234282
  this.batteryRegistered = true;
232114
- this.ctx.registerNativeCap(batteryCapability, {
234283
+ this.ctx.registerNativeCap(batteryCapability, { getStatus: async ({ deviceId }) => {
234284
+ if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
234285
+ return this.state.battery;
234286
+ } });
234287
+ this.ctx.registerNativeCap(lowPowerSleepCapability, {
232115
234288
  getStatus: async ({ deviceId }) => {
232116
234289
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
232117
- return this.state.battery;
234290
+ return sleepSliceOfBattery(this.state.battery);
232118
234291
  },
232119
- wakeForStream: async ({ deviceId, timeoutMs }) => {
234292
+ wakeUp: async ({ deviceId, timeoutMs }) => {
232120
234293
  if (deviceId !== this.id) throw new Error(`ReolinkCamera: deviceId mismatch, expected ${this.id}, got ${deviceId}`);
232121
234294
  const startedAt = Date.now();
232122
234295
  if (!this.sleeping) return {
@@ -232133,7 +234306,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232133
234306
  };
232134
234307
  }
232135
234308
  this.markWakeIssued();
232136
- this.ctx.logger.info("battery wakeForStream: cam sleeping — issuing wake", {
234309
+ this.ctx.logger.info("battery wakeUp: cam sleeping — issuing wake", {
232137
234310
  tags: { deviceId: this.id },
232138
234311
  meta: { timeoutMs }
232139
234312
  });
@@ -232146,7 +234319,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232146
234319
  attempts: 2
232147
234320
  });
232148
234321
  await sleep(1500);
232149
- })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
234322
+ })(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeUp timeout")), timeoutMs))]);
232150
234323
  const CONFIRM_TIMEOUT_MS = 1e4;
232151
234324
  const CONFIRM_POLL_MS = 1e3;
232152
234325
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
@@ -232179,7 +234352,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232179
234352
  }
232180
234353
  const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
232181
234354
  if (observedAwake && this.commitSleepState(false, confirmSource)) {
232182
- this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
234355
+ this.ctx.logger.info("battery wakeUp: wake confirmed — driving wake transition", {
232183
234356
  tags: { deviceId: this.id },
232184
234357
  meta: {
232185
234358
  confirmMs: Date.now() - startedAt,
@@ -232188,7 +234361,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232188
234361
  });
232189
234362
  this.onWakeTransition(confirmSource).catch(() => {});
232190
234363
  } else if (!confirmed) {
232191
- this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
234364
+ this.ctx.logger.warn("battery wakeUp: ACK received but no awake evidence inside the confirm window", {
232192
234365
  tags: { deviceId: this.id },
232193
234366
  meta: { confirmTimeoutMs: CONFIRM_TIMEOUT_MS }
232194
234367
  });
@@ -232200,7 +234373,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232200
234373
  }
232201
234374
  if (confirmed && !observedAwake && parent !== null) this.watchHubChildAwake(parent).catch(() => {});
232202
234375
  if (this.commitSleepState(false, "confirmed-wake")) {
232203
- this.ctx.logger.info("battery wakeForStream: answering awake — committing the mirror", {
234376
+ this.ctx.logger.info("battery wakeUp: answering awake — committing the mirror", {
232204
234377
  tags: { deviceId: this.id },
232205
234378
  meta: {
232206
234379
  confirmedMs: Date.now() - startedAt,
@@ -232214,7 +234387,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232214
234387
  durationMs: Date.now() - startedAt
232215
234388
  };
232216
234389
  } catch (err) {
232217
- this.ctx.logger.warn("battery wakeForStream: wake did not complete in time", {
234390
+ this.ctx.logger.warn("battery wakeUp: wake did not complete in time", {
232218
234391
  tags: { deviceId: this.id },
232219
234392
  meta: {
232220
234393
  timeoutMs,
@@ -232237,11 +234410,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232237
234410
  });
232238
234411
  this.runtimeState.subscribeCap("battery", (slice) => {
232239
234412
  if (!slice) return;
234413
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(slice));
232240
234414
  this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnStatusChanged, this.eventSource(), {
232241
234415
  deviceId: this.id,
232242
234416
  status: slice
232243
234417
  }));
232244
234418
  });
234419
+ this.setCapSlice(lowPowerSleepCapability, sleepSliceOfBattery(this.state.battery));
232245
234420
  this.refreshBatteryFromApi("register");
232246
234421
  }
232247
234422
  /**
@@ -232357,7 +234532,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232357
234532
  * `PROACTIVE_WAKE_COOLDOWN_MS` ago — the caller must then serve
232358
234533
  * whatever it has cached instead of reaching for the radio.
232359
234534
  *
232360
- * Demand-driven paths never call this: `wakeForStream` (a consumer
234535
+ * Demand-driven paths never call this: `wakeUp` (a consumer
232361
234536
  * wants live video), `wakeIfSleeping` (an operator clicked
232362
234537
  * something) and the intercom pre-wake all wake unconditionally.
232363
234538
  */
@@ -232396,7 +234571,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
232396
234571
  try {
232397
234572
  if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
232398
234573
  if (this.commitSleepState(false, "hub-summary")) {
232399
- this.ctx.logger.info("battery wakeForStream: hub child observed awake after the dial", { tags: { deviceId: this.id } });
234574
+ this.ctx.logger.info("battery wakeUp: hub child observed awake after the dial", { tags: { deviceId: this.id } });
232400
234575
  this.onWakeTransition("hub-summary").catch(() => {});
232401
234576
  }
232402
234577
  return;
@@ -238430,6 +240605,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
238430
240605
  this.registerPtzAutotrackIfSupported();
238431
240606
  this.registerDoorbellIfSupported();
238432
240607
  this.registerIntercomIfSupported();
240608
+ this.registerBatteryIfSupported();
238433
240609
  this.ctx.logger.info("Reolink features probed + persisted", {
238434
240610
  tags: { deviceId: this.id },
238435
240611
  meta: {
@@ -239335,6 +241511,97 @@ var EmailPushBridge = class {
239335
241511
  function pickMailbox(list) {
239336
241512
  return list.find((b) => b.id === "smtp-inbound-default")?.id ?? list[0]?.id ?? null;
239337
241513
  }
241514
+ //#endregion
241515
+ //#region src/reolink-connection-test.ts
241516
+ /**
241517
+ * The Reolink NVR / Home Hub connection test (planning#581): log in over Baichuan with the
241518
+ * connection as the form holds it — the same login the hub session makes — and answer a typed
241519
+ * verdict with a reason.
241520
+ *
241521
+ * The library reports failures only by message. What they tell apart:
241522
+ * - a socket that never connected, or a login that timed out — the hub did not answer;
241523
+ * - `Baichuan login failed: empty reply` after the nonce exchange succeeded — the hub is there
241524
+ * and refused the username or password (a mains-powered hub does not sleep, and the test's
241525
+ * socket is fresh, so the library's other two guesses for this message do not apply);
241526
+ * - anything else — the login failed with the library's own words, inconclusive.
241527
+ * Whether the host is an NVR / Home Hub rather than a single camera is NOT a reason here: a hub
241528
+ * with no camera paired answers zero channels just like a camera would.
241529
+ */
241530
+ /** The bound on login plus the channel read; the test logs in once (no library retry). */
241531
+ var REOLINK_HUB_TEST_DEADLINE_MS = 2e4;
241532
+ /** A real Baichuan session, dialled the way `connectReolinkHub` dials one. */
241533
+ var liveReolinkHubProbe = (connection) => {
241534
+ const api = new ReolinkBaichuanApi({
241535
+ host: connection.host,
241536
+ port: connection.port,
241537
+ username: connection.username,
241538
+ password: connection.password,
241539
+ transport: connection.transport,
241540
+ ...connection.uid ? { uid: connection.uid } : {}
241541
+ });
241542
+ return {
241543
+ login: () => api.login(void 0, { maxAttempts: 1 }),
241544
+ channelCount: async () => {
241545
+ try {
241546
+ return (await api.getNvrChannelsSummary({ timeoutMs: 5e3 })).devices.length;
241547
+ } catch {
241548
+ return null;
241549
+ }
241550
+ },
241551
+ close: () => api.close({ reason: "connection-test" })
241552
+ };
241553
+ };
241554
+ /** The verdict for a failed login. */
241555
+ function reolinkHubFailureOf(err, connection) {
241556
+ const where = `${connection.host}:${connection.port}`;
241557
+ const message = errMsg$3(err);
241558
+ if (message.includes("login failed: empty reply")) return {
241559
+ success: false,
241560
+ status: "rejected",
241561
+ error: `reolink: the NVR / Home Hub refused the username or password (user "${connection.username}")`
241562
+ };
241563
+ if (isConnectivityFailure(err) || message.includes("connect timeout")) return {
241564
+ success: false,
241565
+ status: "inconclusive",
241566
+ error: `reolink: the NVR / Home Hub did not answer on ${where} (${message}) — check the host and the Baichuan port (9000 by default)`
241567
+ };
241568
+ return {
241569
+ success: false,
241570
+ status: "inconclusive",
241571
+ error: `reolink: the login to ${where} failed: ${message}`
241572
+ };
241573
+ }
241574
+ async function testReolinkHubConnection(connection, makeProbe, deadlineMs = REOLINK_HUB_TEST_DEADLINE_MS) {
241575
+ const started = Date.now();
241576
+ const probe = makeProbe(connection);
241577
+ let timer = null;
241578
+ const deadline = new Promise((resolve) => {
241579
+ timer = setTimeout(() => resolve({ kind: "deadline" }), deadlineMs);
241580
+ });
241581
+ const login = probe.login().then(() => ({ kind: "ok" }), (err) => ({
241582
+ kind: "error",
241583
+ err
241584
+ }));
241585
+ try {
241586
+ const outcome = await Promise.race([login, deadline]);
241587
+ if (outcome.kind === "error") return reolinkHubFailureOf(outcome.err, connection);
241588
+ if (outcome.kind === "deadline") return {
241589
+ success: false,
241590
+ status: "inconclusive",
241591
+ 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`
241592
+ };
241593
+ const channels = await probe.channelCount();
241594
+ return {
241595
+ success: true,
241596
+ status: "validated",
241597
+ latencyMs: Date.now() - started,
241598
+ ...channels !== null ? { detail: `${channels} channels` } : {}
241599
+ };
241600
+ } finally {
241601
+ if (timer !== null) clearTimeout(timer);
241602
+ await probe.close().catch(() => null);
241603
+ }
241604
+ }
239338
241605
  var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239339
241606
  title: "Reolink integrations",
239340
241607
  schema: entryBody({
@@ -239354,6 +241621,44 @@ var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239354
241621
  });
239355
241622
  /** Every kind this addon declares, keyed by its name. */
239356
241623
  var reolinkRecordKinds = { connections: reolinkConnectionsEntryKind };
241624
+ /**
241625
+ * The connection test: the stored hub under the edited form. A saved password is never retyped
241626
+ * (the form hands back its redacted view), so the keychain value stands in.
241627
+ */
241628
+ async function testReolinkInstance(records, deps, input) {
241629
+ const handle = records.kind(reolinkConnectionsEntryKind);
241630
+ const stored = input.id === null ? null : (await handle.getResolved(input.id))?.data ?? null;
241631
+ const typed = input.values["password"];
241632
+ const password = typeof typed === "string" && typed !== "" && typed !== "__camstack_redacted__" ? typed : stored?.password;
241633
+ const merged = {};
241634
+ for (const [key, value] of Object.entries({
241635
+ ...stored,
241636
+ ...input.values,
241637
+ password
241638
+ })) {
241639
+ if (key === "name" || value === null || value === void 0) continue;
241640
+ merged[key] = value;
241641
+ }
241642
+ const read = readHubConnection(merged);
241643
+ switch (read.kind) {
241644
+ case "no-host": return {
241645
+ success: false,
241646
+ status: "inconclusive",
241647
+ error: "reolink: no NVR / Home Hub host on this integration — standalone cameras are tested one by one when they are added"
241648
+ };
241649
+ case "no-password": return {
241650
+ success: false,
241651
+ status: "rejected",
241652
+ error: "reolink: enter the NVR / Home Hub password"
241653
+ };
241654
+ case "password-locked": return {
241655
+ success: false,
241656
+ status: "inconclusive",
241657
+ error: "reolink: the stored password cannot be read right now (keychain unavailable)"
241658
+ };
241659
+ case "ok": return testReolinkHubConnection(read.connection, deps.makeHubProbe);
241660
+ }
241661
+ }
239357
241662
  /** The record body as the connection form's flat values: no name, no unset keys. */
239358
241663
  function hubSettingsOf(body) {
239359
241664
  const out = {};
@@ -239397,7 +241702,7 @@ function buildReolinkInstances(records, deps) {
239397
241702
  },
239398
241703
  instanceMode: "multiple",
239399
241704
  kind: "connection",
239400
- canTest: false,
241705
+ canTest: true,
239401
241706
  kinds: [{
239402
241707
  id: "connection",
239403
241708
  label: "Reolink",
@@ -239408,7 +241713,8 @@ function buildReolinkInstances(records, deps) {
239408
241713
  formSchema: () => buildHubInstanceSchema(),
239409
241714
  initialBody: (name) => ({ name }),
239410
241715
  configured: (body) => (body.host ?? "").length === 0 || (body.password ?? "").length > 0,
239411
- onChanged: () => deps.onChanged()
241716
+ onChanged: () => deps.onChanged(),
241717
+ test: (input) => testReolinkInstance(records, deps, input)
239412
241718
  });
239413
241719
  }
239414
241720
  /**
@@ -240913,6 +243219,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240913
243219
  resolveDevice: async (deviceId) => {
240914
243220
  const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
240915
243221
  return device instanceof ReolinkCamera ? device.getClipDeviceRef() : null;
243222
+ },
243223
+ wakeDevice: async (deviceId, timeoutMs) => {
243224
+ const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
243225
+ return device instanceof ReolinkCamera ? device.wakeForClipRead(timeoutMs) : false;
240916
243226
  }
240917
243227
  });
240918
243228
  regs.push({
@@ -240953,7 +243263,8 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240953
243263
  };
240954
243264
  const instances = buildReolinkInstances(records, {
240955
243265
  onChanged: () => this.reconcileIntegrations(),
240956
- registryEvidenceOf
243266
+ registryEvidenceOf,
243267
+ makeHubProbe: liveReolinkHubProbe
240957
243268
  });
240958
243269
  this.instances = instances;
240959
243270
  this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);