@camstack/addon-provider-reolink 1.2.242 → 1.2.243

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-Hwx_JSCU.mjs
100691
100694
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100692
100695
  EventCategory["SystemBoot"] = "system.boot";
100693
100696
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -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-BBL71oUQ.mjs
101515
101526
  /**
101516
101527
  import { errMsg } from '@camstack/types'
101517
101528
  * Extract a human-readable message from an unknown error value.
@@ -101643,6 +101654,10 @@ 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) {
@@ -101863,6 +101878,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101863
101878
  * `light` type: the provider owns the type, and a light implies brightness
101864
101879
  * or colour this relay lacks. */
101865
101880
  DeviceRole["SwitchLight"] = "switch-light";
101881
+ /** One port of a network switch that powers the device behind it (PoE): on /
101882
+ * off feeds or cuts that power. Its link is `network-link`, its draw
101883
+ * `power-meter`. Restarting the powered device through the port is that
101884
+ * device's `power-source` cap, never a reboot of the port. */
101885
+ DeviceRole["PoePort"] = "poe-port";
101866
101886
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
101867
101887
  DeviceRole["ClimateAc"] = "climate-ac";
101868
101888
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -101943,6 +101963,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101943
101963
  /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
101944
101964
  * cap. A `DeviceType.Generic` device. */
101945
101965
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101966
+ /** A virtual machine on a hypervisor. */
101967
+ DeviceRole["Vm"] = "vm";
101968
+ /** An application container (Docker, Podman). */
101969
+ DeviceRole["AppContainer"] = "app-container";
101970
+ /** A system container (LXC). */
101971
+ DeviceRole["Lxc"] = "lxc";
101972
+ /** An application or service running on a host. */
101973
+ DeviceRole["App"] = "app";
101974
+ /** A machine that runs workloads or is an appliance with its own OS: a
101975
+ * server, a hypervisor, a gateway console, a CCU. */
101976
+ DeviceRole["Host"] = "host";
101946
101977
  return DeviceRole;
101947
101978
  }({});
101948
101979
  /**
@@ -102526,8 +102557,8 @@ var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
102526
102557
  function emoji() {
102527
102558
  return new RegExp(_emoji$1, "u");
102528
102559
  }
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}|:))$/;
102560
+ 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])$/;
102561
+ 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
102562
  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
102563
  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
102564
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
@@ -103201,12 +103232,12 @@ var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)
103201
103232
  $ZodStringFormat.init(inst, def);
103202
103233
  });
103203
103234
  var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
103204
- def.pattern ?? (def.pattern = ipv4);
103235
+ def.pattern ?? (def.pattern = ipv4$1);
103205
103236
  $ZodStringFormat.init(inst, def);
103206
103237
  inst._zod.bag.format = `ipv4`;
103207
103238
  });
103208
103239
  var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
103209
- def.pattern ?? (def.pattern = ipv6);
103240
+ def.pattern ?? (def.pattern = ipv6$1);
103210
103241
  $ZodStringFormat.init(inst, def);
103211
103242
  inst._zod.bag.format = `ipv6`;
103212
103243
  inst._zod.check = (payload) => {
@@ -106122,10 +106153,16 @@ var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
106122
106153
  $ZodIPv4.init(inst, def);
106123
106154
  ZodStringFormat.init(inst, def);
106124
106155
  });
106156
+ function ipv4(params) {
106157
+ return /* @__PURE__ */ _ipv4(ZodIPv4, params);
106158
+ }
106125
106159
  var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
106126
106160
  $ZodIPv6.init(inst, def);
106127
106161
  ZodStringFormat.init(inst, def);
106128
106162
  });
106163
+ function ipv6(params) {
106164
+ return /* @__PURE__ */ _ipv6(ZodIPv6, params);
106165
+ }
106129
106166
  var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
106130
106167
  $ZodCIDRv4.init(inst, def);
106131
106168
  ZodStringFormat.init(inst, def);
@@ -106763,7 +106800,7 @@ var ZodIssueCode = {
106763
106800
  var ZodFirstPartyTypeKind;
106764
106801
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106765
106802
  //#endregion
106766
- //#region ../types/dist/sleep-Ch7Q7UtE.mjs
106803
+ //#region ../types/dist/sleep-D6Pih0Qt.mjs
106767
106804
  /**
106768
106805
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106769
106806
  * window to float samples (D455).
@@ -111561,6 +111598,10 @@ var CAP_VOCABULARY_BY_NAME = {
111561
111598
  effect: {
111562
111599
  field: "on",
111563
111600
  value: true
111601
+ },
111602
+ offeredWhen: {
111603
+ method: "getOptions",
111604
+ field: "supportsSetState"
111564
111605
  }
111565
111606
  },
111566
111607
  {
@@ -111579,6 +111620,10 @@ var CAP_VOCABULARY_BY_NAME = {
111579
111620
  effect: {
111580
111621
  field: "on",
111581
111622
  value: false
111623
+ },
111624
+ offeredWhen: {
111625
+ method: "getOptions",
111626
+ field: "supportsSetState"
111582
111627
  }
111583
111628
  },
111584
111629
  {
@@ -111592,9 +111637,14 @@ var CAP_VOCABULARY_BY_NAME = {
111592
111637
  en: "Toggle {device}",
111593
111638
  it: "Commuta {device}"
111594
111639
  },
111595
- icon: "toggle-right"
111640
+ icon: "toggle-right",
111641
+ offeredWhen: {
111642
+ method: "getOptions",
111643
+ field: "supportsSetState"
111644
+ }
111596
111645
  }
111597
111646
  ],
111647
+ notOperatorFacing: { powerCycle: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own" },
111598
111648
  state: [{
111599
111649
  kind: "boolean",
111600
111650
  field: "on",
@@ -111853,6 +111903,47 @@ var CAP_VOCABULARY_BY_NAME = {
111853
111903
  "switch.off": { icon: "plug" }
111854
111904
  },
111855
111905
  state: { on: { icon: "plug-zap" } }
111906
+ },
111907
+ [DeviceRole.PoePort]: {
111908
+ actions: {
111909
+ "switch.on": {
111910
+ label: {
111911
+ en: "Power on",
111912
+ it: "Alimenta"
111913
+ },
111914
+ phrase: {
111915
+ en: "Power on {device}",
111916
+ it: "Alimenta {device}"
111917
+ },
111918
+ icon: "plug-zap"
111919
+ },
111920
+ "switch.off": {
111921
+ label: {
111922
+ en: "Power off",
111923
+ it: "Togli alimentazione"
111924
+ },
111925
+ phrase: {
111926
+ en: "Power off {device}",
111927
+ it: "Togli alimentazione a {device}"
111928
+ },
111929
+ icon: "unplug"
111930
+ }
111931
+ },
111932
+ state: { on: {
111933
+ label: {
111934
+ en: "Powered",
111935
+ it: "Alimentata"
111936
+ },
111937
+ whenTrue: {
111938
+ en: "When {device} is powered",
111939
+ it: "Quando {device} viene alimentata"
111940
+ },
111941
+ whenFalse: {
111942
+ en: "When {device} loses power",
111943
+ it: "Quando {device} perde l’alimentazione"
111944
+ },
111945
+ icon: "plug-zap"
111946
+ } }
111856
111947
  }
111857
111948
  }
111858
111949
  }
@@ -112572,7 +112663,11 @@ var CAP_VOCABULARY_BY_NAME = {
112572
112663
  en: "Power on {device}",
112573
112664
  it: "Dai corrente a {device}"
112574
112665
  },
112575
- icon: "power"
112666
+ icon: "power",
112667
+ offeredWhen: {
112668
+ method: "getStatus",
112669
+ field: "switchSettable"
112670
+ }
112576
112671
  },
112577
112672
  {
112578
112673
  id: "powerSource.off",
@@ -112585,7 +112680,11 @@ var CAP_VOCABULARY_BY_NAME = {
112585
112680
  en: "Cut the power of {device}",
112586
112681
  it: "Togli la corrente a {device}"
112587
112682
  },
112588
- icon: "power-off"
112683
+ icon: "power-off",
112684
+ offeredWhen: {
112685
+ method: "getStatus",
112686
+ field: "switchSettable"
112687
+ }
112589
112688
  },
112590
112689
  {
112591
112690
  id: "powerSource.forceRestart",
@@ -114355,37 +114454,66 @@ var CAP_VOCABULARY_BY_NAME = {
114355
114454
  en: "Siren",
114356
114455
  it: "Sirena"
114357
114456
  },
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"
114457
+ actions: [
114458
+ {
114459
+ id: "siren.trigger",
114460
+ method: "trigger",
114461
+ label: {
114462
+ en: "Sound the siren",
114463
+ it: "Fai suonare la sirena"
114464
+ },
114465
+ phrase: {
114466
+ en: "Sound {device}",
114467
+ it: "Fai suonare {device}"
114468
+ },
114469
+ icon: "siren",
114470
+ args: {}
114377
114471
  },
114378
- phrase: {
114379
- en: "Silence {device}",
114380
- it: "Zittisci {device}"
114472
+ {
114473
+ id: "siren.triggerPlays",
114474
+ method: "trigger",
114475
+ label: {
114476
+ en: "Sound the siren N times",
114477
+ it: "Fai suonare la sirena N volte"
114478
+ },
114479
+ phrase: {
114480
+ en: "Sound {device} {plays} times",
114481
+ it: "Fai suonare {device} {plays} volte"
114482
+ },
114483
+ icon: "siren",
114484
+ openArgs: [{
114485
+ key: "plays",
114486
+ label: {
114487
+ en: "Plays",
114488
+ it: "Riproduzioni"
114489
+ },
114490
+ offer: {
114491
+ kind: "dynamic",
114492
+ from: "method",
114493
+ method: "getPlayChoices",
114494
+ valueKind: "number"
114495
+ }
114496
+ }]
114381
114497
  },
114382
- icon: "siren",
114383
- args: {},
114384
- effect: {
114385
- field: "active",
114386
- value: false
114498
+ {
114499
+ id: "siren.stop",
114500
+ method: "stop",
114501
+ label: {
114502
+ en: "Silence the siren",
114503
+ it: "Zittisci la sirena"
114504
+ },
114505
+ phrase: {
114506
+ en: "Silence {device}",
114507
+ it: "Zittisci {device}"
114508
+ },
114509
+ icon: "siren",
114510
+ args: {},
114511
+ effect: {
114512
+ field: "active",
114513
+ value: false
114514
+ }
114387
114515
  }
114388
- }],
114516
+ ],
114389
114517
  state: [{
114390
114518
  kind: "boolean",
114391
114519
  field: "active",
@@ -116980,6 +117108,374 @@ var CAP_VOCABULARY_BY_NAME = {
116980
117108
  icon: "loader"
116981
117109
  }]
116982
117110
  },
117111
+ "workload": {
117112
+ scope: "device",
117113
+ noun: {
117114
+ en: "Workload",
117115
+ it: "Carico di lavoro"
117116
+ },
117117
+ actions: [
117118
+ {
117119
+ id: "workload.start",
117120
+ method: "start",
117121
+ label: {
117122
+ en: "Start",
117123
+ it: "Avvia"
117124
+ },
117125
+ phrase: {
117126
+ en: "Start {device}",
117127
+ it: "Avvia {device}"
117128
+ },
117129
+ icon: "play",
117130
+ effect: {
117131
+ field: "state",
117132
+ value: "running"
117133
+ }
117134
+ },
117135
+ {
117136
+ id: "workload.stop",
117137
+ method: "stop",
117138
+ label: {
117139
+ en: "Stop",
117140
+ it: "Arresta"
117141
+ },
117142
+ phrase: {
117143
+ en: "Stop {device}",
117144
+ it: "Arresta {device}"
117145
+ },
117146
+ icon: "square",
117147
+ effect: {
117148
+ field: "state",
117149
+ value: "stopped"
117150
+ }
117151
+ },
117152
+ {
117153
+ id: "workload.restart",
117154
+ method: "restart",
117155
+ label: {
117156
+ en: "Restart",
117157
+ it: "Riavvia"
117158
+ },
117159
+ phrase: {
117160
+ en: "Restart {device}",
117161
+ it: "Riavvia {device}"
117162
+ },
117163
+ icon: "rotate-ccw"
117164
+ },
117165
+ {
117166
+ id: "workload.pause",
117167
+ method: "pause",
117168
+ label: {
117169
+ en: "Pause",
117170
+ it: "Metti in pausa"
117171
+ },
117172
+ phrase: {
117173
+ en: "Pause {device}",
117174
+ it: "Metti in pausa {device}"
117175
+ },
117176
+ icon: "pause",
117177
+ effect: {
117178
+ field: "state",
117179
+ value: "paused"
117180
+ }
117181
+ },
117182
+ {
117183
+ id: "workload.resume",
117184
+ method: "resume",
117185
+ label: {
117186
+ en: "Resume",
117187
+ it: "Riprendi"
117188
+ },
117189
+ phrase: {
117190
+ en: "Resume {device}",
117191
+ it: "Riprendi {device}"
117192
+ },
117193
+ icon: "circle-play",
117194
+ effect: {
117195
+ field: "state",
117196
+ value: "running"
117197
+ }
117198
+ },
117199
+ {
117200
+ id: "workload.forceStop",
117201
+ method: "forceStop",
117202
+ label: {
117203
+ en: "Force stop",
117204
+ it: "Arresto forzato"
117205
+ },
117206
+ phrase: {
117207
+ en: "Force {device} to stop",
117208
+ it: "Forza l’arresto di {device}"
117209
+ },
117210
+ icon: "octagon-x",
117211
+ effect: {
117212
+ field: "state",
117213
+ value: "stopped"
117214
+ }
117215
+ }
117216
+ ],
117217
+ state: [
117218
+ {
117219
+ kind: "enum",
117220
+ field: "state",
117221
+ label: {
117222
+ en: "State",
117223
+ it: "Stato"
117224
+ },
117225
+ values: [
117226
+ {
117227
+ value: "running",
117228
+ label: {
117229
+ en: "Running",
117230
+ it: "In esecuzione"
117231
+ },
117232
+ phrase: {
117233
+ en: "When {device} is running",
117234
+ it: "Quando {device} è in esecuzione"
117235
+ }
117236
+ },
117237
+ {
117238
+ value: "paused",
117239
+ label: {
117240
+ en: "Paused",
117241
+ it: "In pausa"
117242
+ }
117243
+ },
117244
+ {
117245
+ value: "stopped",
117246
+ label: {
117247
+ en: "Stopped",
117248
+ it: "Arrestato"
117249
+ },
117250
+ phrase: {
117251
+ en: "When {device} is stopped",
117252
+ it: "Quando {device} è arrestato"
117253
+ }
117254
+ },
117255
+ {
117256
+ value: "starting",
117257
+ label: {
117258
+ en: "Starting",
117259
+ it: "In avvio"
117260
+ }
117261
+ },
117262
+ {
117263
+ value: "stopping",
117264
+ label: {
117265
+ en: "Stopping",
117266
+ it: "In arresto"
117267
+ }
117268
+ },
117269
+ {
117270
+ value: "crashed",
117271
+ label: {
117272
+ en: "Crashed",
117273
+ it: "Arrestato in modo anomalo"
117274
+ },
117275
+ phrase: {
117276
+ en: "When {device} has crashed",
117277
+ it: "Quando {device} è arrestato in modo anomalo"
117278
+ }
117279
+ }
117280
+ ],
117281
+ icon: "activity"
117282
+ },
117283
+ {
117284
+ kind: "numeric",
117285
+ field: "resources.cpuPercent",
117286
+ quantity: {
117287
+ en: "the CPU use",
117288
+ it: "l'uso della CPU"
117289
+ },
117290
+ label: {
117291
+ en: "CPU",
117292
+ it: "CPU"
117293
+ },
117294
+ unit: "%",
117295
+ icon: "cpu"
117296
+ },
117297
+ {
117298
+ kind: "numeric",
117299
+ field: "resources.memoryPercent",
117300
+ quantity: {
117301
+ en: "the memory use",
117302
+ it: "l'uso della memoria"
117303
+ },
117304
+ label: {
117305
+ en: "Memory",
117306
+ it: "Memoria"
117307
+ },
117308
+ unit: "%",
117309
+ icon: "memory-stick"
117310
+ },
117311
+ {
117312
+ kind: "numeric",
117313
+ field: "resources.temperature",
117314
+ quantity: {
117315
+ en: "the temperature",
117316
+ it: "la temperatura"
117317
+ },
117318
+ label: {
117319
+ en: "Temperature",
117320
+ it: "Temperatura"
117321
+ },
117322
+ unit: "°C",
117323
+ icon: "thermometer"
117324
+ }
117325
+ ],
117326
+ events: {
117327
+ onStarted: {
117328
+ category: EventCategory.WorkloadStarted,
117329
+ label: {
117330
+ en: "Started",
117331
+ it: "Avviato"
117332
+ },
117333
+ phrase: {
117334
+ en: "When {device} starts",
117335
+ it: "Quando {device} si avvia"
117336
+ },
117337
+ icon: "play"
117338
+ },
117339
+ onStopped: {
117340
+ category: EventCategory.WorkloadStopped,
117341
+ label: {
117342
+ en: "Stopped",
117343
+ it: "Arrestato"
117344
+ },
117345
+ phrase: {
117346
+ en: "When {device} stops",
117347
+ it: "Quando {device} si arresta"
117348
+ },
117349
+ icon: "square"
117350
+ },
117351
+ onCrashed: {
117352
+ category: EventCategory.WorkloadCrashed,
117353
+ label: {
117354
+ en: "Crashed",
117355
+ it: "Arrestato in modo anomalo"
117356
+ },
117357
+ phrase: {
117358
+ en: "When {device} stops without being asked",
117359
+ it: "Quando {device} si arresta senza che sia stato richiesto"
117360
+ },
117361
+ icon: "triangle-alert"
117362
+ },
117363
+ onRecovered: {
117364
+ category: EventCategory.WorkloadRecovered,
117365
+ label: {
117366
+ en: "Recovered",
117367
+ it: "Ripristinato"
117368
+ },
117369
+ phrase: {
117370
+ en: "When {device} runs again after a crash",
117371
+ it: "Quando {device} riparte dopo un arresto anomalo"
117372
+ },
117373
+ icon: "heart-pulse"
117374
+ }
117375
+ },
117376
+ overrides: { byRole: {
117377
+ [DeviceRole.Vm]: {
117378
+ actions: { "workload.start": { icon: "monitor" } },
117379
+ state: { state: { icon: "monitor" } }
117380
+ },
117381
+ [DeviceRole.AppContainer]: {
117382
+ actions: { "workload.start": { icon: "container" } },
117383
+ state: { state: { icon: "container" } }
117384
+ },
117385
+ [DeviceRole.Lxc]: {
117386
+ actions: { "workload.start": { icon: "box" } },
117387
+ state: { state: { icon: "box" } }
117388
+ },
117389
+ [DeviceRole.App]: {
117390
+ actions: { "workload.start": { icon: "app-window" } },
117391
+ state: { state: { icon: "app-window" } }
117392
+ },
117393
+ [DeviceRole.Host]: {
117394
+ actions: {
117395
+ "workload.start": {
117396
+ label: {
117397
+ en: "Power on",
117398
+ it: "Accendi"
117399
+ },
117400
+ phrase: {
117401
+ en: "Power on {device}",
117402
+ it: "Accendi {device}"
117403
+ },
117404
+ icon: "power"
117405
+ },
117406
+ "workload.stop": {
117407
+ label: {
117408
+ en: "Shut down",
117409
+ it: "Spegni"
117410
+ },
117411
+ phrase: {
117412
+ en: "Shut down {device}",
117413
+ it: "Spegni {device}"
117414
+ },
117415
+ icon: "power-off"
117416
+ },
117417
+ "workload.restart": {
117418
+ label: {
117419
+ en: "Reboot",
117420
+ it: "Riavvia"
117421
+ },
117422
+ phrase: {
117423
+ en: "Reboot {device}",
117424
+ it: "Riavvia {device}"
117425
+ },
117426
+ icon: "refresh-cw"
117427
+ }
117428
+ },
117429
+ state: { state: { icon: "server" } },
117430
+ events: {
117431
+ onStarted: {
117432
+ label: {
117433
+ en: "Came online",
117434
+ it: "Tornato in linea"
117435
+ },
117436
+ phrase: {
117437
+ en: "When {device} comes online",
117438
+ it: "Quando {device} torna in linea"
117439
+ },
117440
+ icon: "server"
117441
+ },
117442
+ onStopped: {
117443
+ label: {
117444
+ en: "Shut down",
117445
+ it: "Spento"
117446
+ },
117447
+ phrase: {
117448
+ en: "When {device} shuts down",
117449
+ it: "Quando {device} si spegne"
117450
+ },
117451
+ icon: "server-off"
117452
+ },
117453
+ onCrashed: {
117454
+ label: {
117455
+ en: "Went down",
117456
+ it: "Caduto"
117457
+ },
117458
+ phrase: {
117459
+ en: "When {device} goes down unexpectedly",
117460
+ it: "Quando {device} cade inaspettatamente"
117461
+ },
117462
+ icon: "server-crash"
117463
+ },
117464
+ onRecovered: {
117465
+ label: {
117466
+ en: "Came online",
117467
+ it: "Tornato in linea"
117468
+ },
117469
+ phrase: {
117470
+ en: "When {device} comes back online after going down",
117471
+ it: "Quando {device} torna in linea dopo essere caduto"
117472
+ },
117473
+ icon: "server"
117474
+ }
117475
+ }
117476
+ }
117477
+ } }
117478
+ },
116983
117479
  "accessories": {
116984
117480
  scope: "device",
116985
117481
  noun: {
@@ -120628,6 +121124,15 @@ var PipelineStepInputSchema = lazy(() => object({
120628
121124
  }));
120629
121125
  /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
120630
121126
  var PipelineRunResultBridge = custom();
121127
+ /**
121128
+ * Whether a switch can be set (D1058), schema-free so the addon runner can import it from
121129
+ * `@camstack/types/addon` without loading the capability schema graph (D28).
121130
+ */
121131
+ /** The read that decides whether a switch is offered on/off (`offeredWhen` of its actions). */
121132
+ var SWITCH_SETTABLE_GATE = {
121133
+ method: "getOptions",
121134
+ field: "supportsSetState"
121135
+ };
120631
121136
  var StaticDirOutputSchema = object({ staticDir: string() });
120632
121137
  var VersionOutputSchema = object({ version: string() });
120633
121138
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" }), NOT_A_DEVICE.UI_PLUMBING;
@@ -120875,6 +121380,7 @@ var CAP_NAMES = Object.freeze([
120875
121380
  "weather",
120876
121381
  "weather-station",
120877
121382
  "webrtc-session",
121383
+ "workload",
120878
121384
  "zone-analytics",
120879
121385
  "zone-rules",
120880
121386
  "zones"
@@ -122177,6 +122683,14 @@ Object.freeze({
122177
122683
  "path": "ssid",
122178
122684
  "valueType": "string"
122179
122685
  },
122686
+ {
122687
+ "path": "speedKbps",
122688
+ "valueType": "number"
122689
+ },
122690
+ {
122691
+ "path": "linkUp",
122692
+ "valueType": "boolean"
122693
+ },
122180
122694
  {
122181
122695
  "path": "lastUpdated",
122182
122696
  "valueType": "number"
@@ -122573,6 +123087,14 @@ Object.freeze({
122573
123087
  "path": "durationSeconds",
122574
123088
  "valueType": "number"
122575
123089
  },
123090
+ {
123091
+ "path": "plays",
123092
+ "valueType": "number"
123093
+ },
123094
+ {
123095
+ "path": "activeUntilEstimated",
123096
+ "valueType": "boolean"
123097
+ },
122576
123098
  {
122577
123099
  "path": "lastTriggeredAt",
122578
123100
  "valueType": "number"
@@ -122975,6 +123497,92 @@ Object.freeze({
122975
123497
  "valueType": "number"
122976
123498
  }
122977
123499
  ],
123500
+ "workload": [
123501
+ {
123502
+ "path": "state",
123503
+ "valueType": "enum",
123504
+ "enumValues": [
123505
+ "running",
123506
+ "paused",
123507
+ "stopped",
123508
+ "starting",
123509
+ "stopping",
123510
+ "crashed"
123511
+ ]
123512
+ },
123513
+ {
123514
+ "path": "since",
123515
+ "valueType": "number"
123516
+ },
123517
+ {
123518
+ "path": "hostDeviceId",
123519
+ "valueType": "number"
123520
+ },
123521
+ {
123522
+ "path": "image",
123523
+ "valueType": "string"
123524
+ },
123525
+ {
123526
+ "path": "os",
123527
+ "valueType": "string"
123528
+ },
123529
+ {
123530
+ "path": "version",
123531
+ "valueType": "string"
123532
+ },
123533
+ {
123534
+ "path": "autostart",
123535
+ "valueType": "boolean"
123536
+ },
123537
+ {
123538
+ "path": "resources.cpuPercent",
123539
+ "valueType": "number"
123540
+ },
123541
+ {
123542
+ "path": "resources.memoryUsedBytes",
123543
+ "valueType": "number"
123544
+ },
123545
+ {
123546
+ "path": "resources.memoryPercent",
123547
+ "valueType": "number"
123548
+ },
123549
+ {
123550
+ "path": "resources.memoryLimitBytes",
123551
+ "valueType": "number"
123552
+ },
123553
+ {
123554
+ "path": "resources.vcpus",
123555
+ "valueType": "number"
123556
+ },
123557
+ {
123558
+ "path": "resources.diskUsedBytes",
123559
+ "valueType": "number"
123560
+ },
123561
+ {
123562
+ "path": "resources.diskTotalBytes",
123563
+ "valueType": "number"
123564
+ },
123565
+ {
123566
+ "path": "resources.netRxKbps",
123567
+ "valueType": "number"
123568
+ },
123569
+ {
123570
+ "path": "resources.netTxKbps",
123571
+ "valueType": "number"
123572
+ },
123573
+ {
123574
+ "path": "resources.load1",
123575
+ "valueType": "number"
123576
+ },
123577
+ {
123578
+ "path": "resources.temperature",
123579
+ "valueType": "number"
123580
+ },
123581
+ {
123582
+ "path": "updateAvailable",
123583
+ "valueType": "boolean"
123584
+ }
123585
+ ],
122978
123586
  "zone-analytics": [
122979
123587
  {
122980
123588
  "path": "ts",
@@ -123091,7 +123699,7 @@ function sleep(ms) {
123091
123699
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123092
123700
  }
123093
123701
  //#endregion
123094
- //#region ../types/dist/implemented-methods-C5FMXLGP.mjs
123702
+ //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
123095
123703
  /**
123096
123704
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123097
123705
  *
@@ -124012,63 +124620,99 @@ var HelperMemberSchema = object({
124012
124620
  cap: string().min(1),
124013
124621
  fieldPath: string().min(1)
124014
124622
  });
124623
+ /** A group, a statistic, or an integral (D944). The composer runs all three. */
124624
+ var GroupHelperSpecSchema = object({
124625
+ kind: literal("group"),
124626
+ templateId: GroupTemplateIdSchema,
124627
+ aggregate: AggregateReducerSchema,
124628
+ members: array(HelperMemberSchema).min(1).max(64),
124629
+ /** Actuator groups only. Readings leave this unset. */
124630
+ active: ActiveCriterionSchema.optional()
124631
+ });
124632
+ var statisticHelperObject = object({
124633
+ kind: literal("statistic"),
124634
+ stat: _enum(STATISTIC_STATS),
124635
+ window: StatisticWindowSchema,
124636
+ source: HelperMemberSchema
124637
+ });
124638
+ var integralHelperObject = object({
124639
+ kind: literal("integral"),
124640
+ reset: _enum(RESET_PERIODS),
124641
+ output: _enum(["energy", "meter"]),
124642
+ source: HelperMemberSchema
124643
+ });
124644
+ var thresholdHelperObject = object({
124645
+ kind: literal("threshold"),
124646
+ source: HelperMemberSchema,
124647
+ high: number$1(),
124648
+ low: number$1(),
124649
+ onForMs: number$1().int().nonnegative(),
124650
+ offForMs: number$1().int().nonnegative()
124651
+ });
124652
+ var arithmeticHelperObject = object({
124653
+ kind: literal("arithmetic"),
124654
+ op: _enum([
124655
+ "sum",
124656
+ "difference",
124657
+ "ratio"
124658
+ ]),
124659
+ inputs: array(HelperMemberSchema).min(2).max(64)
124660
+ });
124661
+ var expressionHelperObject = object({
124662
+ kind: literal("expression"),
124663
+ expr: string().min(1),
124664
+ inputs: array(object({
124665
+ name: string().min(1),
124666
+ member: HelperMemberSchema
124667
+ })).min(1).max(64),
124668
+ output: _enum(["number", "boolean"])
124669
+ });
124670
+ var derivativeHelperObject = object({
124671
+ kind: literal("derivative"),
124672
+ window: RollingWindowSchema,
124673
+ per: _enum([
124674
+ "second",
124675
+ "minute",
124676
+ "hour"
124677
+ ]),
124678
+ source: HelperMemberSchema
124679
+ });
124680
+ /** The stream profiles a camera grid can publish. */
124681
+ var GRID_PROFILES = [
124682
+ "high",
124683
+ "mid",
124684
+ "low"
124685
+ ];
124686
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
124687
+ var GridRectSchema = object({
124688
+ x: number$1().min(0).max(1),
124689
+ y: number$1().min(0).max(1),
124690
+ width: number$1().gt(0).max(1),
124691
+ height: number$1().gt(0).max(1)
124692
+ });
124693
+ var GridCellSpecSchema = object({
124694
+ source: CompositionSourceRefSchema,
124695
+ region: GridRectSchema,
124696
+ cell: GridRectSchema
124697
+ });
124015
124698
  var HelperSpecSchema = discriminatedUnion("kind", [
124016
124699
  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()
124023
- }),
124024
- object({
124025
- kind: literal("statistic"),
124026
- stat: _enum(STATISTIC_STATS),
124027
- window: StatisticWindowSchema,
124028
- source: HelperMemberSchema
124700
+ kind: literal("grid"),
124701
+ fps: number$1().int().min(1).max(60),
124702
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
124703
+ cells: array(GridCellSpecSchema).max(16)
124029
124704
  }),
124030
124705
  object({
124031
- kind: literal("integral"),
124032
- reset: _enum(RESET_PERIODS),
124033
- output: _enum(["energy", "meter"]),
124034
- source: HelperMemberSchema
124706
+ kind: literal("terminal"),
124707
+ terminalId: string().uuid()
124035
124708
  }),
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
- })
124709
+ GroupHelperSpecSchema,
124710
+ statisticHelperObject,
124711
+ integralHelperObject,
124712
+ thresholdHelperObject,
124713
+ arithmeticHelperObject,
124714
+ expressionHelperObject,
124715
+ derivativeHelperObject
124072
124716
  ]);
124073
124717
  /** Longest snippet a `code` source may carry (slice 4). */
124074
124718
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
@@ -156382,9 +157026,10 @@ var GridProfileOfferSchema = object({
156382
157026
  published: boolean()
156383
157027
  });
156384
157028
  var GridLayoutViewSchema = object({
156385
- /** The persisted grid row this camera was declared from. */
156386
- instanceId: string(),
157029
+ /** The grid block (planning#580) whose camera this is. */
157030
+ blockId: string(),
156387
157031
  deviceId: number$1().int().nonnegative(),
157032
+ /** The device row's name — the only name a grid has; it is renamed on the block or the device. */
156388
157033
  name: string(),
156389
157034
  /**
156390
157035
  * NO canvas size. A grid's resolution is not authored: each profile derives
@@ -156400,7 +157045,6 @@ var GridLayoutViewSchema = object({
156400
157045
  });
156401
157046
  var GridLayoutPatchSchema = object({
156402
157047
  deviceId: number$1().int().nonnegative(),
156403
- name: string().min(1).max(160).optional(),
156404
157048
  fps: number$1().int().min(1).max(60).optional(),
156405
157049
  /** Which profiles to publish. See `GridProfileOffer.published`. */
156406
157050
  publishedProfiles: array(_enum([
@@ -160130,7 +160774,7 @@ var mediaPlayerCapability = {
160130
160774
  ]
160131
160775
  }
160132
160776
  };
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;
160777
+ 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
160778
  var NUMBER = {
160135
160779
  kind: "fixed",
160136
160780
  result: ["number"]
@@ -160580,7 +161224,7 @@ new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
160580
161224
  DeviceType.Camera;
160581
161225
  /**
160582
161226
  * 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.
161227
+ * 7 caps. The card shows the primary of the enabled cap with the highest priority.
160584
161228
  */
160585
161229
  var HISTORY_PRIMARY = {
160586
161230
  "climate-control": {
@@ -160606,6 +161250,10 @@ var HISTORY_PRIMARY = {
160606
161250
  "weather-station": {
160607
161251
  field: "temperature",
160608
161252
  priority: 60
161253
+ },
161254
+ "workload": {
161255
+ field: "resources.cpuPercent",
161256
+ priority: 40
160609
161257
  }
160610
161258
  };
160611
161259
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
@@ -160616,6 +161264,8 @@ var PowerSourceRefusalReasonSchema = _enum([
160616
161264
  "switch-unknown",
160617
161265
  "restart-in-progress",
160618
161266
  "switch-call-failed",
161267
+ "switch-options-unreadable",
161268
+ "not-settable",
160619
161269
  "switch-is-actuator"
160620
161270
  ]);
160621
161271
  var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
@@ -160632,6 +161282,14 @@ var PowerSourceInfoSchema = object({
160632
161282
  /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
160633
161283
  switchOn: boolean().nullable(),
160634
161284
  switchOnline: boolean().nullable(),
161285
+ /**
161286
+ * Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
161287
+ * without the method is a plain switch, `true`). `null` = not known: no link, the switch is
161288
+ * missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
161289
+ * withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
161290
+ * unknown keeps them (D315, D1058).
161291
+ */
161292
+ switchSettable: boolean().nullable().optional(),
160635
161293
  restartInProgress: boolean(),
160636
161294
  offSeconds: number$1().int()
160637
161295
  });
@@ -160689,6 +161347,11 @@ var powerSourceCustomize = {
160689
161347
  }]
160690
161348
  };
160691
161349
  var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
161350
+ /** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
161351
+ var POWER_SOURCE_SETTABLE_GATE = {
161352
+ method: "getStatus",
161353
+ field: "switchSettable"
161354
+ };
160692
161355
  var powerSourceCapability = {
160693
161356
  name: "power-source",
160694
161357
  scope: "device",
@@ -160703,7 +161366,8 @@ var powerSourceCapability = {
160703
161366
  id: "powerSource.on",
160704
161367
  label: t("Power on", "Dai corrente"),
160705
161368
  phrase: t("Power on {device}", "Dai corrente a {device}"),
160706
- icon: "power"
161369
+ icon: "power",
161370
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160707
161371
  }]
160708
161372
  }),
160709
161373
  powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -160713,7 +161377,8 @@ var powerSourceCapability = {
160713
161377
  id: "powerSource.off",
160714
161378
  label: t("Power off", "Togli corrente"),
160715
161379
  phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
160716
- icon: "power-off"
161380
+ icon: "power-off",
161381
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160717
161382
  }]
160718
161383
  }),
160719
161384
  forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -162426,6 +163091,205 @@ var SiteZoneSchema = object({
162426
163091
  * the ones that most want grouping. */
162427
163092
  locationKeys: array(string())
162428
163093
  });
163094
+ /**
163095
+ * Provider-declared device identifiers (D1059, planning#590).
163096
+ *
163097
+ * What a device IS, as its owning provider read it from the hardware: the keys a
163098
+ * later step matches across integrations to tell that two devices are the same
163099
+ * physical object. Separate from `DeviceMetadata` on purpose — metadata is a
163100
+ * free-form blob the operator can edit, identifiers are typed, normalised and
163101
+ * written ONLY by the provider that owns the device (`device-manager.
163102
+ * setIdentifiers`, owner-checked on the transport's caller stamp).
163103
+ *
163104
+ * | Key | Stored form | Strength |
163105
+ * | -------------- | ----------------------------------- | -------- |
163106
+ * | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
163107
+ * | `serial` | `<manufacturer>:<serial>` | strong |
163108
+ * | `machine-uuid` | SMBIOS / VM / container uuid | strong |
163109
+ * | `vendor-uid` | `<vendor>:<id>` | strong |
163110
+ * | `hostname` | lower-case, no domain | weak |
163111
+ * | `ip` | IPv4 / IPv6 | weak |
163112
+ *
163113
+ * Strength is a property of the KEY, derived by {@link identifierStrength} —
163114
+ * never stored, so it cannot drift from the table above. A weak key never links
163115
+ * two devices on its own.
163116
+ *
163117
+ * The schema refuses a value that is not in its stored form, so whatever is
163118
+ * persisted is already normalised. Build a declaration with
163119
+ * {@link normaliseIdentifiers}, which turns the raw values a driver read into
163120
+ * that form and names every value it refused.
163121
+ */
163122
+ var DEVICE_IDENTIFIER_KEYS = [
163123
+ "mac",
163124
+ "serial",
163125
+ "machine-uuid",
163126
+ "vendor-uid",
163127
+ "hostname",
163128
+ "ip"
163129
+ ];
163130
+ var DeviceIdentifierKeySchema = _enum(DEVICE_IDENTIFIER_KEYS);
163131
+ /** `read` — the provider read it from the device; `derived` — computed from something else it read. */
163132
+ var DeviceIdentifierOriginSchema = _enum(["read", "derived"]);
163133
+ var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
163134
+ /** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
163135
+ var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
163136
+ var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
163137
+ var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
163138
+ function entrySchema(value) {
163139
+ return object({
163140
+ value,
163141
+ origin: DeviceIdentifierOriginSchema,
163142
+ /** Epoch ms of the FIRST read that produced this value (and origin). A later
163143
+ * read of the same value does not move it — see {@link mergeIdentifiers}. */
163144
+ readAt: number$1().int().nonnegative()
163145
+ }).strict();
163146
+ }
163147
+ var MacEntrySchema = entrySchema(string().regex(MAC_PATTERN));
163148
+ var SerialEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163149
+ var MachineUuidEntrySchema = entrySchema(string().regex(MACHINE_UUID_PATTERN));
163150
+ var VendorUidEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163151
+ var HostnameEntrySchema = entrySchema(string().regex(HOSTNAME_PATTERN));
163152
+ var IpEntrySchema = entrySchema(union([ipv4(), ipv6()]));
163153
+ object({
163154
+ value: string().min(1),
163155
+ origin: DeviceIdentifierOriginSchema,
163156
+ readAt: number$1().int().nonnegative()
163157
+ }).strict();
163158
+ /** The typed declaration. Every key optional; `mac` the only one that holds several. */
163159
+ var DeviceIdentifiersSchema = object({
163160
+ mac: array(MacEntrySchema).min(1).readonly().optional(),
163161
+ serial: SerialEntrySchema.optional(),
163162
+ "machine-uuid": MachineUuidEntrySchema.optional(),
163163
+ "vendor-uid": VendorUidEntrySchema.optional(),
163164
+ hostname: HostnameEntrySchema.optional(),
163165
+ ip: IpEntrySchema.optional()
163166
+ }).strict();
163167
+ /** True when the declaration carries no key at all. */
163168
+ function isEmptyIdentifiers(identifiers) {
163169
+ return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
163170
+ }
163171
+ /** Values devices report when they do not know: never an identity. */
163172
+ var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
163173
+ var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
163174
+ function rejected(reason) {
163175
+ return {
163176
+ ok: false,
163177
+ reason
163178
+ };
163179
+ }
163180
+ /** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
163181
+ function normaliseMac(raw) {
163182
+ const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
163183
+ if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
163184
+ const mac = (hex.match(/../g) ?? []).join(":");
163185
+ if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
163186
+ return {
163187
+ ok: true,
163188
+ value: mac
163189
+ };
163190
+ }
163191
+ function slug$2(raw) {
163192
+ return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
163193
+ }
163194
+ function normalisePrefixed(prefixRaw, valueRaw, what) {
163195
+ const prefix = slug$2(prefixRaw);
163196
+ if (prefix.length === 0) return rejected(`no ${what}`);
163197
+ const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
163198
+ if (value.length === 0) return rejected("blank value");
163199
+ if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
163200
+ return {
163201
+ ok: true,
163202
+ value: `${prefix}:${value}`
163203
+ };
163204
+ }
163205
+ function normaliseMachineUuid(raw) {
163206
+ const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
163207
+ if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
163208
+ if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
163209
+ return {
163210
+ ok: true,
163211
+ value
163212
+ };
163213
+ }
163214
+ function isIp(value) {
163215
+ return union([ipv4(), ipv6()]).safeParse(value).success;
163216
+ }
163217
+ function normaliseHostname(raw) {
163218
+ const full = raw.trim().toLowerCase().replace(/\.$/, "");
163219
+ if (full.length === 0) return rejected("blank hostname");
163220
+ if (isIp(full)) return rejected("an address, not a hostname");
163221
+ const label = full.split(".")[0] ?? "";
163222
+ if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
163223
+ if (label === "localhost") return rejected("placeholder hostname");
163224
+ return {
163225
+ ok: true,
163226
+ value: label
163227
+ };
163228
+ }
163229
+ function normaliseIp(raw) {
163230
+ const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
163231
+ if (!isIp(value)) return rejected("not an IP address");
163232
+ if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
163233
+ return {
163234
+ ok: true,
163235
+ value
163236
+ };
163237
+ }
163238
+ function isBlank(value) {
163239
+ return value === null || value === void 0 || value.trim().length === 0;
163240
+ }
163241
+ /**
163242
+ * Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
163243
+ * with colons and de-duplicated, a hostname without its domain, an IP validated,
163244
+ * a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
163245
+ * cannot be normalised is left out and listed in `rejected` — the caller logs it
163246
+ * (with `tags: { deviceId }`), it is never dropped in silence.
163247
+ */
163248
+ function normaliseIdentifiers(raw, options = {}) {
163249
+ const readAt = options.readAt ?? Date.now();
163250
+ const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
163251
+ const entry = (key, value) => ({
163252
+ value,
163253
+ origin: originOf(key),
163254
+ readAt
163255
+ });
163256
+ const refused = [];
163257
+ const take = (key, input, result) => {
163258
+ if (result.ok) return entry(key, result.value);
163259
+ refused.push({
163260
+ key,
163261
+ value: input,
163262
+ reason: result.reason
163263
+ });
163264
+ };
163265
+ const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
163266
+ const macs = [];
163267
+ for (const input of macInputs) {
163268
+ if (isBlank(input)) continue;
163269
+ const taken = take("mac", input, normaliseMac(input));
163270
+ if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
163271
+ }
163272
+ 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"));
163273
+ 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"));
163274
+ const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
163275
+ const host = isBlank(raw.host) ? null : raw.host.trim();
163276
+ const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
163277
+ const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
163278
+ const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
163279
+ const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
163280
+ const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
163281
+ return {
163282
+ identifiers: {
163283
+ ...macs.length > 0 ? { mac: macs } : {},
163284
+ ...serial !== void 0 ? { serial } : {},
163285
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
163286
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
163287
+ ...hostname !== void 0 ? { hostname } : {},
163288
+ ...ip !== void 0 ? { ip } : {}
163289
+ },
163290
+ rejected: refused
163291
+ };
163292
+ }
162429
163293
  var DeviceSearchRequiresSchema = object({
162430
163294
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
162431
163295
  caps: array(string()).readonly().optional(),
@@ -162988,6 +163852,10 @@ var DeviceInfoSchema = object({
162988
163852
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
162989
163853
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
162990
163854
  metadata: record(string(), unknown()).nullable().optional(),
163855
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
163856
+ * the owning provider via `setIdentifiers`; read-only for the operator.
163857
+ * Absent ⇒ the provider declared none. */
163858
+ identifiers: DeviceIdentifiersSchema.optional(),
162991
163859
  /** Optional upstream-system identity + rendering envelope. See
162992
163860
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
162993
163861
  sourceInfo: SourceInfoSchema.optional(),
@@ -163139,6 +164007,8 @@ var DeviceMetaSchema = object({
163139
164007
  disabled: boolean(),
163140
164008
  parentDeviceId: number$1().nullable(),
163141
164009
  metadata: record(string(), unknown()).nullable().optional(),
164010
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
164011
+ identifiers: DeviceIdentifiersSchema.optional(),
163142
164012
  /** Optional upstream-system identity + rendering envelope. See
163143
164013
  * `SourceInfo`. Present when the device has been persisted with a
163144
164014
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -163452,6 +164322,14 @@ method(object({
163452
164322
  }), _void(), {
163453
164323
  kind: "mutation",
163454
164324
  auth: "admin"
164325
+ }), method(object({
164326
+ deviceId: number$1(),
164327
+ identifiers: DeviceIdentifiersSchema.nullable(),
164328
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
164329
+ unread: array(DeviceIdentifierKeySchema).optional()
164330
+ }), _void(), {
164331
+ kind: "mutation",
164332
+ auth: "admin"
163455
164333
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
163456
164334
  kind: "mutation",
163457
164335
  auth: "admin"
@@ -168649,8 +169527,8 @@ var HeroSceneSchema = object({
168649
169527
  /** 0..1: volume, cover position, cycle progress. */
168650
169528
  level: number$1().min(0).max(1).nullable()
168651
169529
  });
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;
169530
+ 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;
169531
+ 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
169532
  var HeroRowIdSchema = _enum([
168655
169533
  "progress",
168656
169534
  "run-for",
@@ -168879,8 +169757,12 @@ var HeroPowerSupplySlotSchema = object({
168879
169757
  /** Off asks for a confirmation while the device runs. */
168880
169758
  confirmOffWhileRunning: boolean(),
168881
169759
  running: boolean().nullable(),
168882
- powerOn: HeroActionSchema,
168883
- powerOff: HeroActionSchema,
169760
+ /**
169761
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
169762
+ * API key): power on / off would always be refused. The restart stays (D1058).
169763
+ */
169764
+ powerOn: HeroActionSchema.nullable(),
169765
+ powerOff: HeroActionSchema.nullable(),
168884
169766
  restart: HeroActionSchema
168885
169767
  });
168886
169768
  var HeroStateBackdropSchema = object({
@@ -179640,6 +180522,19 @@ var NetworkLinkStatusSchema = object({
179640
180522
  rssi: number$1().optional().meta(readingMeta("signal-level")),
179641
180523
  /** Network name of a wireless link, when the firmware reports it. */
179642
180524
  ssid: string().optional(),
180525
+ /**
180526
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
180527
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
180528
+ * `null` = the port is down or the speed is not known; absent = the provider
180529
+ * never reports one.
180530
+ */
180531
+ speedKbps: number$1().nonnegative().nullable().optional().meta(readingMeta("bitrate")),
180532
+ /**
180533
+ * Whether the link is up. `type` names the medium, not its state, so a wired
180534
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
180535
+ * absent = the provider never reports it.
180536
+ */
180537
+ linkUp: boolean().nullable().optional(),
179643
180538
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
179644
180539
  lastUpdated: number$1().meta(readingMeta("none"))
179645
180540
  });
@@ -181844,7 +182739,32 @@ var NcRuleInputSchema = object({
181844
182739
  * authored before this field meant. An editor turns it off by writing
181845
182740
  * `false`, so it needs no `clear` key.
181846
182741
  */
181847
- askVerdict: boolean().optional()
182742
+ askVerdict: boolean().optional(),
182743
+ /**
182744
+ * Operator tags (D1054), kept on the rule like a core block's. Absent = no
182745
+ * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
182746
+ * does not name `tags` keeps the stored ones (the store merges), and an
182747
+ * editor empties them by sending `[]` (the store drops an empty list).
182748
+ * Renamed or removed fleet-wide only through the `tags` cap, which writes
182749
+ * here with `setRuleTags`.
182750
+ */
182751
+ tags: TagsFieldSchema.optional()
182752
+ });
182753
+ /**
182754
+ * The rule kinds that carry tags (D1054) — each one its own store. Every kind
182755
+ * labels its rules the same way; this names which store a tag write goes to.
182756
+ */
182757
+ var NcTaggedRuleKindSchema = _enum([
182758
+ "event",
182759
+ "summary",
182760
+ "timelapse",
182761
+ "calendar-events"
182762
+ ]);
182763
+ /** One rule's tags, as the `tags` cap reads them across every kind. */
182764
+ var NcRuleTagsEntrySchema = object({
182765
+ kind: NcTaggedRuleKindSchema,
182766
+ ruleId: string(),
182767
+ tags: array(string())
181848
182768
  });
181849
182769
  /**
181850
182770
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -182861,6 +183781,16 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
182861
183781
  }), object({ success: literal(true) }), {
182862
183782
  kind: "mutation",
182863
183783
  auth: "admin"
183784
+ }), method(object({}), object({ rules: array(NcRuleTagsEntrySchema) }), {
183785
+ kind: "query",
183786
+ auth: "admin"
183787
+ }), method(object({
183788
+ kind: NcTaggedRuleKindSchema,
183789
+ ruleId: string(),
183790
+ tags: TagsFieldSchema
183791
+ }), object({ success: literal(true) }), {
183792
+ kind: "mutation",
183793
+ auth: "admin"
182864
183794
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
182865
183795
  deviceId: number$1().int(),
182866
183796
  muted: boolean()
@@ -188864,7 +189794,18 @@ var videoclipsCapability = {
188864
189794
  * older than this field keeps working unchanged (D382 — an unstated
188865
189795
  * ask is zero).
188866
189796
  */
188867
- audio: ClipStreamAudioSchema.optional()
189797
+ audio: ClipStreamAudioSchema.optional(),
189798
+ /**
189799
+ * The operator's authorisation to wake a sleeping camera for this
189800
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
189801
+ * — the default — means a sleeping standalone battery camera is
189802
+ * REFUSED by name before any URL is minted. A caller sets it only
189803
+ * when a viewer itself asked for the clip (the broker's `playClip`);
189804
+ * a prefetch, a reconcile or a retry never does. With it, the
189805
+ * provider wakes the camera and waits under a bound; a camera that
189806
+ * does not come up is refused `wake-timeout`, naming the wait.
189807
+ */
189808
+ wake: ClipWakeSchema.optional()
188868
189809
  }), ClipStreamDialSchema, {
188869
189810
  kind: "query",
188870
189811
  auth: "protected"
@@ -189168,7 +190109,8 @@ _enum([
189168
190109
  "camera-refused",
189169
190110
  "fetch-failed",
189170
190111
  "too-large-to-transfer",
189171
- "wake-expired"
190112
+ "wake-expired",
190113
+ "wake-timeout"
189172
190114
  ]);
189173
190115
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
189174
190116
  function clipExportFailure(code, detail) {
@@ -191428,6 +192370,16 @@ var SirenOptionsSchema = object({
191428
192370
  rangeSeconds: SirenDurationRangeSchema.nullable(),
191429
192371
  /** The camera's default duration, seconds. */
191430
192372
  defaultSeconds: number$1().positive(),
192373
+ /**
192374
+ * Discrete play counts the operator may pick; `null` when the camera gives a
192375
+ * range or does not count plays. Defaults to `null` so a provider that
192376
+ * predates plays (#589) reads as declaring none.
192377
+ */
192378
+ allowedPlays: array(number$1().int().positive()).nullable().default(null),
192379
+ /** Continuous range of play counts; `null` when listed or not counted. */
192380
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
192381
+ /** The camera's default play count; `null` when the camera does not count plays. */
192382
+ defaultPlays: number$1().int().positive().nullable().default(null),
191431
192383
  /** What the camera counts natively. */
191432
192384
  unit: _enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
191433
192385
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -191444,9 +192396,28 @@ var SirenStatusSchema = object({
191444
192396
  activeUntil: number$1().nullable(),
191445
192397
  /** Duration of the current / last activation, seconds; `null` when none yet. */
191446
192398
  durationSeconds: number$1().nullable(),
192399
+ /**
192400
+ * The play count of the current / last activation when it was asked in plays;
192401
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
192402
+ */
192403
+ plays: number$1().int().positive().nullable().default(null),
192404
+ /**
192405
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
192406
+ * not report — the siren may fall silent somewhat earlier or later.
192407
+ */
192408
+ activeUntilEstimated: boolean().default(false),
191447
192409
  /** Ms epoch of the last trigger (0 = never). */
191448
192410
  lastTriggeredAt: number$1()
191449
192411
  });
192412
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
192413
+ var SirenTriggerInputSchema = object({
192414
+ deviceId: number$1().int().nonnegative(),
192415
+ durationSeconds: number$1().positive().optional(),
192416
+ plays: number$1().int().positive().optional()
192417
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
192418
+ message: "a siren trigger takes durationSeconds or plays, not both",
192419
+ path: ["plays"]
192420
+ });
191450
192421
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
191451
192422
  /** Ms epoch of the last successful camera read of the options (0 = never). */
191452
192423
  lastFetchedAt: number$1() });
@@ -191463,13 +192434,20 @@ var sirenCapability = {
191463
192434
  auth: "protected"
191464
192435
  }),
191465
192436
  /**
191466
- * Sound the siren. Without `durationSeconds` the camera default applies.
191467
- * Answers the state at the moment of the trigger (`activeUntil` included).
192437
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
192438
+ * its range spelled out. Empty for a siren that counts seconds.
191468
192439
  */
191469
- trigger: method(object({
191470
- deviceId: number$1().int().nonnegative(),
191471
- durationSeconds: number$1().positive().optional()
191472
- }), SirenStatusSchema, {
192440
+ getPlayChoices: method(object({ deviceId: number$1().int().nonnegative() }), array(number$1().int().positive()), {
192441
+ kind: "query",
192442
+ auth: "protected"
192443
+ }),
192444
+ /**
192445
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
192446
+ * neither the camera default applies. A count on a siren that declares no
192447
+ * plays is refused. Answers the state at the moment of the trigger
192448
+ * (`activeUntil` included).
192449
+ */
192450
+ trigger: method(SirenTriggerInputSchema, SirenStatusSchema, {
191473
192451
  kind: "mutation",
191474
192452
  auth: "protected",
191475
192453
  actions: [{
@@ -191478,6 +192456,21 @@ var sirenCapability = {
191478
192456
  phrase: t("Sound {device}", "Fai suonare {device}"),
191479
192457
  icon: "siren",
191480
192458
  args: {}
192459
+ }, {
192460
+ id: "siren.triggerPlays",
192461
+ label: t("Sound the siren N times", "Fai suonare la sirena N volte"),
192462
+ phrase: t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
192463
+ icon: "siren",
192464
+ openArgs: [{
192465
+ key: "plays",
192466
+ label: t("Plays", "Riproduzioni"),
192467
+ offer: {
192468
+ kind: "dynamic",
192469
+ from: "method",
192470
+ method: "getPlayChoices",
192471
+ valueKind: "number"
192472
+ }
192473
+ }]
191481
192474
  }]
191482
192475
  }),
191483
192476
  /** Silence the siren now. */
@@ -192768,6 +193761,27 @@ var SwitchStatusSchema = object({
192768
193761
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
192769
193762
  lastChangedAt: number$1()
192770
193763
  });
193764
+ /**
193765
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
193766
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
193767
+ *
193768
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
193769
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
193770
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
193771
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
193772
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
193773
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
193774
+ * read that failed or is pending changes nothing (D315).
193775
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
193776
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
193777
+ * `power-source.forceRestart` uses it instead of off / wait / on.
193778
+ */
193779
+ var SwitchOptionsSchema = object({
193780
+ supportsSetState: boolean().default(true),
193781
+ supportsPowerCycle: boolean().default(false)
193782
+ });
193783
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
193784
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
192771
193785
  var switchCapability = {
192772
193786
  name: "switch",
192773
193787
  scope: "device",
@@ -192795,7 +193809,8 @@ var switchCapability = {
192795
193809
  field: "on",
192796
193810
  value: true
192797
193811
  },
192798
- args: { on: true }
193812
+ args: { on: true },
193813
+ offeredWhen: SWITCH_SETTABLE_GATE
192799
193814
  }, {
192800
193815
  id: "switch.off",
192801
193816
  label: t("Turn off", "Spegni"),
@@ -192805,9 +193820,16 @@ var switchCapability = {
192805
193820
  field: "on",
192806
193821
  value: false
192807
193822
  },
192808
- args: { on: false }
193823
+ args: { on: false },
193824
+ offeredWhen: SWITCH_SETTABLE_GATE
192809
193825
  }]
192810
193826
  }),
193827
+ getOptions: optionalMethod(object({ deviceId: number$1() }), SwitchOptionsSchema, { auth: "protected" }),
193828
+ powerCycle: optionalMethod(object({ deviceId: number$1() }), _void(), {
193829
+ kind: "mutation",
193830
+ auth: "protected",
193831
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
193832
+ }),
192811
193833
  toggle: optionalMethod(object({ deviceId: number$1() }), _void(), {
192812
193834
  kind: "mutation",
192813
193835
  auth: "protected",
@@ -192815,7 +193837,8 @@ var switchCapability = {
192815
193837
  id: "switch.toggle",
192816
193838
  label: t("Toggle", "Commuta"),
192817
193839
  phrase: t("Toggle {device}", "Commuta {device}"),
192818
- icon: "toggle-right"
193840
+ icon: "toggle-right",
193841
+ offeredWhen: SWITCH_SETTABLE_GATE
192819
193842
  }]
192820
193843
  })
192821
193844
  },
@@ -192837,6 +193860,16 @@ var switchCapability = {
192837
193860
  * not need to re-query the provider after a setState mutation.
192838
193861
  */
192839
193862
  runtimeState: SwitchStatusSchema,
193863
+ composedMethods: {
193864
+ getOptions: {
193865
+ kind: "answer",
193866
+ value: SWITCH_DEFAULT_OPTIONS
193867
+ },
193868
+ powerCycle: {
193869
+ kind: "refuse",
193870
+ reason: "a composed switch has no native power cycle"
193871
+ }
193872
+ },
192840
193873
  /**
192841
193874
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
192842
193875
  *
@@ -193010,6 +194043,26 @@ var switchCapability = {
193010
194043
  "switch.off": { icon: "plug" }
193011
194044
  },
193012
194045
  state: { on: { icon: "plug-zap" } }
194046
+ },
194047
+ [DeviceRole.PoePort]: {
194048
+ actions: {
194049
+ "switch.on": {
194050
+ label: t("Power on", "Alimenta"),
194051
+ phrase: t("Power on {device}", "Alimenta {device}"),
194052
+ icon: "plug-zap"
194053
+ },
194054
+ "switch.off": {
194055
+ label: t("Power off", "Togli alimentazione"),
194056
+ phrase: t("Power off {device}", "Togli alimentazione a {device}"),
194057
+ icon: "unplug"
194058
+ }
194059
+ },
194060
+ state: { on: {
194061
+ label: t("Powered", "Alimentata"),
194062
+ whenTrue: t("When {device} is powered", "Quando {device} viene alimentata"),
194063
+ whenFalse: t("When {device} loses power", "Quando {device} perde l’alimentazione"),
194064
+ icon: "plug-zap"
194065
+ } }
193013
194066
  }
193014
194067
  }
193015
194068
  }
@@ -193599,10 +194652,11 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
193599
194652
  /**
193600
194653
  * tags — the registry of tag STYLES and the one place that renames or removes a
193601
194654
  * 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
194655
+ * labels (a core block, a scheduler, a template, an action, a device, a
194656
+ * notification rule); only its
193603
194657
  * 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`.
194658
+ * the one place that knows every owner kind; devices and notification rules
194659
+ * are reached through `deviceManager` / `notificationRules` over `ctx.api`.
193606
194660
  *
193607
194661
  * Tags compare trimmed and case-insensitively. `list` is the union of styled tags
193608
194662
  * and tags in use; a tag with no style answers a colour derived from its name and
@@ -193613,7 +194667,21 @@ var TagUsageCountsSchema = object({
193613
194667
  schedulers: number$1().int().nonnegative(),
193614
194668
  templates: number$1().int().nonnegative(),
193615
194669
  actions: number$1().int().nonnegative(),
193616
- devices: number$1().int().nonnegative()
194670
+ devices: number$1().int().nonnegative(),
194671
+ notificationRules: number$1().int().nonnegative()
194672
+ });
194673
+ /**
194674
+ * The counts `list` answers. An owner that could not be read (a forked addon
194675
+ * that is down, redeploying or not installed) is `null` — unknown, never `0`
194676
+ * (D393) — and `list` still answers with the other owners' tags.
194677
+ */
194678
+ var TagListCountsSchema = object({
194679
+ coreBlocks: number$1().int().nonnegative().nullable(),
194680
+ schedulers: number$1().int().nonnegative().nullable(),
194681
+ templates: number$1().int().nonnegative().nullable(),
194682
+ actions: number$1().int().nonnegative().nullable(),
194683
+ devices: number$1().int().nonnegative().nullable(),
194684
+ notificationRules: number$1().int().nonnegative().nullable()
193617
194685
  });
193618
194686
  var TagEntrySchema = object({
193619
194687
  name: TagNameSchema,
@@ -193621,7 +194689,8 @@ var TagEntrySchema = object({
193621
194689
  icon: IconKeySchema,
193622
194690
  /** `false` when the operator never chose a style: colour and icon are the derived defaults. */
193623
194691
  styled: boolean(),
193624
- counts: TagUsageCountsSchema
194692
+ /** Per owner kind; `null` = that owner could not be read on this call. */
194693
+ counts: TagListCountsSchema
193625
194694
  });
193626
194695
  method(object({}), array(TagEntrySchema), { auth: "protected" }), method(object({
193627
194696
  name: TagNameSchema,
@@ -194162,7 +195231,6 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
194162
195231
  });
194163
195232
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
194164
195233
  var ProfileSettingsSchemaBridge = unknown().nullable();
194165
- var ProfileSettingsBagSchema = record(string(), unknown());
194166
195234
  /**
194167
195235
  * A live terminal session hosted by the provider addon. Output and input do
194168
195236
  * NOT flow through the capability — they use the addon data plane
@@ -194181,7 +195249,11 @@ var TerminalSessionInfoSchema = object({
194181
195249
  cols: number$1().int().positive(),
194182
195250
  rows: number$1().int().positive(),
194183
195251
  /** ms-epoch the session's pty was spawned. */
194184
- startedAt: number$1()
195252
+ startedAt: number$1(),
195253
+ /** User id of the admin who opened it; `unattributed` when the caller was not passed. */
195254
+ openedBy: string().optional(),
195255
+ /** ms-epoch of the last pty input or output — what the idle timeout measures. */
195256
+ lastActivityAt: number$1().optional()
194185
195257
  });
194186
195258
  /**
194187
195259
  * A profile the operator may open — a pre-declared, allowlisted program
@@ -194201,39 +195273,6 @@ var TerminalProfileInfoSchema = object({
194201
195273
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
194202
195274
  settingsSchema: ProfileSettingsSchemaBridge.optional()
194203
195275
  });
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
195276
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
194238
195277
  seq: number$1().int().positive(),
194239
195278
  kind: literal("data"),
@@ -194261,13 +195300,7 @@ var TerminalOutputBatchSchema = object({
194261
195300
  snapshot: string().optional(),
194262
195301
  events: array(TerminalOutputEventSchema).readonly()
194263
195302
  });
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({
195303
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
194271
195304
  profileId: string(),
194272
195305
  cols: number$1().int().positive(),
194273
195306
  rows: number$1().int().positive(),
@@ -196985,6 +198018,427 @@ DeviceType.Camera, method(object({ deviceId: number$1().int().nonnegative() }),
196985
198018
  deviceId: number$1().int().nonnegative(),
196986
198019
  sessionId: string()
196987
198020
  }), WebrtcSessionDebugSchema, { kind: "query" });
198021
+ var WorkloadStateSchema = _enum([
198022
+ "running",
198023
+ "paused",
198024
+ "stopped",
198025
+ "starting",
198026
+ "stopping",
198027
+ "crashed"
198028
+ ]);
198029
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
198030
+ var WORKLOAD_ROLES = [
198031
+ DeviceRole.Vm,
198032
+ DeviceRole.AppContainer,
198033
+ DeviceRole.Lxc,
198034
+ DeviceRole.App,
198035
+ DeviceRole.Host
198036
+ ];
198037
+ /**
198038
+ * What the workload uses. Every value is `null` when not reported (D393). A host
198039
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
198040
+ */
198041
+ var WorkloadResourcesSchema = object({
198042
+ /** CPU use, percent of the CPUs it may use (0–100). */
198043
+ cpuPercent: number$1().nullable().meta(readingMeta("percentage", { precision: 1 })),
198044
+ memoryUsedBytes: number$1().nullable().meta(readingMeta("information")),
198045
+ /**
198046
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
198047
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
198048
+ */
198049
+ memoryPercent: number$1().nullable().optional().meta(readingMeta("percentage", { precision: 1 })),
198050
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
198051
+ memoryLimitBytes: number$1().nullable().meta(readingMeta("information")),
198052
+ vcpus: number$1().nullable().meta(readingMeta("count")),
198053
+ diskUsedBytes: number$1().nullable().meta(readingMeta("information")),
198054
+ diskTotalBytes: number$1().nullable().meta(readingMeta("information")),
198055
+ /** Network received, kbit/s. */
198056
+ netRxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198057
+ /** Network sent, kbit/s. */
198058
+ netTxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198059
+ /** One-minute load average (a host). */
198060
+ load1: number$1().nullable().meta(readingMeta("index", { precision: 2 })),
198061
+ /** CPU / board temperature (a host). */
198062
+ temperature: number$1().nullable().meta(readingMeta("temperature", { precision: 1 }))
198063
+ });
198064
+ var WorkloadPortProtocolSchema = _enum(["tcp", "udp"]);
198065
+ /** One published port: the workload's own port and where the host exposes it. */
198066
+ var WorkloadPortSchema = object({
198067
+ port: number$1().int().meta(readingMeta("none")),
198068
+ /** The host port it is published on; null = not published. */
198069
+ hostPort: number$1().int().nullable().meta(readingMeta("none")),
198070
+ /** The host address it is bound to; null = every address. */
198071
+ hostIp: string().nullable(),
198072
+ protocol: WorkloadPortProtocolSchema
198073
+ });
198074
+ var WorkloadStatusSchema = object({
198075
+ /** null = unknown, never stopped (D393). */
198076
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
198077
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
198078
+ since: number$1().nullable().meta(readingMeta("none")),
198079
+ /** The `host` device this runs on, when the provider has adopted it. */
198080
+ hostDeviceId: number$1().int().nullable().meta(readingMeta("device")),
198081
+ /** The image a container runs (`nginx:1.27`). */
198082
+ image: string().nullable(),
198083
+ /** The operating system (a VM, an LXC, a host). */
198084
+ os: string().nullable(),
198085
+ /** The version or firmware it runs. */
198086
+ version: string().nullable(),
198087
+ /** Starts with its host; null when the platform does not say. */
198088
+ autostart: boolean().nullable(),
198089
+ resources: WorkloadResourcesSchema,
198090
+ ports: array(WorkloadPortSchema),
198091
+ /** The addresses it is reachable on (IPs or host names). */
198092
+ addresses: array(string()),
198093
+ /** A newer image / version exists. Installing it stays the `update` cap. */
198094
+ updateAvailable: boolean().nullable(),
198095
+ lastFetchedAt: number$1()
198096
+ });
198097
+ /**
198098
+ * What this device can do, probed by its provider (D14 honesty): a flag is
198099
+ * `true` only when the platform really serves it for THIS device.
198100
+ */
198101
+ var WorkloadOptionsSchema = object({
198102
+ supportsStart: boolean(),
198103
+ supportsStop: boolean(),
198104
+ supportsRestart: boolean(),
198105
+ /** Pause AND resume. */
198106
+ supportsPause: boolean(),
198107
+ supportsForceStop: boolean(),
198108
+ hasResources: boolean(),
198109
+ hasPorts: boolean(),
198110
+ hasAddresses: boolean(),
198111
+ hasAutostart: boolean(),
198112
+ hasUpdateCheck: boolean()
198113
+ });
198114
+ var WorkloadDeviceInputSchema = object({ deviceId: number$1().int().nonnegative() });
198115
+ var WorkloadTransitionEventDataSchema = object({
198116
+ deviceId: number$1(),
198117
+ state: WorkloadStateSchema,
198118
+ previous: WorkloadStateSchema,
198119
+ since: number$1().nullable()
198120
+ });
198121
+ EventCategory.WorkloadStarted, EventCategory.WorkloadStopped, EventCategory.WorkloadCrashed, EventCategory.WorkloadRecovered;
198122
+ var workloadCapability = {
198123
+ name: "workload",
198124
+ scope: "device",
198125
+ deviceNative: true,
198126
+ mode: "singleton",
198127
+ deviceTypes: [DeviceType.Workload],
198128
+ deviceRoles: { [DeviceType.Workload]: WORKLOAD_ROLES },
198129
+ /**
198130
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
198131
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
198132
+ * second on/off state. A device whose provider serves no start / stop gets no
198133
+ * switch.
198134
+ */
198135
+ power: {
198136
+ kind: "methods",
198137
+ field: "state",
198138
+ offValues: ["stopped", "crashed"],
198139
+ on: "start",
198140
+ off: "stop"
198141
+ },
198142
+ methods: {
198143
+ start: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198144
+ kind: "mutation",
198145
+ auth: "protected",
198146
+ actions: [{
198147
+ id: "workload.start",
198148
+ label: t("Start", "Avvia"),
198149
+ phrase: t("Start {device}", "Avvia {device}"),
198150
+ icon: "play",
198151
+ effect: {
198152
+ field: "state",
198153
+ value: "running"
198154
+ }
198155
+ }]
198156
+ }),
198157
+ stop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198158
+ kind: "mutation",
198159
+ auth: "protected",
198160
+ actions: [{
198161
+ id: "workload.stop",
198162
+ label: t("Stop", "Arresta"),
198163
+ phrase: t("Stop {device}", "Arresta {device}"),
198164
+ icon: "square",
198165
+ effect: {
198166
+ field: "state",
198167
+ value: "stopped"
198168
+ }
198169
+ }]
198170
+ }),
198171
+ restart: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198172
+ kind: "mutation",
198173
+ auth: "protected",
198174
+ actions: [{
198175
+ id: "workload.restart",
198176
+ label: t("Restart", "Riavvia"),
198177
+ phrase: t("Restart {device}", "Riavvia {device}"),
198178
+ icon: "rotate-ccw"
198179
+ }]
198180
+ }),
198181
+ pause: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198182
+ kind: "mutation",
198183
+ auth: "protected",
198184
+ actions: [{
198185
+ id: "workload.pause",
198186
+ label: t("Pause", "Metti in pausa"),
198187
+ phrase: t("Pause {device}", "Metti in pausa {device}"),
198188
+ icon: "pause",
198189
+ effect: {
198190
+ field: "state",
198191
+ value: "paused"
198192
+ }
198193
+ }]
198194
+ }),
198195
+ resume: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198196
+ kind: "mutation",
198197
+ auth: "protected",
198198
+ actions: [{
198199
+ id: "workload.resume",
198200
+ label: t("Resume", "Riprendi"),
198201
+ phrase: t("Resume {device}", "Riprendi {device}"),
198202
+ icon: "circle-play",
198203
+ effect: {
198204
+ field: "state",
198205
+ value: "running"
198206
+ }
198207
+ }]
198208
+ }),
198209
+ forceStop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198210
+ kind: "mutation",
198211
+ auth: "admin",
198212
+ actions: [{
198213
+ id: "workload.forceStop",
198214
+ label: t("Force stop", "Arresto forzato"),
198215
+ phrase: t("Force {device} to stop", "Forza l’arresto di {device}"),
198216
+ icon: "octagon-x",
198217
+ effect: {
198218
+ field: "state",
198219
+ value: "stopped"
198220
+ }
198221
+ }]
198222
+ }),
198223
+ /** What THIS device can do, probed — the UI is derived from it. */
198224
+ getOptions: method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
198225
+ },
198226
+ events: {
198227
+ onStarted: {
198228
+ data: WorkloadTransitionEventDataSchema,
198229
+ trigger: {
198230
+ category: EventCategory.WorkloadStarted,
198231
+ label: t("Started", "Avviato"),
198232
+ phrase: t("When {device} starts", "Quando {device} si avvia"),
198233
+ icon: "play"
198234
+ }
198235
+ },
198236
+ onStopped: {
198237
+ data: WorkloadTransitionEventDataSchema,
198238
+ trigger: {
198239
+ category: EventCategory.WorkloadStopped,
198240
+ label: t("Stopped", "Arrestato"),
198241
+ phrase: t("When {device} stops", "Quando {device} si arresta"),
198242
+ icon: "square"
198243
+ }
198244
+ },
198245
+ onCrashed: {
198246
+ data: WorkloadTransitionEventDataSchema,
198247
+ trigger: {
198248
+ category: EventCategory.WorkloadCrashed,
198249
+ label: t("Crashed", "Arrestato in modo anomalo"),
198250
+ phrase: t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
198251
+ icon: "triangle-alert"
198252
+ }
198253
+ },
198254
+ onRecovered: {
198255
+ data: WorkloadTransitionEventDataSchema,
198256
+ trigger: {
198257
+ category: EventCategory.WorkloadRecovered,
198258
+ label: t("Recovered", "Ripristinato"),
198259
+ phrase: t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
198260
+ icon: "heart-pulse"
198261
+ }
198262
+ }
198263
+ },
198264
+ status: {
198265
+ schema: WorkloadStatusSchema,
198266
+ kind: "poll"
198267
+ },
198268
+ runtimeState: WorkloadStatusSchema,
198269
+ /**
198270
+ * Runtime-state durability: **session** — the provider answers on its next
198271
+ * poll; the series are recorded, so a restart that clears the slice loses
198272
+ * nothing a reader needs. The events are judged from the first state seen.
198273
+ */
198274
+ durability: "session",
198275
+ /**
198276
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
198277
+ * the charts need no per-metric child device.
198278
+ */
198279
+ history: {
198280
+ primary: "resources.cpuPercent",
198281
+ priority: 40,
198282
+ fields: {
198283
+ state: { kind: "enum" },
198284
+ "resources.cpuPercent": {
198285
+ kind: "gauge",
198286
+ unit: "%",
198287
+ deadband: 2,
198288
+ displayName: "CPU"
198289
+ },
198290
+ "resources.memoryUsedBytes": {
198291
+ kind: "gauge",
198292
+ unit: "bytes",
198293
+ displayName: "Memory used"
198294
+ },
198295
+ "resources.memoryPercent": {
198296
+ kind: "gauge",
198297
+ unit: "%",
198298
+ deadband: 2,
198299
+ displayName: "Memory"
198300
+ },
198301
+ "resources.netRxKbps": {
198302
+ group: "network",
198303
+ kind: "gauge",
198304
+ unit: "kbps",
198305
+ displayName: "Network received"
198306
+ },
198307
+ "resources.netTxKbps": {
198308
+ group: "network",
198309
+ kind: "gauge",
198310
+ unit: "kbps",
198311
+ displayName: "Network sent"
198312
+ }
198313
+ }
198314
+ },
198315
+ volatileStateFields: ["lastFetchedAt"],
198316
+ vocabulary: {
198317
+ noun: t("Workload", "Carico di lavoro"),
198318
+ order: 2400,
198319
+ state: [
198320
+ {
198321
+ kind: "enum",
198322
+ field: "state",
198323
+ label: t("State", "Stato"),
198324
+ values: [
198325
+ {
198326
+ value: "running",
198327
+ label: t("Running", "In esecuzione"),
198328
+ phrase: t("When {device} is running", "Quando {device} è in esecuzione")
198329
+ },
198330
+ {
198331
+ value: "paused",
198332
+ label: t("Paused", "In pausa")
198333
+ },
198334
+ {
198335
+ value: "stopped",
198336
+ label: t("Stopped", "Arrestato"),
198337
+ phrase: t("When {device} is stopped", "Quando {device} è arrestato")
198338
+ },
198339
+ {
198340
+ value: "starting",
198341
+ label: t("Starting", "In avvio")
198342
+ },
198343
+ {
198344
+ value: "stopping",
198345
+ label: t("Stopping", "In arresto")
198346
+ },
198347
+ {
198348
+ value: "crashed",
198349
+ label: t("Crashed", "Arrestato in modo anomalo"),
198350
+ phrase: t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
198351
+ }
198352
+ ],
198353
+ icon: "activity"
198354
+ },
198355
+ {
198356
+ kind: "numeric",
198357
+ field: "resources.cpuPercent",
198358
+ quantity: t("the CPU use", "l'uso della CPU"),
198359
+ label: t("CPU", "CPU"),
198360
+ unit: "%",
198361
+ icon: "cpu"
198362
+ },
198363
+ {
198364
+ kind: "numeric",
198365
+ field: "resources.memoryPercent",
198366
+ quantity: t("the memory use", "l'uso della memoria"),
198367
+ label: t("Memory", "Memoria"),
198368
+ unit: "%",
198369
+ icon: "memory-stick"
198370
+ },
198371
+ {
198372
+ kind: "numeric",
198373
+ field: "resources.temperature",
198374
+ quantity: t("the temperature", "la temperatura"),
198375
+ label: t("Temperature", "Temperatura"),
198376
+ unit: "°C",
198377
+ icon: "thermometer"
198378
+ }
198379
+ ],
198380
+ overrides: { byRole: {
198381
+ [DeviceRole.Vm]: {
198382
+ actions: { "workload.start": { icon: "monitor" } },
198383
+ state: { state: { icon: "monitor" } }
198384
+ },
198385
+ [DeviceRole.AppContainer]: {
198386
+ actions: { "workload.start": { icon: "container" } },
198387
+ state: { state: { icon: "container" } }
198388
+ },
198389
+ [DeviceRole.Lxc]: {
198390
+ actions: { "workload.start": { icon: "box" } },
198391
+ state: { state: { icon: "box" } }
198392
+ },
198393
+ [DeviceRole.App]: {
198394
+ actions: { "workload.start": { icon: "app-window" } },
198395
+ state: { state: { icon: "app-window" } }
198396
+ },
198397
+ [DeviceRole.Host]: {
198398
+ actions: {
198399
+ "workload.start": {
198400
+ label: t("Power on", "Accendi"),
198401
+ phrase: t("Power on {device}", "Accendi {device}"),
198402
+ icon: "power"
198403
+ },
198404
+ "workload.stop": {
198405
+ label: t("Shut down", "Spegni"),
198406
+ phrase: t("Shut down {device}", "Spegni {device}"),
198407
+ icon: "power-off"
198408
+ },
198409
+ "workload.restart": {
198410
+ label: t("Reboot", "Riavvia"),
198411
+ phrase: t("Reboot {device}", "Riavvia {device}"),
198412
+ icon: "refresh-cw"
198413
+ }
198414
+ },
198415
+ state: { state: { icon: "server" } },
198416
+ events: {
198417
+ onStarted: {
198418
+ label: t("Came online", "Tornato in linea"),
198419
+ phrase: t("When {device} comes online", "Quando {device} torna in linea"),
198420
+ icon: "server"
198421
+ },
198422
+ onStopped: {
198423
+ label: t("Shut down", "Spento"),
198424
+ phrase: t("When {device} shuts down", "Quando {device} si spegne"),
198425
+ icon: "server-off"
198426
+ },
198427
+ onCrashed: {
198428
+ label: t("Went down", "Caduto"),
198429
+ phrase: t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
198430
+ icon: "server-crash"
198431
+ },
198432
+ onRecovered: {
198433
+ label: t("Came online", "Tornato in linea"),
198434
+ phrase: t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
198435
+ icon: "server"
198436
+ }
198437
+ }
198438
+ }
198439
+ } }
198440
+ }
198441
+ };
196988
198442
  /**
196989
198443
  * Per-zone occupancy aggregation produced by the analytics frame
196990
198444
  * processor on every inference result. Covers the full combinatorial
@@ -197605,34 +199059,36 @@ var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_K
197605
199059
  * Pure duration maths for the `siren` cap, shared by every provider so a
197606
199060
  * trigger and the countdown it publishes mean the same thing everywhere.
197607
199061
  */
199062
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
199063
+ var MAX_PLAY_CHOICES = 200;
197608
199064
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
197609
199065
  function sirenIdleStatus(previous) {
197610
199066
  return {
197611
199067
  active: false,
197612
199068
  activeUntil: null,
197613
199069
  durationSeconds: previous?.durationSeconds ?? null,
199070
+ plays: previous?.plays ?? null,
199071
+ activeUntilEstimated: false,
197614
199072
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
197615
199073
  };
197616
199074
  }
197617
- /** The state right after a timed trigger: sounding until `now + seconds`. */
197618
- function sirenTriggeredStatus(nowMs, seconds) {
199075
+ /**
199076
+ * The state right after a timed trigger: sounding until `now + seconds`. A
199077
+ * trigger asked in plays passes its count, and whether that end is an estimate.
199078
+ */
199079
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
197619
199080
  return {
197620
199081
  active: true,
197621
199082
  activeUntil: nowMs + Math.round(seconds * 1e3),
197622
199083
  durationSeconds: seconds,
199084
+ plays: activation?.plays ?? null,
199085
+ activeUntilEstimated: activation?.estimated ?? false,
197623
199086
  lastTriggeredAt: nowMs
197624
199087
  };
197625
199088
  }
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;
199089
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
199090
+ function snap(list, range, wanted) {
197634
199091
  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
199092
  if (range !== null) {
197637
199093
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
197638
199094
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -197641,6 +199097,60 @@ function resolveSirenSeconds(options, requested) {
197641
199097
  return wanted;
197642
199098
  }
197643
199099
  /**
199100
+ * The duration a trigger will really use: the request (or the camera default)
199101
+ * snapped to what the camera allows — the nearest listed value, or clamped and
199102
+ * stepped inside the range. Never longer or shorter than the camera can play.
199103
+ */
199104
+ function resolveSirenSeconds(options, requested) {
199105
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
199106
+ }
199107
+ /**
199108
+ * The play count a trigger will really use, snapped like the seconds; `null`
199109
+ * when the camera declares no plays (it counts seconds).
199110
+ */
199111
+ function resolveSirenPlays(options, requested) {
199112
+ if (options.defaultPlays === null) return null;
199113
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
199114
+ }
199115
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
199116
+ function sirenPlayChoices(options) {
199117
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
199118
+ const range = options.rangePlays;
199119
+ if (range === null) return [];
199120
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
199121
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
199122
+ }
199123
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
199124
+ function playsEndIsEstimate(options) {
199125
+ return options.source !== SirenOptionsSource.Camera;
199126
+ }
199127
+ /**
199128
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
199129
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
199130
+ * snapping. Never both — the input schema refuses that before it gets here.
199131
+ */
199132
+ function planSirenTrigger(options, request) {
199133
+ if (request.plays !== void 0) {
199134
+ const plays = resolveSirenPlays(options, request.plays);
199135
+ if (plays === null) return {
199136
+ asked: "refused",
199137
+ reason: "this siren counts seconds, not plays"
199138
+ };
199139
+ const factor = options.secondsPerPlay;
199140
+ return {
199141
+ asked: "plays",
199142
+ plays,
199143
+ seconds: factor === null ? null : plays * factor,
199144
+ estimated: factor === null || playsEndIsEstimate(options)
199145
+ };
199146
+ }
199147
+ return {
199148
+ asked: "seconds",
199149
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
199150
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
199151
+ };
199152
+ }
199153
+ /**
197644
199154
  * Day-of-week names in the cap's index order (0 = Monday), for messages
197645
199155
  * an operator reads and for Hikvision's `<DayOfWeek>` element.
197646
199156
  */
@@ -198719,11 +200229,65 @@ var DEVICE_LOCAL_STATE_CAPS = {
198719
200229
  waterHeater: waterHeaterCapability,
198720
200230
  weather: weatherCapability,
198721
200231
  weatherStation: weatherStationCapability,
200232
+ workload: workloadCapability,
198722
200233
  zoneAnalytics: zoneAnalyticsCapability,
198723
200234
  zoneRules: zoneRulesCapability,
198724
200235
  zones: zonesCapability
198725
200236
  };
198726
200237
  /**
200238
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
200239
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
200240
+ * read keeps what was stored) — pass everything the provider read in one call.
200241
+ */
200242
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
200243
+ const { deviceId, logger, writer } = deps;
200244
+ const { unread, ...normaliseOptions } = options;
200245
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
200246
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
200247
+ tags: { deviceId },
200248
+ meta: {
200249
+ key: r.key,
200250
+ value: r.value,
200251
+ reason: r.reason
200252
+ }
200253
+ });
200254
+ const unreadKinds = new Set(unread ?? []);
200255
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
200256
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
200257
+ return {
200258
+ outcome: "nothing-to-declare",
200259
+ identifiers
200260
+ };
200261
+ }
200262
+ if (writer === void 0) {
200263
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
200264
+ return {
200265
+ outcome: "unavailable",
200266
+ identifiers
200267
+ };
200268
+ }
200269
+ try {
200270
+ await writer.mutate({
200271
+ deviceId,
200272
+ identifiers,
200273
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
200274
+ });
200275
+ return {
200276
+ outcome: "declared",
200277
+ identifiers
200278
+ };
200279
+ } catch (err) {
200280
+ logger.warn("identifiers not declared — setIdentifiers failed", {
200281
+ tags: { deviceId },
200282
+ meta: { error: errMsg$3(err) }
200283
+ });
200284
+ return {
200285
+ outcome: "failed",
200286
+ identifiers
200287
+ };
200288
+ }
200289
+ }
200290
+ /**
198727
200291
  * The edge between two readings, or `null` for no edge.
198728
200292
  *
198729
200293
  * - `null`/cold → `true` is a START (a fault already open at boot is one);
@@ -198775,6 +200339,8 @@ var BaseDevice = class {
198775
200339
  id;
198776
200340
  stableId;
198777
200341
  type;
200342
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
200343
+ statusIsExternal;
198778
200344
  name;
198779
200345
  parentDeviceId;
198780
200346
  role;
@@ -198923,21 +200489,26 @@ var BaseDevice = class {
198923
200489
  };
198924
200490
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
198925
200491
  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
- });
200492
+ this.statusIsExternal = options.deviceStatus === "external";
200493
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
200494
+ if (!this.statusIsExternal) {
200495
+ const seed = {
200496
+ online: true,
200497
+ lastChangedAt: Date.now()
200498
+ };
200499
+ this.runtimeState.setCapState("device-status", seed);
200500
+ }
200501
+ if (!this.statusIsExternal) {
200502
+ ctx.registerNativeCap?.(featureProbeCapability, {});
200503
+ this.runtimeState.setCapState("feature-probe", {
200504
+ flags: {},
200505
+ deviceType: null,
200506
+ model: null,
200507
+ channelCount: null,
200508
+ lastProbedAt: 0,
200509
+ lastFetchedAt: 0
200510
+ });
200511
+ }
198941
200512
  }
198942
200513
  deviceActions = /* @__PURE__ */ new Map();
198943
200514
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -198965,7 +200536,7 @@ var BaseDevice = class {
198965
200536
  * override to gate side effects on the transition.
198966
200537
  */
198967
200538
  markOnline(online) {
198968
- if (this.online === online) return;
200539
+ if (this.statusIsExternal || this.online === online) return;
198969
200540
  const next = {
198970
200541
  online,
198971
200542
  lastChangedAt: Date.now()
@@ -199035,6 +200606,24 @@ var BaseDevice = class {
199035
200606
  }));
199036
200607
  }
199037
200608
  /**
200609
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
200610
+ * machine uuid, hostname, IP — what a later step matches across integrations.
200611
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
200612
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
200613
+ * only from the provider that owns this device. Each kind it carries replaces
200614
+ * the stored one and each kind it lacks is removed — except the kinds listed in
200615
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
200616
+ * everything read in one call; a call where every kind is unread writes
200617
+ * nothing. Best-effort: never throws.
200618
+ */
200619
+ async declareIdentifiers(raw, options) {
200620
+ return declareDeviceIdentifiers({
200621
+ deviceId: this.id,
200622
+ logger: this.ctx.logger,
200623
+ writer: this.ctx.api.deviceManager?.setIdentifiers
200624
+ }, raw, options);
200625
+ }
200626
+ /**
199038
200627
  * Re-publish the device's current `features` array to the persisted
199039
200628
  * meta blob. Drivers call this after a probe finishes when the live
199040
200629
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -199239,6 +200828,7 @@ var BaseDevice = class {
199239
200828
  * `lastProbedAt`) once their probe actually succeeds.
199240
200829
  */
199241
200830
  async onProbe() {
200831
+ if (this.statusIsExternal) return;
199242
200832
  const base = this.runtimeState.getCapState("feature-probe") ?? {
199243
200833
  flags: {},
199244
200834
  deviceType: null,
@@ -200079,7 +201669,7 @@ var BaseDeviceProvider = class extends BaseAddon {
200079
201669
  }
200080
201670
  };
200081
201671
  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;
201672
+ 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
201673
  new Set(Object.values(DeviceType));
200084
201674
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
200085
201675
  function contribution(cap, schema, build) {
@@ -202135,7 +203725,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
202135
203725
  ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
202136
203726
  ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
202137
203727
  ];
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;
203728
+ 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
203729
  /**
202140
203730
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
202141
203731
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -202779,8 +204369,8 @@ lookOf({
202779
204369
  standby: MUTED
202780
204370
  });
202781
204371
  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;
204372
+ 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;
204373
+ 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
204374
  Object.freeze({
202785
204375
  "accessories.getStatus": {
202786
204376
  capName: "accessories",
@@ -205442,6 +207032,13 @@ Object.freeze({
205442
207032
  access: "create",
205443
207033
  role: "admin"
205444
207034
  },
207035
+ "deviceManager.setIdentifiers": {
207036
+ capName: "device-manager",
207037
+ capScope: "system",
207038
+ addonId: null,
207039
+ access: "create",
207040
+ role: "admin"
207041
+ },
205445
207042
  "deviceManager.setIntegrationId": {
205446
207043
  capName: "device-manager",
205447
207044
  capScope: "system",
@@ -208326,6 +209923,13 @@ Object.freeze({
208326
209923
  access: "view",
208327
209924
  role: "admin"
208328
209925
  },
209926
+ "notificationRules.listRuleTags": {
209927
+ capName: "notification-rules",
209928
+ capScope: "system",
209929
+ addonId: null,
209930
+ access: "view",
209931
+ role: "admin"
209932
+ },
208329
209933
  "notificationRules.listSnoozes": {
208330
209934
  capName: "notification-rules",
208331
209935
  capScope: "system",
@@ -208382,6 +209986,13 @@ Object.freeze({
208382
209986
  access: "create",
208383
209987
  role: "admin"
208384
209988
  },
209989
+ "notificationRules.setRuleTags": {
209990
+ capName: "notification-rules",
209991
+ capScope: "system",
209992
+ addonId: null,
209993
+ access: "create",
209994
+ role: "admin"
209995
+ },
208385
209996
  "notificationRules.testRule": {
208386
209997
  capName: "notification-rules",
208387
209998
  capScope: "system",
@@ -211350,6 +212961,13 @@ Object.freeze({
211350
212961
  access: "view",
211351
212962
  role: "viewer"
211352
212963
  },
212964
+ "siren.getPlayChoices": {
212965
+ capName: "siren",
212966
+ capScope: "device",
212967
+ addonId: null,
212968
+ access: "view",
212969
+ role: "viewer"
212970
+ },
211353
212971
  "siren.getStatus": {
211354
212972
  capName: "siren",
211355
212973
  capScope: "device",
@@ -212162,6 +213780,13 @@ Object.freeze({
212162
213780
  access: "view",
212163
213781
  role: "viewer"
212164
213782
  },
213783
+ "switch.getOptions": {
213784
+ capName: "switch",
213785
+ capScope: "device",
213786
+ addonId: null,
213787
+ access: "view",
213788
+ role: "viewer"
213789
+ },
212165
213790
  "switch.getStatus": {
212166
213791
  capName: "switch",
212167
213792
  capScope: "device",
@@ -212169,6 +213794,13 @@ Object.freeze({
212169
213794
  access: "view",
212170
213795
  role: "viewer"
212171
213796
  },
213797
+ "switch.powerCycle": {
213798
+ capName: "switch",
213799
+ capScope: "device",
213800
+ addonId: null,
213801
+ access: "create",
213802
+ role: "viewer"
213803
+ },
212172
213804
  "switch.setState": {
212173
213805
  capName: "switch",
212174
213806
  capScope: "device",
@@ -212372,13 +214004,6 @@ Object.freeze({
212372
214004
  access: "create",
212373
214005
  role: "admin"
212374
214006
  },
212375
- "terminalSession.adoptLegacyMonitor": {
212376
- capName: "terminal-session",
212377
- capScope: "system",
212378
- addonId: null,
212379
- access: "create",
212380
- role: "admin"
212381
- },
212382
214007
  "terminalSession.close": {
212383
214008
  capName: "terminal-session",
212384
214009
  capScope: "system",
@@ -212386,13 +214011,6 @@ Object.freeze({
212386
214011
  access: "create",
212387
214012
  role: "admin"
212388
214013
  },
212389
- "terminalSession.listLegacyCameras": {
212390
- capName: "terminal-session",
212391
- capScope: "system",
212392
- addonId: null,
212393
- access: "view",
212394
- role: "admin"
212395
- },
212396
214014
  "terminalSession.listProfiles": {
212397
214015
  capName: "terminal-session",
212398
214016
  capScope: "system",
@@ -213254,6 +214872,62 @@ Object.freeze({
213254
214872
  access: "view",
213255
214873
  role: "viewer"
213256
214874
  },
214875
+ "workload.forceStop": {
214876
+ capName: "workload",
214877
+ capScope: "device",
214878
+ addonId: null,
214879
+ access: "create",
214880
+ role: "admin"
214881
+ },
214882
+ "workload.getOptions": {
214883
+ capName: "workload",
214884
+ capScope: "device",
214885
+ addonId: null,
214886
+ access: "view",
214887
+ role: "viewer"
214888
+ },
214889
+ "workload.getStatus": {
214890
+ capName: "workload",
214891
+ capScope: "device",
214892
+ addonId: null,
214893
+ access: "view",
214894
+ role: "viewer"
214895
+ },
214896
+ "workload.pause": {
214897
+ capName: "workload",
214898
+ capScope: "device",
214899
+ addonId: null,
214900
+ access: "create",
214901
+ role: "viewer"
214902
+ },
214903
+ "workload.restart": {
214904
+ capName: "workload",
214905
+ capScope: "device",
214906
+ addonId: null,
214907
+ access: "create",
214908
+ role: "viewer"
214909
+ },
214910
+ "workload.resume": {
214911
+ capName: "workload",
214912
+ capScope: "device",
214913
+ addonId: null,
214914
+ access: "create",
214915
+ role: "viewer"
214916
+ },
214917
+ "workload.start": {
214918
+ capName: "workload",
214919
+ capScope: "device",
214920
+ addonId: null,
214921
+ access: "create",
214922
+ role: "viewer"
214923
+ },
214924
+ "workload.stop": {
214925
+ capName: "workload",
214926
+ capScope: "device",
214927
+ addonId: null,
214928
+ access: "create",
214929
+ role: "viewer"
214930
+ },
213257
214931
  "zoneAnalytics.getCameraHistory": {
213258
214932
  capName: "zone-analytics",
213259
214933
  capScope: "device",
@@ -213390,8 +215064,8 @@ function offered(received) {
213390
215064
  };
213391
215065
  }
213392
215066
  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;
215067
+ 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;
215068
+ 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
215069
  new Set(Object.values(DeviceType));
213396
215070
  new Set(Object.values(DeviceRole));
213397
215071
  var LAST_FETCHED_FIELD = "lastFetchedAt";
@@ -214245,6 +215919,11 @@ Object.freeze({
214245
215919
  form: "single",
214246
215920
  optional: false
214247
215921
  }],
215922
+ "deviceManager.setIdentifiers": [{
215923
+ name: "deviceId",
215924
+ form: "single",
215925
+ optional: false
215926
+ }],
214248
215927
  "deviceManager.setIntegrationId": [{
214249
215928
  name: "deviceId",
214250
215929
  form: "single",
@@ -216239,6 +217918,11 @@ Object.freeze({
216239
217918
  form: "single",
216240
217919
  optional: false
216241
217920
  }],
217921
+ "siren.getPlayChoices": [{
217922
+ name: "deviceId",
217923
+ form: "single",
217924
+ optional: false
217925
+ }],
216242
217926
  "siren.getStatus": [{
216243
217927
  name: "deviceId",
216244
217928
  form: "single",
@@ -216421,11 +218105,21 @@ Object.freeze({
216421
218105
  form: "single",
216422
218106
  optional: false
216423
218107
  }],
218108
+ "switch.getOptions": [{
218109
+ name: "deviceId",
218110
+ form: "single",
218111
+ optional: false
218112
+ }],
216424
218113
  "switch.getStatus": [{
216425
218114
  name: "deviceId",
216426
218115
  form: "single",
216427
218116
  optional: false
216428
218117
  }],
218118
+ "switch.powerCycle": [{
218119
+ name: "deviceId",
218120
+ form: "single",
218121
+ optional: false
218122
+ }],
216429
218123
  "switch.setState": [{
216430
218124
  name: "deviceId",
216431
218125
  form: "single",
@@ -216666,6 +218360,46 @@ Object.freeze({
216666
218360
  form: "single",
216667
218361
  optional: false
216668
218362
  }],
218363
+ "workload.forceStop": [{
218364
+ name: "deviceId",
218365
+ form: "single",
218366
+ optional: false
218367
+ }],
218368
+ "workload.getOptions": [{
218369
+ name: "deviceId",
218370
+ form: "single",
218371
+ optional: false
218372
+ }],
218373
+ "workload.getStatus": [{
218374
+ name: "deviceId",
218375
+ form: "single",
218376
+ optional: false
218377
+ }],
218378
+ "workload.pause": [{
218379
+ name: "deviceId",
218380
+ form: "single",
218381
+ optional: false
218382
+ }],
218383
+ "workload.restart": [{
218384
+ name: "deviceId",
218385
+ form: "single",
218386
+ optional: false
218387
+ }],
218388
+ "workload.resume": [{
218389
+ name: "deviceId",
218390
+ form: "single",
218391
+ optional: false
218392
+ }],
218393
+ "workload.start": [{
218394
+ name: "deviceId",
218395
+ form: "single",
218396
+ optional: false
218397
+ }],
218398
+ "workload.stop": [{
218399
+ name: "deviceId",
218400
+ form: "single",
218401
+ optional: false
218402
+ }],
216669
218403
  "zoneAnalytics.getCameraHistory": [{
216670
218404
  name: "deviceId",
216671
218405
  form: "single",
@@ -217882,6 +219616,8 @@ var TimelapseRuleInputSchema = object({
217882
219616
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
217883
219617
  priority: PriorityField.default(3),
217884
219618
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219619
+ /** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
219620
+ tags: TagsFieldSchema.optional(),
217885
219621
  targetOverrides: NcTargetOverridesSchema.optional()
217886
219622
  });
217887
219623
  object({
@@ -217900,6 +219636,8 @@ object({
217900
219636
  reportClasses: ReportClassesField.optional(),
217901
219637
  priority: PriorityField.optional(),
217902
219638
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219639
+ /** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
219640
+ tags: TagsFieldSchema.optional(),
217903
219641
  targetOverrides: NcTargetOverridesSchema.optional()
217904
219642
  });
217905
219643
  TimelapseRuleInputSchema.extend({
@@ -220061,7 +221799,8 @@ var STREAM_HEADERS = {
220061
221799
  [CLIP_STREAM_TRANSPORT_HEADER]: "forward-only"
220062
221800
  };
220063
221801
  /** 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. */
221802
+ * clip that exists and cannot be served right now; `502` = the camera;
221803
+ * `504` = the camera did not come up inside the wake's bound. */
220065
221804
  function streamRefusalStatus(code) {
220066
221805
  switch (code) {
220067
221806
  case "unknown-device":
@@ -220071,6 +221810,7 @@ function streamRefusalStatus(code) {
220071
221810
  case "clip-in-progress": return 409;
220072
221811
  case "camera-refused":
220073
221812
  case "fetch-failed": return 502;
221813
+ case "wake-timeout": return 504;
220074
221814
  }
220075
221815
  }
220076
221816
  function createClipStreamHandler(deps) {
@@ -223075,7 +224815,7 @@ function createReolinkVideoclipsProvider(deps) {
223075
224815
  * actually carries. Refusing left the operator with `high` looking
223076
224816
  * unsupported, and left two transports behind one pointer.
223077
224817
  */
223078
- dialClipStream: async ({ deviceId, clipId, profile, audio }) => {
224818
+ dialClipStream: async ({ deviceId, clipId, profile, audio, wake }) => {
223079
224819
  const tags = { deviceId };
223080
224820
  const refuse = (code, detail, meta) => {
223081
224821
  deps.logger.warn("videoclips: refusing a clip stream dial", {
@@ -223114,7 +224854,8 @@ function createReolinkVideoclipsProvider(deps) {
223114
224854
  deviceId,
223115
224855
  row,
223116
224856
  twin: chosen.twin,
223117
- audio: askedAudio
224857
+ audio: askedAudio,
224858
+ ...wake !== void 0 ? { wake } : {}
223118
224859
  });
223119
224860
  if (outcome.kind === "refused") return refuse(outcome.code, outcome.detail, {
223120
224861
  clipKey,
@@ -223352,6 +225093,13 @@ function createReolinkVideoclipsProvider(deps) {
223352
225093
  * constructs a `ReolinkBaichuanApi`, and that is enforced by the provider spec
223353
225094
  * rather than by hope.
223354
225095
  */
225096
+ /**
225097
+ * How long an AUTHORISED clip read or dial waits for a sleeping standalone
225098
+ * battery camera to come up — the bound `wakeIfSleeping` already applies to
225099
+ * every other operator wake on this provider. Past it the read is refused
225100
+ * `wake-timeout`, naming this number, and no session is opened.
225101
+ */
225102
+ var CLIP_WAKE_TIMEOUT_MS = 15e3;
223355
225103
  function createClipService(deps) {
223356
225104
  const now = deps.now ?? (() => Date.now());
223357
225105
  const cache = new ClipCatalogCache({ now });
@@ -223383,6 +225131,21 @@ function createClipService(deps) {
223383
225131
  * a battery camera the operator authorised once.
223384
225132
  */
223385
225133
  const producing = /* @__PURE__ */ new Map();
225134
+ /**
225135
+ * One wake in flight per camera. The file map above de-duplicates a
225136
+ * production per twin; a dial and a read of DIFFERENT twins, or two dials,
225137
+ * would otherwise each send their own wake to the same radio.
225138
+ */
225139
+ const waking = /* @__PURE__ */ new Map();
225140
+ const wakeOnce = (deviceId) => {
225141
+ const inFlight = waking.get(deviceId);
225142
+ if (inFlight !== void 0) return inFlight;
225143
+ const started = deps.wakeDevice(deviceId, CLIP_WAKE_TIMEOUT_MS).finally(() => {
225144
+ waking.delete(deviceId);
225145
+ });
225146
+ waking.set(deviceId, started);
225147
+ return started;
225148
+ };
223386
225149
  const rowFor = (deviceId, clipKey) => {
223387
225150
  return cache.findBy(deviceId, (row) => row.clipKey === clipKey);
223388
225151
  };
@@ -223572,7 +225335,7 @@ function createClipService(deps) {
223572
225335
  const gateClipDevice = async (input) => {
223573
225336
  const { deviceId, clipKey, twin, path } = input;
223574
225337
  const tags = { deviceId };
223575
- const device = await deps.resolveDevice(deviceId);
225338
+ let device = await deps.resolveDevice(deviceId);
223576
225339
  if (device === null) {
223577
225340
  deps.logger.warn("videoclips: no Reolink camera here to fetch this clip from", {
223578
225341
  tags,
@@ -223614,9 +225377,47 @@ function createClipService(deps) {
223614
225377
  clipKey,
223615
225378
  twin,
223616
225379
  path,
223617
- branch: "wake-authorised"
225380
+ branch: "wake-authorised",
225381
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
223618
225382
  }
223619
225383
  });
225384
+ if (!await wakeOnce(deviceId)) {
225385
+ deps.logger.warn("videoclips: the authorised wake did not bring the camera up in time", {
225386
+ tags,
225387
+ meta: {
225388
+ clipKey,
225389
+ twin,
225390
+ path,
225391
+ branch: "wake-timeout",
225392
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
225393
+ }
225394
+ });
225395
+ return {
225396
+ kind: "refused",
225397
+ branch: "wake-timeout",
225398
+ code: "wake-timeout",
225399
+ 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`
225400
+ };
225401
+ }
225402
+ const awake = await deps.resolveDevice(deviceId);
225403
+ if (awake === null) {
225404
+ deps.logger.warn("videoclips: the camera left this runner while it was being woken", {
225405
+ tags,
225406
+ meta: {
225407
+ clipKey,
225408
+ twin,
225409
+ path,
225410
+ branch: "unknown-device"
225411
+ }
225412
+ });
225413
+ return {
225414
+ kind: "refused",
225415
+ branch: "unknown-device",
225416
+ code: "catalog-unreachable",
225417
+ detail: `device ${deviceId} is not a Reolink camera on this node`
225418
+ };
225419
+ }
225420
+ device = awake;
223620
225421
  }
223621
225422
  if (uidIsMissing(device)) {
223622
225423
  deps.logger.warn("videoclips: no uid for this camera — its clip cannot be addressed", {
@@ -223931,12 +225732,13 @@ function createClipService(deps) {
223931
225732
  }),
223932
225733
  prepareBytes,
223933
225734
  prepareOffer,
223934
- prepareStreamDial: async ({ deviceId, row, twin, audio }) => {
225735
+ prepareStreamDial: async ({ deviceId, row, twin, audio, wake }) => {
223935
225736
  const gate = await gateClipDevice({
223936
225737
  deviceId,
223937
225738
  clipKey: row.clipKey,
223938
225739
  twin,
223939
- path: "stream"
225740
+ path: "stream",
225741
+ ...wake !== void 0 ? { wake } : {}
223940
225742
  });
223941
225743
  if (gate.kind === "refused") return {
223942
225744
  kind: "refused",
@@ -227936,6 +229738,13 @@ function buildReolinkSirenOptions(input) {
227936
229738
  step: secondsPerPlay
227937
229739
  },
227938
229740
  defaultSeconds: secondsForPlays(defaultPlays, secondsPerPlay),
229741
+ allowedPlays: null,
229742
+ rangePlays: {
229743
+ min: 1,
229744
+ max: 60,
229745
+ step: 1
229746
+ },
229747
+ defaultPlays,
227939
229748
  unit: SirenDurationUnit.Plays,
227940
229749
  secondsPerPlay,
227941
229750
  source: SirenOptionsSource.Fallback,
@@ -228196,9 +230005,9 @@ var SirenAccessory = class extends BaseDevice {
228196
230005
  });
228197
230006
  }
228198
230007
  /** Arms the countdown for a timed activation and clears the slice when it elapses. */
228199
- armSirenCountdown(seconds) {
230008
+ armSirenCountdown(seconds, activation) {
228200
230009
  this.clearSirenTimer();
228201
- this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds));
230010
+ this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds, activation));
228202
230011
  this.sirenTimer = setTimeout(() => {
228203
230012
  this.sirenTimer = null;
228204
230013
  this.writeSirenStatus(sirenIdleStatus(this.sirenView()));
@@ -228217,7 +230026,10 @@ var SirenAccessory = class extends BaseDevice {
228217
230026
  return;
228218
230027
  }
228219
230028
  if (plays !== void 0) {
228220
- this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay));
230029
+ this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay), {
230030
+ plays,
230031
+ estimated: true
230032
+ });
228221
230033
  return;
228222
230034
  }
228223
230035
  this.clearSirenTimer();
@@ -228225,6 +230037,8 @@ var SirenAccessory = class extends BaseDevice {
228225
230037
  active: true,
228226
230038
  activeUntil: null,
228227
230039
  durationSeconds: null,
230040
+ plays: null,
230041
+ activeUntilEstimated: false,
228228
230042
  lastTriggeredAt: Date.now()
228229
230043
  });
228230
230044
  }
@@ -228232,9 +230046,27 @@ var SirenAccessory = class extends BaseDevice {
228232
230046
  this.ctx.registerNativeCap(sirenCapability, {
228233
230047
  getStatus: async () => this.sirenView(),
228234
230048
  getOptions: async () => this.sirenOptions(),
228235
- trigger: async ({ deviceId, durationSeconds }) => {
230049
+ getPlayChoices: async () => sirenPlayChoices(this.sirenOptions()),
230050
+ trigger: async ({ deviceId, durationSeconds, plays: askedPlays }) => {
228236
230051
  if (deviceId !== this.id) return this.sirenView();
228237
- const plays = playsForSeconds(resolveSirenSeconds(this.sirenOptions(), durationSeconds), this.secondsPerPlay);
230052
+ const plan = planSirenTrigger(this.sirenOptions(), {
230053
+ durationSeconds,
230054
+ plays: askedPlays
230055
+ });
230056
+ if (plan.asked === "refused") {
230057
+ this.ctx.logger.warn("siren trigger refused", {
230058
+ tags: {
230059
+ deviceId: this.id,
230060
+ channel: this.channel
230061
+ },
230062
+ meta: {
230063
+ reason: plan.reason,
230064
+ plays: askedPlays
230065
+ }
230066
+ });
230067
+ throw new Error(`siren trigger refused: ${plan.reason}`);
230068
+ }
230069
+ const plays = plan.asked === "plays" ? plan.plays : playsForSeconds(plan.seconds, this.secondsPerPlay);
228238
230070
  const api = await this.api;
228239
230071
  try {
228240
230072
  await api.setSiren(this.channel, true, plays);
@@ -228258,7 +230090,8 @@ var SirenAccessory = class extends BaseDevice {
228258
230090
  channel: this.channel
228259
230091
  },
228260
230092
  meta: {
228261
- requested: durationSeconds ?? "default",
230093
+ requested: askedPlays ?? durationSeconds ?? "default",
230094
+ unit: plan.asked,
228262
230095
  plays,
228263
230096
  seconds: actualSeconds
228264
230097
  }
@@ -228267,7 +230100,10 @@ var SirenAccessory = class extends BaseDevice {
228267
230100
  on: true,
228268
230101
  lastChangedAt: Date.now()
228269
230102
  });
228270
- this.armSirenCountdown(actualSeconds);
230103
+ this.armSirenCountdown(actualSeconds, {
230104
+ plays: plan.asked === "plays" ? plays : null,
230105
+ estimated: plan.estimated
230106
+ });
228271
230107
  return this.sirenView();
228272
230108
  },
228273
230109
  stop: async ({ deviceId }) => {
@@ -228685,7 +230521,7 @@ async function populateReolinkMetadata(api, channel, target) {
228685
230521
  ...channelCount !== void 0 ? { channelCount } : {}
228686
230522
  };
228687
230523
  try {
228688
- await target.ctx.api?.deviceManager?.setMetadata?.mutate?.({
230524
+ await target.ctx.api.deviceManager?.setMetadata?.mutate({
228689
230525
  deviceId: target.id,
228690
230526
  patch
228691
230527
  });
@@ -228702,6 +230538,26 @@ async function populateReolinkMetadata(api, channel, target) {
228702
230538
  meta: { error: err instanceof Error ? err.message : String(err) }
228703
230539
  });
228704
230540
  }
230541
+ const hostRead = channel === void 0;
230542
+ const identifierMac = hostRead ? mac : void 0;
230543
+ const identifierIp = hostRead ? ip : void 0;
230544
+ const unread = hostRead ? [...mac === void 0 ? ["mac"] : [], ...ip === void 0 ? ["ip"] : []] : [];
230545
+ await declareDeviceIdentifiers({
230546
+ deviceId: target.id,
230547
+ logger: target.ctx.logger,
230548
+ writer: target.ctx.api.deviceManager?.setIdentifiers
230549
+ }, {
230550
+ mac: identifierMac ?? null,
230551
+ serial: info.serialNumber ? {
230552
+ manufacturer: "Reolink",
230553
+ serial: info.serialNumber
230554
+ } : null,
230555
+ vendorUid: target.uid ? {
230556
+ vendor: "reolink",
230557
+ id: target.uid
230558
+ } : null,
230559
+ ip: identifierIp ?? null
230560
+ }, { unread });
228705
230561
  const cachePatch = {};
228706
230562
  if (info.serialNumber) cachePatch["serialNumber"] = info.serialNumber;
228707
230563
  if (mac) cachePatch["mac"] = mac;
@@ -231603,6 +233459,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231603
233459
  async wakeForClipCatalogRefresh() {
231604
233460
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
231605
233461
  }
233462
+ /**
233463
+ * Wake this camera because the OPERATOR asked for one of its clips — a
233464
+ * viewer pressing play, or an export — carrying `ClipWake` `authorised`.
233465
+ * The same forced wake `wakeIfSleeping` drives for a config button, under
233466
+ * the clip service's bound. Resolves whether the camera is up; never throws,
233467
+ * so the service can refuse `wake-timeout` by name.
233468
+ */
233469
+ async wakeForClipRead(timeoutMs) {
233470
+ return this.wakeIfSleeping(timeoutMs);
233471
+ }
231606
233472
  clipTimeZoneWarned = { done: false };
231607
233473
  getClipDeviceRef() {
231608
233474
  const configUid = this.config.get("uid");
@@ -239335,6 +241201,97 @@ var EmailPushBridge = class {
239335
241201
  function pickMailbox(list) {
239336
241202
  return list.find((b) => b.id === "smtp-inbound-default")?.id ?? list[0]?.id ?? null;
239337
241203
  }
241204
+ //#endregion
241205
+ //#region src/reolink-connection-test.ts
241206
+ /**
241207
+ * The Reolink NVR / Home Hub connection test (planning#581): log in over Baichuan with the
241208
+ * connection as the form holds it — the same login the hub session makes — and answer a typed
241209
+ * verdict with a reason.
241210
+ *
241211
+ * The library reports failures only by message. What they tell apart:
241212
+ * - a socket that never connected, or a login that timed out — the hub did not answer;
241213
+ * - `Baichuan login failed: empty reply` after the nonce exchange succeeded — the hub is there
241214
+ * and refused the username or password (a mains-powered hub does not sleep, and the test's
241215
+ * socket is fresh, so the library's other two guesses for this message do not apply);
241216
+ * - anything else — the login failed with the library's own words, inconclusive.
241217
+ * Whether the host is an NVR / Home Hub rather than a single camera is NOT a reason here: a hub
241218
+ * with no camera paired answers zero channels just like a camera would.
241219
+ */
241220
+ /** The bound on login plus the channel read; the test logs in once (no library retry). */
241221
+ var REOLINK_HUB_TEST_DEADLINE_MS = 2e4;
241222
+ /** A real Baichuan session, dialled the way `connectReolinkHub` dials one. */
241223
+ var liveReolinkHubProbe = (connection) => {
241224
+ const api = new ReolinkBaichuanApi({
241225
+ host: connection.host,
241226
+ port: connection.port,
241227
+ username: connection.username,
241228
+ password: connection.password,
241229
+ transport: connection.transport,
241230
+ ...connection.uid ? { uid: connection.uid } : {}
241231
+ });
241232
+ return {
241233
+ login: () => api.login(void 0, { maxAttempts: 1 }),
241234
+ channelCount: async () => {
241235
+ try {
241236
+ return (await api.getNvrChannelsSummary({ timeoutMs: 5e3 })).devices.length;
241237
+ } catch {
241238
+ return null;
241239
+ }
241240
+ },
241241
+ close: () => api.close({ reason: "connection-test" })
241242
+ };
241243
+ };
241244
+ /** The verdict for a failed login. */
241245
+ function reolinkHubFailureOf(err, connection) {
241246
+ const where = `${connection.host}:${connection.port}`;
241247
+ const message = errMsg$3(err);
241248
+ if (message.includes("login failed: empty reply")) return {
241249
+ success: false,
241250
+ status: "rejected",
241251
+ error: `reolink: the NVR / Home Hub refused the username or password (user "${connection.username}")`
241252
+ };
241253
+ if (isConnectivityFailure(err) || message.includes("connect timeout")) return {
241254
+ success: false,
241255
+ status: "inconclusive",
241256
+ error: `reolink: the NVR / Home Hub did not answer on ${where} (${message}) — check the host and the Baichuan port (9000 by default)`
241257
+ };
241258
+ return {
241259
+ success: false,
241260
+ status: "inconclusive",
241261
+ error: `reolink: the login to ${where} failed: ${message}`
241262
+ };
241263
+ }
241264
+ async function testReolinkHubConnection(connection, makeProbe, deadlineMs = REOLINK_HUB_TEST_DEADLINE_MS) {
241265
+ const started = Date.now();
241266
+ const probe = makeProbe(connection);
241267
+ let timer = null;
241268
+ const deadline = new Promise((resolve) => {
241269
+ timer = setTimeout(() => resolve({ kind: "deadline" }), deadlineMs);
241270
+ });
241271
+ const login = probe.login().then(() => ({ kind: "ok" }), (err) => ({
241272
+ kind: "error",
241273
+ err
241274
+ }));
241275
+ try {
241276
+ const outcome = await Promise.race([login, deadline]);
241277
+ if (outcome.kind === "error") return reolinkHubFailureOf(outcome.err, connection);
241278
+ if (outcome.kind === "deadline") return {
241279
+ success: false,
241280
+ status: "inconclusive",
241281
+ 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`
241282
+ };
241283
+ const channels = await probe.channelCount();
241284
+ return {
241285
+ success: true,
241286
+ status: "validated",
241287
+ latencyMs: Date.now() - started,
241288
+ ...channels !== null ? { detail: `${channels} channels` } : {}
241289
+ };
241290
+ } finally {
241291
+ if (timer !== null) clearTimeout(timer);
241292
+ await probe.close().catch(() => null);
241293
+ }
241294
+ }
239338
241295
  var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239339
241296
  title: "Reolink integrations",
239340
241297
  schema: entryBody({
@@ -239354,6 +241311,44 @@ var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239354
241311
  });
239355
241312
  /** Every kind this addon declares, keyed by its name. */
239356
241313
  var reolinkRecordKinds = { connections: reolinkConnectionsEntryKind };
241314
+ /**
241315
+ * The connection test: the stored hub under the edited form. A saved password is never retyped
241316
+ * (the form hands back its redacted view), so the keychain value stands in.
241317
+ */
241318
+ async function testReolinkInstance(records, deps, input) {
241319
+ const handle = records.kind(reolinkConnectionsEntryKind);
241320
+ const stored = input.id === null ? null : (await handle.getResolved(input.id))?.data ?? null;
241321
+ const typed = input.values["password"];
241322
+ const password = typeof typed === "string" && typed !== "" && typed !== "__camstack_redacted__" ? typed : stored?.password;
241323
+ const merged = {};
241324
+ for (const [key, value] of Object.entries({
241325
+ ...stored,
241326
+ ...input.values,
241327
+ password
241328
+ })) {
241329
+ if (key === "name" || value === null || value === void 0) continue;
241330
+ merged[key] = value;
241331
+ }
241332
+ const read = readHubConnection(merged);
241333
+ switch (read.kind) {
241334
+ case "no-host": return {
241335
+ success: false,
241336
+ status: "inconclusive",
241337
+ error: "reolink: no NVR / Home Hub host on this integration — standalone cameras are tested one by one when they are added"
241338
+ };
241339
+ case "no-password": return {
241340
+ success: false,
241341
+ status: "rejected",
241342
+ error: "reolink: enter the NVR / Home Hub password"
241343
+ };
241344
+ case "password-locked": return {
241345
+ success: false,
241346
+ status: "inconclusive",
241347
+ error: "reolink: the stored password cannot be read right now (keychain unavailable)"
241348
+ };
241349
+ case "ok": return testReolinkHubConnection(read.connection, deps.makeHubProbe);
241350
+ }
241351
+ }
239357
241352
  /** The record body as the connection form's flat values: no name, no unset keys. */
239358
241353
  function hubSettingsOf(body) {
239359
241354
  const out = {};
@@ -239397,7 +241392,7 @@ function buildReolinkInstances(records, deps) {
239397
241392
  },
239398
241393
  instanceMode: "multiple",
239399
241394
  kind: "connection",
239400
- canTest: false,
241395
+ canTest: true,
239401
241396
  kinds: [{
239402
241397
  id: "connection",
239403
241398
  label: "Reolink",
@@ -239408,7 +241403,8 @@ function buildReolinkInstances(records, deps) {
239408
241403
  formSchema: () => buildHubInstanceSchema(),
239409
241404
  initialBody: (name) => ({ name }),
239410
241405
  configured: (body) => (body.host ?? "").length === 0 || (body.password ?? "").length > 0,
239411
- onChanged: () => deps.onChanged()
241406
+ onChanged: () => deps.onChanged(),
241407
+ test: (input) => testReolinkInstance(records, deps, input)
239412
241408
  });
239413
241409
  }
239414
241410
  /**
@@ -240913,6 +242909,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240913
242909
  resolveDevice: async (deviceId) => {
240914
242910
  const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
240915
242911
  return device instanceof ReolinkCamera ? device.getClipDeviceRef() : null;
242912
+ },
242913
+ wakeDevice: async (deviceId, timeoutMs) => {
242914
+ const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
242915
+ return device instanceof ReolinkCamera ? device.wakeForClipRead(timeoutMs) : false;
240916
242916
  }
240917
242917
  });
240918
242918
  regs.push({
@@ -240953,7 +242953,8 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240953
242953
  };
240954
242954
  const instances = buildReolinkInstances(records, {
240955
242955
  onChanged: () => this.reconcileIntegrations(),
240956
- registryEvidenceOf
242956
+ registryEvidenceOf,
242957
+ makeHubProbe: liveReolinkHubProbe
240957
242958
  });
240958
242959
  this.instances = instances;
240959
242960
  this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);