@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.js CHANGED
@@ -29168,7 +29168,7 @@ var require_lz4 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
29168
29168
  };
29169
29169
  }));
29170
29170
  //#endregion
29171
- //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-DBCXE3EJ.js
29171
+ //#region node_modules/@apocaliss92/nodelink-js/dist/chunk-BQPNG2XV.js
29172
29172
  var import_fxp = require_fxp();
29173
29173
  var import_lz4 = /* @__PURE__ */ require_chunk.__toESM(require_lz4(), 1);
29174
29174
  function bcHeaderLen(messageClass, buf, bodyLen) {
@@ -31139,6 +31139,7 @@ function createDebugGateLogger(base, enabled = false) {
31139
31139
  function isTalkCmd(cmdId) {
31140
31140
  return cmdId === 10 || cmdId === 11 || cmdId === 201 || cmdId === 202;
31141
31141
  }
31142
+ var DEFAULT_LOGIN_MAX_ATTEMPTS = 3;
31142
31143
  function toWireChannelId(channelId) {
31143
31144
  return channelId & 255;
31144
31145
  }
@@ -33947,9 +33948,11 @@ var BaichuanClient = class _BaichuanClient extends events.EventEmitter {
33947
33948
  /**
33948
33949
  * Login flow: legacy "upgrade" -> receive nonce/encryption -> modern login.
33949
33950
  */
33950
- async login(maxEncryption = "full_aes") {
33951
+ async login(maxEncryption = "full_aes", options = {}) {
33951
33952
  if (this.loggedIn) return;
33952
- const maxAttempts = 3;
33953
+ const requested = options.maxAttempts ?? DEFAULT_LOGIN_MAX_ATTEMPTS;
33954
+ if (!Number.isInteger(requested) || requested < 1) throw new RangeError(`login maxAttempts must be a positive integer, got ${requested}`);
33955
+ const maxAttempts = requested;
33953
33956
  let lastError;
33954
33957
  let effectiveMaxEncryption = maxEncryption;
33955
33958
  let effectiveHostChannelId = this.hostChannelId;
@@ -43223,8 +43226,8 @@ var ReolinkBaichuanApi = class _ReolinkBaichuanApi {
43223
43226
  this.client.setIdleDisconnect(enabled);
43224
43227
  this.logger.debug?.(`[ReolinkBaichuanApi] setIdleDisconnect: ${enabled}`);
43225
43228
  }
43226
- async login(maxEncryption) {
43227
- await this.client.login(maxEncryption);
43229
+ async login(maxEncryption, options) {
43230
+ await this.client.login(maxEncryption, options);
43228
43231
  this.applyTransportDerivedDefaults();
43229
43232
  }
43230
43233
  /**
@@ -100695,7 +100698,7 @@ function parseBaichuanWebhookObject(mess) {
100695
100698
  return parsed;
100696
100699
  }
100697
100700
  //#endregion
100698
- //#region ../types/dist/event-category-Dhcd0TRH.mjs
100701
+ //#region ../types/dist/event-category-Hwx_JSCU.mjs
100699
100702
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100700
100703
  EventCategory["SystemBoot"] = "system.boot";
100701
100704
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101217,6 +101220,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101217
101220
  EventCategory["RunningStarted"] = "running.started";
101218
101221
  /** Mirrors `runningStateCapability.events.onFinished`. */
101219
101222
  EventCategory["RunningFinished"] = "running.finished";
101223
+ /** Mirrors `workloadCapability.events.onStarted` — a workload reached running (#585). */
101224
+ EventCategory["WorkloadStarted"] = "workload.started";
101225
+ /** Mirrors `workloadCapability.events.onStopped` — a running workload stopped cleanly. */
101226
+ EventCategory["WorkloadStopped"] = "workload.stopped";
101227
+ /** Mirrors `workloadCapability.events.onCrashed` — a workload stopped without a request. */
101228
+ EventCategory["WorkloadCrashed"] = "workload.crashed";
101229
+ /** Mirrors `workloadCapability.events.onRecovered` — a crashed workload runs again. */
101230
+ EventCategory["WorkloadRecovered"] = "workload.recovered";
101220
101231
  /** Mirrors `deviceRunsCapability.events.onRunOpened` - a durable run record opened. */
101221
101232
  EventCategory["DeviceRunOpened"] = "device-run.opened";
101222
101233
  /** Mirrors `deviceRunsCapability.events.onRunClosed` - a durable run record closed. */
@@ -101519,7 +101530,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101519
101530
  return EventCategory;
101520
101531
  }({});
101521
101532
  //#endregion
101522
- //#region ../types/dist/composed-stable-id-RvQIEpqg.mjs
101533
+ //#region ../types/dist/composed-stable-id-BBL71oUQ.mjs
101523
101534
  /**
101524
101535
  import { errMsg } from '@camstack/types'
101525
101536
  * Extract a human-readable message from an unknown error value.
@@ -101651,6 +101662,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101651
101662
  * and the storage as branches of one bus. One read-only `energy-system` cap carries
101652
101663
  * every value; the storage is a field of it, never the `battery` cap (#513, #522). */
101653
101664
  DeviceType["EnergySystem"] = "energy-system";
101665
+ /** Something that RUNS on a machine, or the machine itself (#585): a VM, an app
101666
+ * container, an LXC, an app, or a host. The kind is the ROLE (D1033, D1056), never
101667
+ * a field; one `workload` cap carries the state, the controls and the resources. */
101668
+ DeviceType["Workload"] = "workload";
101654
101669
  return DeviceType;
101655
101670
  }({});
101656
101671
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -101871,6 +101886,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101871
101886
  * `light` type: the provider owns the type, and a light implies brightness
101872
101887
  * or colour this relay lacks. */
101873
101888
  DeviceRole["SwitchLight"] = "switch-light";
101889
+ /** One port of a network switch that powers the device behind it (PoE): on /
101890
+ * off feeds or cuts that power. Its link is `network-link`, its draw
101891
+ * `power-meter`. Restarting the powered device through the port is that
101892
+ * device's `power-source` cap, never a reboot of the port. */
101893
+ DeviceRole["PoePort"] = "poe-port";
101874
101894
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
101875
101895
  DeviceRole["ClimateAc"] = "climate-ac";
101876
101896
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -101951,6 +101971,17 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101951
101971
  /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
101952
101972
  * cap. A `DeviceType.Generic` device. */
101953
101973
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101974
+ /** A virtual machine on a hypervisor. */
101975
+ DeviceRole["Vm"] = "vm";
101976
+ /** An application container (Docker, Podman). */
101977
+ DeviceRole["AppContainer"] = "app-container";
101978
+ /** A system container (LXC). */
101979
+ DeviceRole["Lxc"] = "lxc";
101980
+ /** An application or service running on a host. */
101981
+ DeviceRole["App"] = "app";
101982
+ /** A machine that runs workloads or is an appliance with its own OS: a
101983
+ * server, a hypervisor, a gateway console, a CCU. */
101984
+ DeviceRole["Host"] = "host";
101954
101985
  return DeviceRole;
101955
101986
  }({});
101956
101987
  /**
@@ -102534,8 +102565,8 @@ var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
102534
102565
  function emoji() {
102535
102566
  return new RegExp(_emoji$1, "u");
102536
102567
  }
102537
- var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
102538
- var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
102568
+ 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])$/;
102569
+ var ipv6$1 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
102539
102570
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
102540
102571
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
102541
102572
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
@@ -103209,12 +103240,12 @@ var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)
103209
103240
  $ZodStringFormat.init(inst, def);
103210
103241
  });
103211
103242
  var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
103212
- def.pattern ?? (def.pattern = ipv4);
103243
+ def.pattern ?? (def.pattern = ipv4$1);
103213
103244
  $ZodStringFormat.init(inst, def);
103214
103245
  inst._zod.bag.format = `ipv4`;
103215
103246
  });
103216
103247
  var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
103217
- def.pattern ?? (def.pattern = ipv6);
103248
+ def.pattern ?? (def.pattern = ipv6$1);
103218
103249
  $ZodStringFormat.init(inst, def);
103219
103250
  inst._zod.bag.format = `ipv6`;
103220
103251
  inst._zod.check = (payload) => {
@@ -106130,10 +106161,16 @@ var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
106130
106161
  $ZodIPv4.init(inst, def);
106131
106162
  ZodStringFormat.init(inst, def);
106132
106163
  });
106164
+ function ipv4(params) {
106165
+ return /* @__PURE__ */ _ipv4(ZodIPv4, params);
106166
+ }
106133
106167
  var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
106134
106168
  $ZodIPv6.init(inst, def);
106135
106169
  ZodStringFormat.init(inst, def);
106136
106170
  });
106171
+ function ipv6(params) {
106172
+ return /* @__PURE__ */ _ipv6(ZodIPv6, params);
106173
+ }
106137
106174
  var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
106138
106175
  $ZodCIDRv4.init(inst, def);
106139
106176
  ZodStringFormat.init(inst, def);
@@ -106771,7 +106808,7 @@ var ZodIssueCode = {
106771
106808
  var ZodFirstPartyTypeKind;
106772
106809
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106773
106810
  //#endregion
106774
- //#region ../types/dist/sleep-Ch7Q7UtE.mjs
106811
+ //#region ../types/dist/sleep-D6Pih0Qt.mjs
106775
106812
  /**
106776
106813
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106777
106814
  * window to float samples (D455).
@@ -111569,6 +111606,10 @@ var CAP_VOCABULARY_BY_NAME = {
111569
111606
  effect: {
111570
111607
  field: "on",
111571
111608
  value: true
111609
+ },
111610
+ offeredWhen: {
111611
+ method: "getOptions",
111612
+ field: "supportsSetState"
111572
111613
  }
111573
111614
  },
111574
111615
  {
@@ -111587,6 +111628,10 @@ var CAP_VOCABULARY_BY_NAME = {
111587
111628
  effect: {
111588
111629
  field: "on",
111589
111630
  value: false
111631
+ },
111632
+ offeredWhen: {
111633
+ method: "getOptions",
111634
+ field: "supportsSetState"
111590
111635
  }
111591
111636
  },
111592
111637
  {
@@ -111600,9 +111645,14 @@ var CAP_VOCABULARY_BY_NAME = {
111600
111645
  en: "Toggle {device}",
111601
111646
  it: "Commuta {device}"
111602
111647
  },
111603
- icon: "toggle-right"
111648
+ icon: "toggle-right",
111649
+ offeredWhen: {
111650
+ method: "getOptions",
111651
+ field: "supportsSetState"
111652
+ }
111604
111653
  }
111605
111654
  ],
111655
+ notOperatorFacing: { powerCycle: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own" },
111606
111656
  state: [{
111607
111657
  kind: "boolean",
111608
111658
  field: "on",
@@ -111861,6 +111911,47 @@ var CAP_VOCABULARY_BY_NAME = {
111861
111911
  "switch.off": { icon: "plug" }
111862
111912
  },
111863
111913
  state: { on: { icon: "plug-zap" } }
111914
+ },
111915
+ [DeviceRole.PoePort]: {
111916
+ actions: {
111917
+ "switch.on": {
111918
+ label: {
111919
+ en: "Power on",
111920
+ it: "Alimenta"
111921
+ },
111922
+ phrase: {
111923
+ en: "Power on {device}",
111924
+ it: "Alimenta {device}"
111925
+ },
111926
+ icon: "plug-zap"
111927
+ },
111928
+ "switch.off": {
111929
+ label: {
111930
+ en: "Power off",
111931
+ it: "Togli alimentazione"
111932
+ },
111933
+ phrase: {
111934
+ en: "Power off {device}",
111935
+ it: "Togli alimentazione a {device}"
111936
+ },
111937
+ icon: "unplug"
111938
+ }
111939
+ },
111940
+ state: { on: {
111941
+ label: {
111942
+ en: "Powered",
111943
+ it: "Alimentata"
111944
+ },
111945
+ whenTrue: {
111946
+ en: "When {device} is powered",
111947
+ it: "Quando {device} viene alimentata"
111948
+ },
111949
+ whenFalse: {
111950
+ en: "When {device} loses power",
111951
+ it: "Quando {device} perde l’alimentazione"
111952
+ },
111953
+ icon: "plug-zap"
111954
+ } }
111864
111955
  }
111865
111956
  }
111866
111957
  }
@@ -112580,7 +112671,11 @@ var CAP_VOCABULARY_BY_NAME = {
112580
112671
  en: "Power on {device}",
112581
112672
  it: "Dai corrente a {device}"
112582
112673
  },
112583
- icon: "power"
112674
+ icon: "power",
112675
+ offeredWhen: {
112676
+ method: "getStatus",
112677
+ field: "switchSettable"
112678
+ }
112584
112679
  },
112585
112680
  {
112586
112681
  id: "powerSource.off",
@@ -112593,7 +112688,11 @@ var CAP_VOCABULARY_BY_NAME = {
112593
112688
  en: "Cut the power of {device}",
112594
112689
  it: "Togli la corrente a {device}"
112595
112690
  },
112596
- icon: "power-off"
112691
+ icon: "power-off",
112692
+ offeredWhen: {
112693
+ method: "getStatus",
112694
+ field: "switchSettable"
112695
+ }
112597
112696
  },
112598
112697
  {
112599
112698
  id: "powerSource.forceRestart",
@@ -114363,37 +114462,66 @@ var CAP_VOCABULARY_BY_NAME = {
114363
114462
  en: "Siren",
114364
114463
  it: "Sirena"
114365
114464
  },
114366
- actions: [{
114367
- id: "siren.trigger",
114368
- method: "trigger",
114369
- label: {
114370
- en: "Sound the siren",
114371
- it: "Fai suonare la sirena"
114372
- },
114373
- phrase: {
114374
- en: "Sound {device}",
114375
- it: "Fai suonare {device}"
114376
- },
114377
- icon: "siren",
114378
- args: {}
114379
- }, {
114380
- id: "siren.stop",
114381
- method: "stop",
114382
- label: {
114383
- en: "Silence the siren",
114384
- it: "Zittisci la sirena"
114465
+ actions: [
114466
+ {
114467
+ id: "siren.trigger",
114468
+ method: "trigger",
114469
+ label: {
114470
+ en: "Sound the siren",
114471
+ it: "Fai suonare la sirena"
114472
+ },
114473
+ phrase: {
114474
+ en: "Sound {device}",
114475
+ it: "Fai suonare {device}"
114476
+ },
114477
+ icon: "siren",
114478
+ args: {}
114385
114479
  },
114386
- phrase: {
114387
- en: "Silence {device}",
114388
- it: "Zittisci {device}"
114480
+ {
114481
+ id: "siren.triggerPlays",
114482
+ method: "trigger",
114483
+ label: {
114484
+ en: "Sound the siren N times",
114485
+ it: "Fai suonare la sirena N volte"
114486
+ },
114487
+ phrase: {
114488
+ en: "Sound {device} {plays} times",
114489
+ it: "Fai suonare {device} {plays} volte"
114490
+ },
114491
+ icon: "siren",
114492
+ openArgs: [{
114493
+ key: "plays",
114494
+ label: {
114495
+ en: "Plays",
114496
+ it: "Riproduzioni"
114497
+ },
114498
+ offer: {
114499
+ kind: "dynamic",
114500
+ from: "method",
114501
+ method: "getPlayChoices",
114502
+ valueKind: "number"
114503
+ }
114504
+ }]
114389
114505
  },
114390
- icon: "siren",
114391
- args: {},
114392
- effect: {
114393
- field: "active",
114394
- value: false
114506
+ {
114507
+ id: "siren.stop",
114508
+ method: "stop",
114509
+ label: {
114510
+ en: "Silence the siren",
114511
+ it: "Zittisci la sirena"
114512
+ },
114513
+ phrase: {
114514
+ en: "Silence {device}",
114515
+ it: "Zittisci {device}"
114516
+ },
114517
+ icon: "siren",
114518
+ args: {},
114519
+ effect: {
114520
+ field: "active",
114521
+ value: false
114522
+ }
114395
114523
  }
114396
- }],
114524
+ ],
114397
114525
  state: [{
114398
114526
  kind: "boolean",
114399
114527
  field: "active",
@@ -116988,6 +117116,374 @@ var CAP_VOCABULARY_BY_NAME = {
116988
117116
  icon: "loader"
116989
117117
  }]
116990
117118
  },
117119
+ "workload": {
117120
+ scope: "device",
117121
+ noun: {
117122
+ en: "Workload",
117123
+ it: "Carico di lavoro"
117124
+ },
117125
+ actions: [
117126
+ {
117127
+ id: "workload.start",
117128
+ method: "start",
117129
+ label: {
117130
+ en: "Start",
117131
+ it: "Avvia"
117132
+ },
117133
+ phrase: {
117134
+ en: "Start {device}",
117135
+ it: "Avvia {device}"
117136
+ },
117137
+ icon: "play",
117138
+ effect: {
117139
+ field: "state",
117140
+ value: "running"
117141
+ }
117142
+ },
117143
+ {
117144
+ id: "workload.stop",
117145
+ method: "stop",
117146
+ label: {
117147
+ en: "Stop",
117148
+ it: "Arresta"
117149
+ },
117150
+ phrase: {
117151
+ en: "Stop {device}",
117152
+ it: "Arresta {device}"
117153
+ },
117154
+ icon: "square",
117155
+ effect: {
117156
+ field: "state",
117157
+ value: "stopped"
117158
+ }
117159
+ },
117160
+ {
117161
+ id: "workload.restart",
117162
+ method: "restart",
117163
+ label: {
117164
+ en: "Restart",
117165
+ it: "Riavvia"
117166
+ },
117167
+ phrase: {
117168
+ en: "Restart {device}",
117169
+ it: "Riavvia {device}"
117170
+ },
117171
+ icon: "rotate-ccw"
117172
+ },
117173
+ {
117174
+ id: "workload.pause",
117175
+ method: "pause",
117176
+ label: {
117177
+ en: "Pause",
117178
+ it: "Metti in pausa"
117179
+ },
117180
+ phrase: {
117181
+ en: "Pause {device}",
117182
+ it: "Metti in pausa {device}"
117183
+ },
117184
+ icon: "pause",
117185
+ effect: {
117186
+ field: "state",
117187
+ value: "paused"
117188
+ }
117189
+ },
117190
+ {
117191
+ id: "workload.resume",
117192
+ method: "resume",
117193
+ label: {
117194
+ en: "Resume",
117195
+ it: "Riprendi"
117196
+ },
117197
+ phrase: {
117198
+ en: "Resume {device}",
117199
+ it: "Riprendi {device}"
117200
+ },
117201
+ icon: "circle-play",
117202
+ effect: {
117203
+ field: "state",
117204
+ value: "running"
117205
+ }
117206
+ },
117207
+ {
117208
+ id: "workload.forceStop",
117209
+ method: "forceStop",
117210
+ label: {
117211
+ en: "Force stop",
117212
+ it: "Arresto forzato"
117213
+ },
117214
+ phrase: {
117215
+ en: "Force {device} to stop",
117216
+ it: "Forza l’arresto di {device}"
117217
+ },
117218
+ icon: "octagon-x",
117219
+ effect: {
117220
+ field: "state",
117221
+ value: "stopped"
117222
+ }
117223
+ }
117224
+ ],
117225
+ state: [
117226
+ {
117227
+ kind: "enum",
117228
+ field: "state",
117229
+ label: {
117230
+ en: "State",
117231
+ it: "Stato"
117232
+ },
117233
+ values: [
117234
+ {
117235
+ value: "running",
117236
+ label: {
117237
+ en: "Running",
117238
+ it: "In esecuzione"
117239
+ },
117240
+ phrase: {
117241
+ en: "When {device} is running",
117242
+ it: "Quando {device} è in esecuzione"
117243
+ }
117244
+ },
117245
+ {
117246
+ value: "paused",
117247
+ label: {
117248
+ en: "Paused",
117249
+ it: "In pausa"
117250
+ }
117251
+ },
117252
+ {
117253
+ value: "stopped",
117254
+ label: {
117255
+ en: "Stopped",
117256
+ it: "Arrestato"
117257
+ },
117258
+ phrase: {
117259
+ en: "When {device} is stopped",
117260
+ it: "Quando {device} è arrestato"
117261
+ }
117262
+ },
117263
+ {
117264
+ value: "starting",
117265
+ label: {
117266
+ en: "Starting",
117267
+ it: "In avvio"
117268
+ }
117269
+ },
117270
+ {
117271
+ value: "stopping",
117272
+ label: {
117273
+ en: "Stopping",
117274
+ it: "In arresto"
117275
+ }
117276
+ },
117277
+ {
117278
+ value: "crashed",
117279
+ label: {
117280
+ en: "Crashed",
117281
+ it: "Arrestato in modo anomalo"
117282
+ },
117283
+ phrase: {
117284
+ en: "When {device} has crashed",
117285
+ it: "Quando {device} è arrestato in modo anomalo"
117286
+ }
117287
+ }
117288
+ ],
117289
+ icon: "activity"
117290
+ },
117291
+ {
117292
+ kind: "numeric",
117293
+ field: "resources.cpuPercent",
117294
+ quantity: {
117295
+ en: "the CPU use",
117296
+ it: "l'uso della CPU"
117297
+ },
117298
+ label: {
117299
+ en: "CPU",
117300
+ it: "CPU"
117301
+ },
117302
+ unit: "%",
117303
+ icon: "cpu"
117304
+ },
117305
+ {
117306
+ kind: "numeric",
117307
+ field: "resources.memoryPercent",
117308
+ quantity: {
117309
+ en: "the memory use",
117310
+ it: "l'uso della memoria"
117311
+ },
117312
+ label: {
117313
+ en: "Memory",
117314
+ it: "Memoria"
117315
+ },
117316
+ unit: "%",
117317
+ icon: "memory-stick"
117318
+ },
117319
+ {
117320
+ kind: "numeric",
117321
+ field: "resources.temperature",
117322
+ quantity: {
117323
+ en: "the temperature",
117324
+ it: "la temperatura"
117325
+ },
117326
+ label: {
117327
+ en: "Temperature",
117328
+ it: "Temperatura"
117329
+ },
117330
+ unit: "°C",
117331
+ icon: "thermometer"
117332
+ }
117333
+ ],
117334
+ events: {
117335
+ onStarted: {
117336
+ category: EventCategory.WorkloadStarted,
117337
+ label: {
117338
+ en: "Started",
117339
+ it: "Avviato"
117340
+ },
117341
+ phrase: {
117342
+ en: "When {device} starts",
117343
+ it: "Quando {device} si avvia"
117344
+ },
117345
+ icon: "play"
117346
+ },
117347
+ onStopped: {
117348
+ category: EventCategory.WorkloadStopped,
117349
+ label: {
117350
+ en: "Stopped",
117351
+ it: "Arrestato"
117352
+ },
117353
+ phrase: {
117354
+ en: "When {device} stops",
117355
+ it: "Quando {device} si arresta"
117356
+ },
117357
+ icon: "square"
117358
+ },
117359
+ onCrashed: {
117360
+ category: EventCategory.WorkloadCrashed,
117361
+ label: {
117362
+ en: "Crashed",
117363
+ it: "Arrestato in modo anomalo"
117364
+ },
117365
+ phrase: {
117366
+ en: "When {device} stops without being asked",
117367
+ it: "Quando {device} si arresta senza che sia stato richiesto"
117368
+ },
117369
+ icon: "triangle-alert"
117370
+ },
117371
+ onRecovered: {
117372
+ category: EventCategory.WorkloadRecovered,
117373
+ label: {
117374
+ en: "Recovered",
117375
+ it: "Ripristinato"
117376
+ },
117377
+ phrase: {
117378
+ en: "When {device} runs again after a crash",
117379
+ it: "Quando {device} riparte dopo un arresto anomalo"
117380
+ },
117381
+ icon: "heart-pulse"
117382
+ }
117383
+ },
117384
+ overrides: { byRole: {
117385
+ [DeviceRole.Vm]: {
117386
+ actions: { "workload.start": { icon: "monitor" } },
117387
+ state: { state: { icon: "monitor" } }
117388
+ },
117389
+ [DeviceRole.AppContainer]: {
117390
+ actions: { "workload.start": { icon: "container" } },
117391
+ state: { state: { icon: "container" } }
117392
+ },
117393
+ [DeviceRole.Lxc]: {
117394
+ actions: { "workload.start": { icon: "box" } },
117395
+ state: { state: { icon: "box" } }
117396
+ },
117397
+ [DeviceRole.App]: {
117398
+ actions: { "workload.start": { icon: "app-window" } },
117399
+ state: { state: { icon: "app-window" } }
117400
+ },
117401
+ [DeviceRole.Host]: {
117402
+ actions: {
117403
+ "workload.start": {
117404
+ label: {
117405
+ en: "Power on",
117406
+ it: "Accendi"
117407
+ },
117408
+ phrase: {
117409
+ en: "Power on {device}",
117410
+ it: "Accendi {device}"
117411
+ },
117412
+ icon: "power"
117413
+ },
117414
+ "workload.stop": {
117415
+ label: {
117416
+ en: "Shut down",
117417
+ it: "Spegni"
117418
+ },
117419
+ phrase: {
117420
+ en: "Shut down {device}",
117421
+ it: "Spegni {device}"
117422
+ },
117423
+ icon: "power-off"
117424
+ },
117425
+ "workload.restart": {
117426
+ label: {
117427
+ en: "Reboot",
117428
+ it: "Riavvia"
117429
+ },
117430
+ phrase: {
117431
+ en: "Reboot {device}",
117432
+ it: "Riavvia {device}"
117433
+ },
117434
+ icon: "refresh-cw"
117435
+ }
117436
+ },
117437
+ state: { state: { icon: "server" } },
117438
+ events: {
117439
+ onStarted: {
117440
+ label: {
117441
+ en: "Came online",
117442
+ it: "Tornato in linea"
117443
+ },
117444
+ phrase: {
117445
+ en: "When {device} comes online",
117446
+ it: "Quando {device} torna in linea"
117447
+ },
117448
+ icon: "server"
117449
+ },
117450
+ onStopped: {
117451
+ label: {
117452
+ en: "Shut down",
117453
+ it: "Spento"
117454
+ },
117455
+ phrase: {
117456
+ en: "When {device} shuts down",
117457
+ it: "Quando {device} si spegne"
117458
+ },
117459
+ icon: "server-off"
117460
+ },
117461
+ onCrashed: {
117462
+ label: {
117463
+ en: "Went down",
117464
+ it: "Caduto"
117465
+ },
117466
+ phrase: {
117467
+ en: "When {device} goes down unexpectedly",
117468
+ it: "Quando {device} cade inaspettatamente"
117469
+ },
117470
+ icon: "server-crash"
117471
+ },
117472
+ onRecovered: {
117473
+ label: {
117474
+ en: "Came online",
117475
+ it: "Tornato in linea"
117476
+ },
117477
+ phrase: {
117478
+ en: "When {device} comes back online after going down",
117479
+ it: "Quando {device} torna in linea dopo essere caduto"
117480
+ },
117481
+ icon: "server"
117482
+ }
117483
+ }
117484
+ }
117485
+ } }
117486
+ },
116991
117487
  "accessories": {
116992
117488
  scope: "device",
116993
117489
  noun: {
@@ -120636,6 +121132,15 @@ var PipelineStepInputSchema = lazy(() => object({
120636
121132
  }));
120637
121133
  /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
120638
121134
  var PipelineRunResultBridge = custom();
121135
+ /**
121136
+ * Whether a switch can be set (D1058), schema-free so the addon runner can import it from
121137
+ * `@camstack/types/addon` without loading the capability schema graph (D28).
121138
+ */
121139
+ /** The read that decides whether a switch is offered on/off (`offeredWhen` of its actions). */
121140
+ var SWITCH_SETTABLE_GATE = {
121141
+ method: "getOptions",
121142
+ field: "supportsSetState"
121143
+ };
120639
121144
  var StaticDirOutputSchema = object({ staticDir: string() });
120640
121145
  var VersionOutputSchema = object({ version: string() });
120641
121146
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" }), NOT_A_DEVICE.UI_PLUMBING;
@@ -120883,6 +121388,7 @@ var CAP_NAMES = Object.freeze([
120883
121388
  "weather",
120884
121389
  "weather-station",
120885
121390
  "webrtc-session",
121391
+ "workload",
120886
121392
  "zone-analytics",
120887
121393
  "zone-rules",
120888
121394
  "zones"
@@ -122185,6 +122691,14 @@ Object.freeze({
122185
122691
  "path": "ssid",
122186
122692
  "valueType": "string"
122187
122693
  },
122694
+ {
122695
+ "path": "speedKbps",
122696
+ "valueType": "number"
122697
+ },
122698
+ {
122699
+ "path": "linkUp",
122700
+ "valueType": "boolean"
122701
+ },
122188
122702
  {
122189
122703
  "path": "lastUpdated",
122190
122704
  "valueType": "number"
@@ -122581,6 +123095,14 @@ Object.freeze({
122581
123095
  "path": "durationSeconds",
122582
123096
  "valueType": "number"
122583
123097
  },
123098
+ {
123099
+ "path": "plays",
123100
+ "valueType": "number"
123101
+ },
123102
+ {
123103
+ "path": "activeUntilEstimated",
123104
+ "valueType": "boolean"
123105
+ },
122584
123106
  {
122585
123107
  "path": "lastTriggeredAt",
122586
123108
  "valueType": "number"
@@ -122983,6 +123505,92 @@ Object.freeze({
122983
123505
  "valueType": "number"
122984
123506
  }
122985
123507
  ],
123508
+ "workload": [
123509
+ {
123510
+ "path": "state",
123511
+ "valueType": "enum",
123512
+ "enumValues": [
123513
+ "running",
123514
+ "paused",
123515
+ "stopped",
123516
+ "starting",
123517
+ "stopping",
123518
+ "crashed"
123519
+ ]
123520
+ },
123521
+ {
123522
+ "path": "since",
123523
+ "valueType": "number"
123524
+ },
123525
+ {
123526
+ "path": "hostDeviceId",
123527
+ "valueType": "number"
123528
+ },
123529
+ {
123530
+ "path": "image",
123531
+ "valueType": "string"
123532
+ },
123533
+ {
123534
+ "path": "os",
123535
+ "valueType": "string"
123536
+ },
123537
+ {
123538
+ "path": "version",
123539
+ "valueType": "string"
123540
+ },
123541
+ {
123542
+ "path": "autostart",
123543
+ "valueType": "boolean"
123544
+ },
123545
+ {
123546
+ "path": "resources.cpuPercent",
123547
+ "valueType": "number"
123548
+ },
123549
+ {
123550
+ "path": "resources.memoryUsedBytes",
123551
+ "valueType": "number"
123552
+ },
123553
+ {
123554
+ "path": "resources.memoryPercent",
123555
+ "valueType": "number"
123556
+ },
123557
+ {
123558
+ "path": "resources.memoryLimitBytes",
123559
+ "valueType": "number"
123560
+ },
123561
+ {
123562
+ "path": "resources.vcpus",
123563
+ "valueType": "number"
123564
+ },
123565
+ {
123566
+ "path": "resources.diskUsedBytes",
123567
+ "valueType": "number"
123568
+ },
123569
+ {
123570
+ "path": "resources.diskTotalBytes",
123571
+ "valueType": "number"
123572
+ },
123573
+ {
123574
+ "path": "resources.netRxKbps",
123575
+ "valueType": "number"
123576
+ },
123577
+ {
123578
+ "path": "resources.netTxKbps",
123579
+ "valueType": "number"
123580
+ },
123581
+ {
123582
+ "path": "resources.load1",
123583
+ "valueType": "number"
123584
+ },
123585
+ {
123586
+ "path": "resources.temperature",
123587
+ "valueType": "number"
123588
+ },
123589
+ {
123590
+ "path": "updateAvailable",
123591
+ "valueType": "boolean"
123592
+ }
123593
+ ],
122986
123594
  "zone-analytics": [
122987
123595
  {
122988
123596
  "path": "ts",
@@ -123099,7 +123707,7 @@ function sleep(ms) {
123099
123707
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
123100
123708
  }
123101
123709
  //#endregion
123102
- //#region ../types/dist/implemented-methods-C5FMXLGP.mjs
123710
+ //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
123103
123711
  /**
123104
123712
  * The ffmpeg build every CamStack node downloads, per platform and arch.
123105
123713
  *
@@ -124020,63 +124628,99 @@ var HelperMemberSchema = object({
124020
124628
  cap: string().min(1),
124021
124629
  fieldPath: string().min(1)
124022
124630
  });
124631
+ /** A group, a statistic, or an integral (D944). The composer runs all three. */
124632
+ var GroupHelperSpecSchema = object({
124633
+ kind: literal("group"),
124634
+ templateId: GroupTemplateIdSchema,
124635
+ aggregate: AggregateReducerSchema,
124636
+ members: array(HelperMemberSchema).min(1).max(64),
124637
+ /** Actuator groups only. Readings leave this unset. */
124638
+ active: ActiveCriterionSchema.optional()
124639
+ });
124640
+ var statisticHelperObject = object({
124641
+ kind: literal("statistic"),
124642
+ stat: _enum(STATISTIC_STATS),
124643
+ window: StatisticWindowSchema,
124644
+ source: HelperMemberSchema
124645
+ });
124646
+ var integralHelperObject = object({
124647
+ kind: literal("integral"),
124648
+ reset: _enum(RESET_PERIODS),
124649
+ output: _enum(["energy", "meter"]),
124650
+ source: HelperMemberSchema
124651
+ });
124652
+ var thresholdHelperObject = object({
124653
+ kind: literal("threshold"),
124654
+ source: HelperMemberSchema,
124655
+ high: number$1(),
124656
+ low: number$1(),
124657
+ onForMs: number$1().int().nonnegative(),
124658
+ offForMs: number$1().int().nonnegative()
124659
+ });
124660
+ var arithmeticHelperObject = object({
124661
+ kind: literal("arithmetic"),
124662
+ op: _enum([
124663
+ "sum",
124664
+ "difference",
124665
+ "ratio"
124666
+ ]),
124667
+ inputs: array(HelperMemberSchema).min(2).max(64)
124668
+ });
124669
+ var expressionHelperObject = object({
124670
+ kind: literal("expression"),
124671
+ expr: string().min(1),
124672
+ inputs: array(object({
124673
+ name: string().min(1),
124674
+ member: HelperMemberSchema
124675
+ })).min(1).max(64),
124676
+ output: _enum(["number", "boolean"])
124677
+ });
124678
+ var derivativeHelperObject = object({
124679
+ kind: literal("derivative"),
124680
+ window: RollingWindowSchema,
124681
+ per: _enum([
124682
+ "second",
124683
+ "minute",
124684
+ "hour"
124685
+ ]),
124686
+ source: HelperMemberSchema
124687
+ });
124688
+ /** The stream profiles a camera grid can publish. */
124689
+ var GRID_PROFILES = [
124690
+ "high",
124691
+ "mid",
124692
+ "low"
124693
+ ];
124694
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
124695
+ var GridRectSchema = object({
124696
+ x: number$1().min(0).max(1),
124697
+ y: number$1().min(0).max(1),
124698
+ width: number$1().gt(0).max(1),
124699
+ height: number$1().gt(0).max(1)
124700
+ });
124701
+ var GridCellSpecSchema = object({
124702
+ source: CompositionSourceRefSchema,
124703
+ region: GridRectSchema,
124704
+ cell: GridRectSchema
124705
+ });
124023
124706
  var HelperSpecSchema = discriminatedUnion("kind", [
124024
124707
  object({
124025
- kind: literal("group"),
124026
- templateId: GroupTemplateIdSchema,
124027
- aggregate: AggregateReducerSchema,
124028
- members: array(HelperMemberSchema).min(1).max(64),
124029
- /** Actuator groups only. Readings leave this unset. */
124030
- active: ActiveCriterionSchema.optional()
124031
- }),
124032
- object({
124033
- kind: literal("statistic"),
124034
- stat: _enum(STATISTIC_STATS),
124035
- window: StatisticWindowSchema,
124036
- source: HelperMemberSchema
124708
+ kind: literal("grid"),
124709
+ fps: number$1().int().min(1).max(60),
124710
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
124711
+ cells: array(GridCellSpecSchema).max(16)
124037
124712
  }),
124038
124713
  object({
124039
- kind: literal("integral"),
124040
- reset: _enum(RESET_PERIODS),
124041
- output: _enum(["energy", "meter"]),
124042
- source: HelperMemberSchema
124714
+ kind: literal("terminal"),
124715
+ terminalId: string().uuid()
124043
124716
  }),
124044
- object({
124045
- kind: literal("threshold"),
124046
- source: HelperMemberSchema,
124047
- high: number$1(),
124048
- low: number$1(),
124049
- onForMs: number$1().int().nonnegative(),
124050
- offForMs: number$1().int().nonnegative()
124051
- }),
124052
- object({
124053
- kind: literal("arithmetic"),
124054
- op: _enum([
124055
- "sum",
124056
- "difference",
124057
- "ratio"
124058
- ]),
124059
- inputs: array(HelperMemberSchema).min(2).max(64)
124060
- }),
124061
- object({
124062
- kind: literal("expression"),
124063
- expr: string().min(1),
124064
- inputs: array(object({
124065
- name: string().min(1),
124066
- member: HelperMemberSchema
124067
- })).min(1).max(64),
124068
- output: _enum(["number", "boolean"])
124069
- }),
124070
- object({
124071
- kind: literal("derivative"),
124072
- window: RollingWindowSchema,
124073
- per: _enum([
124074
- "second",
124075
- "minute",
124076
- "hour"
124077
- ]),
124078
- source: HelperMemberSchema
124079
- })
124717
+ GroupHelperSpecSchema,
124718
+ statisticHelperObject,
124719
+ integralHelperObject,
124720
+ thresholdHelperObject,
124721
+ arithmeticHelperObject,
124722
+ expressionHelperObject,
124723
+ derivativeHelperObject
124080
124724
  ]);
124081
124725
  /** Longest snippet a `code` source may carry (slice 4). */
124082
124726
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
@@ -156390,9 +157034,10 @@ var GridProfileOfferSchema = object({
156390
157034
  published: boolean()
156391
157035
  });
156392
157036
  var GridLayoutViewSchema = object({
156393
- /** The persisted grid row this camera was declared from. */
156394
- instanceId: string(),
157037
+ /** The grid block (planning#580) whose camera this is. */
157038
+ blockId: string(),
156395
157039
  deviceId: number$1().int().nonnegative(),
157040
+ /** The device row's name — the only name a grid has; it is renamed on the block or the device. */
156396
157041
  name: string(),
156397
157042
  /**
156398
157043
  * NO canvas size. A grid's resolution is not authored: each profile derives
@@ -156408,7 +157053,6 @@ var GridLayoutViewSchema = object({
156408
157053
  });
156409
157054
  var GridLayoutPatchSchema = object({
156410
157055
  deviceId: number$1().int().nonnegative(),
156411
- name: string().min(1).max(160).optional(),
156412
157056
  fps: number$1().int().min(1).max(60).optional(),
156413
157057
  /** Which profiles to publish. See `GridProfileOffer.published`. */
156414
157058
  publishedProfiles: array(_enum([
@@ -160138,7 +160782,7 @@ var mediaPlayerCapability = {
160138
160782
  ]
160139
160783
  }
160140
160784
  };
160141
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
160785
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
160142
160786
  var NUMBER = {
160143
160787
  kind: "fixed",
160144
160788
  result: ["number"]
@@ -160588,7 +161232,7 @@ new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
160588
161232
  DeviceType.Camera;
160589
161233
  /**
160590
161234
  * The series a device card trends, per cap (`history.primary` + `history.priority`):
160591
- * 6 caps. The card shows the primary of the enabled cap with the highest priority.
161235
+ * 7 caps. The card shows the primary of the enabled cap with the highest priority.
160592
161236
  */
160593
161237
  var HISTORY_PRIMARY = {
160594
161238
  "climate-control": {
@@ -160614,6 +161258,10 @@ var HISTORY_PRIMARY = {
160614
161258
  "weather-station": {
160615
161259
  field: "temperature",
160616
161260
  priority: 60
161261
+ },
161262
+ "workload": {
161263
+ field: "resources.cpuPercent",
161264
+ priority: 40
160617
161265
  }
160618
161266
  };
160619
161267
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
@@ -160624,6 +161272,8 @@ var PowerSourceRefusalReasonSchema = _enum([
160624
161272
  "switch-unknown",
160625
161273
  "restart-in-progress",
160626
161274
  "switch-call-failed",
161275
+ "switch-options-unreadable",
161276
+ "not-settable",
160627
161277
  "switch-is-actuator"
160628
161278
  ]);
160629
161279
  var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
@@ -160640,6 +161290,14 @@ var PowerSourceInfoSchema = object({
160640
161290
  /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
160641
161291
  switchOn: boolean().nullable(),
160642
161292
  switchOnline: boolean().nullable(),
161293
+ /**
161294
+ * Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
161295
+ * without the method is a plain switch, `true`). `null` = not known: no link, the switch is
161296
+ * missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
161297
+ * withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
161298
+ * unknown keeps them (D315, D1058).
161299
+ */
161300
+ switchSettable: boolean().nullable().optional(),
160643
161301
  restartInProgress: boolean(),
160644
161302
  offSeconds: number$1().int()
160645
161303
  });
@@ -160697,6 +161355,11 @@ var powerSourceCustomize = {
160697
161355
  }]
160698
161356
  };
160699
161357
  var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
161358
+ /** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
161359
+ var POWER_SOURCE_SETTABLE_GATE = {
161360
+ method: "getStatus",
161361
+ field: "switchSettable"
161362
+ };
160700
161363
  var powerSourceCapability = {
160701
161364
  name: "power-source",
160702
161365
  scope: "device",
@@ -160711,7 +161374,8 @@ var powerSourceCapability = {
160711
161374
  id: "powerSource.on",
160712
161375
  label: t("Power on", "Dai corrente"),
160713
161376
  phrase: t("Power on {device}", "Dai corrente a {device}"),
160714
- icon: "power"
161377
+ icon: "power",
161378
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160715
161379
  }]
160716
161380
  }),
160717
161381
  powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -160721,7 +161385,8 @@ var powerSourceCapability = {
160721
161385
  id: "powerSource.off",
160722
161386
  label: t("Power off", "Togli corrente"),
160723
161387
  phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
160724
- icon: "power-off"
161388
+ icon: "power-off",
161389
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
160725
161390
  }]
160726
161391
  }),
160727
161392
  forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -162434,6 +163099,205 @@ var SiteZoneSchema = object({
162434
163099
  * the ones that most want grouping. */
162435
163100
  locationKeys: array(string())
162436
163101
  });
163102
+ /**
163103
+ * Provider-declared device identifiers (D1059, planning#590).
163104
+ *
163105
+ * What a device IS, as its owning provider read it from the hardware: the keys a
163106
+ * later step matches across integrations to tell that two devices are the same
163107
+ * physical object. Separate from `DeviceMetadata` on purpose — metadata is a
163108
+ * free-form blob the operator can edit, identifiers are typed, normalised and
163109
+ * written ONLY by the provider that owns the device (`device-manager.
163110
+ * setIdentifiers`, owner-checked on the transport's caller stamp).
163111
+ *
163112
+ * | Key | Stored form | Strength |
163113
+ * | -------------- | ----------------------------------- | -------- |
163114
+ * | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
163115
+ * | `serial` | `<manufacturer>:<serial>` | strong |
163116
+ * | `machine-uuid` | SMBIOS / VM / container uuid | strong |
163117
+ * | `vendor-uid` | `<vendor>:<id>` | strong |
163118
+ * | `hostname` | lower-case, no domain | weak |
163119
+ * | `ip` | IPv4 / IPv6 | weak |
163120
+ *
163121
+ * Strength is a property of the KEY, derived by {@link identifierStrength} —
163122
+ * never stored, so it cannot drift from the table above. A weak key never links
163123
+ * two devices on its own.
163124
+ *
163125
+ * The schema refuses a value that is not in its stored form, so whatever is
163126
+ * persisted is already normalised. Build a declaration with
163127
+ * {@link normaliseIdentifiers}, which turns the raw values a driver read into
163128
+ * that form and names every value it refused.
163129
+ */
163130
+ var DEVICE_IDENTIFIER_KEYS = [
163131
+ "mac",
163132
+ "serial",
163133
+ "machine-uuid",
163134
+ "vendor-uid",
163135
+ "hostname",
163136
+ "ip"
163137
+ ];
163138
+ var DeviceIdentifierKeySchema = _enum(DEVICE_IDENTIFIER_KEYS);
163139
+ /** `read` — the provider read it from the device; `derived` — computed from something else it read. */
163140
+ var DeviceIdentifierOriginSchema = _enum(["read", "derived"]);
163141
+ var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
163142
+ /** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
163143
+ var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
163144
+ var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
163145
+ var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
163146
+ function entrySchema(value) {
163147
+ return object({
163148
+ value,
163149
+ origin: DeviceIdentifierOriginSchema,
163150
+ /** Epoch ms of the FIRST read that produced this value (and origin). A later
163151
+ * read of the same value does not move it — see {@link mergeIdentifiers}. */
163152
+ readAt: number$1().int().nonnegative()
163153
+ }).strict();
163154
+ }
163155
+ var MacEntrySchema = entrySchema(string().regex(MAC_PATTERN));
163156
+ var SerialEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163157
+ var MachineUuidEntrySchema = entrySchema(string().regex(MACHINE_UUID_PATTERN));
163158
+ var VendorUidEntrySchema = entrySchema(string().regex(PREFIXED_PATTERN));
163159
+ var HostnameEntrySchema = entrySchema(string().regex(HOSTNAME_PATTERN));
163160
+ var IpEntrySchema = entrySchema(union([ipv4(), ipv6()]));
163161
+ object({
163162
+ value: string().min(1),
163163
+ origin: DeviceIdentifierOriginSchema,
163164
+ readAt: number$1().int().nonnegative()
163165
+ }).strict();
163166
+ /** The typed declaration. Every key optional; `mac` the only one that holds several. */
163167
+ var DeviceIdentifiersSchema = object({
163168
+ mac: array(MacEntrySchema).min(1).readonly().optional(),
163169
+ serial: SerialEntrySchema.optional(),
163170
+ "machine-uuid": MachineUuidEntrySchema.optional(),
163171
+ "vendor-uid": VendorUidEntrySchema.optional(),
163172
+ hostname: HostnameEntrySchema.optional(),
163173
+ ip: IpEntrySchema.optional()
163174
+ }).strict();
163175
+ /** True when the declaration carries no key at all. */
163176
+ function isEmptyIdentifiers(identifiers) {
163177
+ return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
163178
+ }
163179
+ /** Values devices report when they do not know: never an identity. */
163180
+ var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
163181
+ var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
163182
+ function rejected(reason) {
163183
+ return {
163184
+ ok: false,
163185
+ reason
163186
+ };
163187
+ }
163188
+ /** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
163189
+ function normaliseMac(raw) {
163190
+ const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
163191
+ if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
163192
+ const mac = (hex.match(/../g) ?? []).join(":");
163193
+ if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
163194
+ return {
163195
+ ok: true,
163196
+ value: mac
163197
+ };
163198
+ }
163199
+ function slug$2(raw) {
163200
+ return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
163201
+ }
163202
+ function normalisePrefixed(prefixRaw, valueRaw, what) {
163203
+ const prefix = slug$2(prefixRaw);
163204
+ if (prefix.length === 0) return rejected(`no ${what}`);
163205
+ const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
163206
+ if (value.length === 0) return rejected("blank value");
163207
+ if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
163208
+ return {
163209
+ ok: true,
163210
+ value: `${prefix}:${value}`
163211
+ };
163212
+ }
163213
+ function normaliseMachineUuid(raw) {
163214
+ const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
163215
+ if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
163216
+ if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
163217
+ return {
163218
+ ok: true,
163219
+ value
163220
+ };
163221
+ }
163222
+ function isIp(value) {
163223
+ return union([ipv4(), ipv6()]).safeParse(value).success;
163224
+ }
163225
+ function normaliseHostname(raw) {
163226
+ const full = raw.trim().toLowerCase().replace(/\.$/, "");
163227
+ if (full.length === 0) return rejected("blank hostname");
163228
+ if (isIp(full)) return rejected("an address, not a hostname");
163229
+ const label = full.split(".")[0] ?? "";
163230
+ if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
163231
+ if (label === "localhost") return rejected("placeholder hostname");
163232
+ return {
163233
+ ok: true,
163234
+ value: label
163235
+ };
163236
+ }
163237
+ function normaliseIp(raw) {
163238
+ const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
163239
+ if (!isIp(value)) return rejected("not an IP address");
163240
+ if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
163241
+ return {
163242
+ ok: true,
163243
+ value
163244
+ };
163245
+ }
163246
+ function isBlank(value) {
163247
+ return value === null || value === void 0 || value.trim().length === 0;
163248
+ }
163249
+ /**
163250
+ * Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
163251
+ * with colons and de-duplicated, a hostname without its domain, an IP validated,
163252
+ * a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
163253
+ * cannot be normalised is left out and listed in `rejected` — the caller logs it
163254
+ * (with `tags: { deviceId }`), it is never dropped in silence.
163255
+ */
163256
+ function normaliseIdentifiers(raw, options = {}) {
163257
+ const readAt = options.readAt ?? Date.now();
163258
+ const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
163259
+ const entry = (key, value) => ({
163260
+ value,
163261
+ origin: originOf(key),
163262
+ readAt
163263
+ });
163264
+ const refused = [];
163265
+ const take = (key, input, result) => {
163266
+ if (result.ok) return entry(key, result.value);
163267
+ refused.push({
163268
+ key,
163269
+ value: input,
163270
+ reason: result.reason
163271
+ });
163272
+ };
163273
+ const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
163274
+ const macs = [];
163275
+ for (const input of macInputs) {
163276
+ if (isBlank(input)) continue;
163277
+ const taken = take("mac", input, normaliseMac(input));
163278
+ if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
163279
+ }
163280
+ 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"));
163281
+ 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"));
163282
+ const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
163283
+ const host = isBlank(raw.host) ? null : raw.host.trim();
163284
+ const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
163285
+ const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
163286
+ const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
163287
+ const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
163288
+ const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
163289
+ return {
163290
+ identifiers: {
163291
+ ...macs.length > 0 ? { mac: macs } : {},
163292
+ ...serial !== void 0 ? { serial } : {},
163293
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
163294
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
163295
+ ...hostname !== void 0 ? { hostname } : {},
163296
+ ...ip !== void 0 ? { ip } : {}
163297
+ },
163298
+ rejected: refused
163299
+ };
163300
+ }
162437
163301
  var DeviceSearchRequiresSchema = object({
162438
163302
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
162439
163303
  caps: array(string()).readonly().optional(),
@@ -162996,6 +163860,10 @@ var DeviceInfoSchema = object({
162996
163860
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
162997
163861
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
162998
163862
  metadata: record(string(), unknown()).nullable().optional(),
163863
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
163864
+ * the owning provider via `setIdentifiers`; read-only for the operator.
163865
+ * Absent ⇒ the provider declared none. */
163866
+ identifiers: DeviceIdentifiersSchema.optional(),
162999
163867
  /** Optional upstream-system identity + rendering envelope. See
163000
163868
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
163001
163869
  sourceInfo: SourceInfoSchema.optional(),
@@ -163147,6 +164015,8 @@ var DeviceMetaSchema = object({
163147
164015
  disabled: boolean(),
163148
164016
  parentDeviceId: number$1().nullable(),
163149
164017
  metadata: record(string(), unknown()).nullable().optional(),
164018
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
164019
+ identifiers: DeviceIdentifiersSchema.optional(),
163150
164020
  /** Optional upstream-system identity + rendering envelope. See
163151
164021
  * `SourceInfo`. Present when the device has been persisted with a
163152
164022
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -163460,6 +164330,14 @@ method(object({
163460
164330
  }), _void(), {
163461
164331
  kind: "mutation",
163462
164332
  auth: "admin"
164333
+ }), method(object({
164334
+ deviceId: number$1(),
164335
+ identifiers: DeviceIdentifiersSchema.nullable(),
164336
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
164337
+ unread: array(DeviceIdentifierKeySchema).optional()
164338
+ }), _void(), {
164339
+ kind: "mutation",
164340
+ auth: "admin"
163463
164341
  }), method(_void(), array(string())), method(object({ name: string() }), _void(), {
163464
164342
  kind: "mutation",
163465
164343
  auth: "admin"
@@ -168657,8 +169535,8 @@ var HeroSceneSchema = object({
168657
169535
  /** 0..1: volume, cover position, cycle progress. */
168658
169536
  level: number$1().min(0).max(1).nullable()
168659
169537
  });
168660
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
168661
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
169538
+ 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;
169539
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
168662
169540
  var HeroRowIdSchema = _enum([
168663
169541
  "progress",
168664
169542
  "run-for",
@@ -168887,8 +169765,12 @@ var HeroPowerSupplySlotSchema = object({
168887
169765
  /** Off asks for a confirmation while the device runs. */
168888
169766
  confirmOffWhileRunning: boolean(),
168889
169767
  running: boolean().nullable(),
168890
- powerOn: HeroActionSchema,
168891
- powerOff: HeroActionSchema,
169768
+ /**
169769
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
169770
+ * API key): power on / off would always be refused. The restart stays (D1058).
169771
+ */
169772
+ powerOn: HeroActionSchema.nullable(),
169773
+ powerOff: HeroActionSchema.nullable(),
168892
169774
  restart: HeroActionSchema
168893
169775
  });
168894
169776
  var HeroStateBackdropSchema = object({
@@ -179648,6 +180530,19 @@ var NetworkLinkStatusSchema = object({
179648
180530
  rssi: number$1().optional().meta(readingMeta("signal-level")),
179649
180531
  /** Network name of a wireless link, when the firmware reports it. */
179650
180532
  ssid: string().optional(),
180533
+ /**
180534
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
180535
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
180536
+ * `null` = the port is down or the speed is not known; absent = the provider
180537
+ * never reports one.
180538
+ */
180539
+ speedKbps: number$1().nonnegative().nullable().optional().meta(readingMeta("bitrate")),
180540
+ /**
180541
+ * Whether the link is up. `type` names the medium, not its state, so a wired
180542
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
180543
+ * absent = the provider never reports it.
180544
+ */
180545
+ linkUp: boolean().nullable().optional(),
179651
180546
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
179652
180547
  lastUpdated: number$1().meta(readingMeta("none"))
179653
180548
  });
@@ -181852,7 +182747,32 @@ var NcRuleInputSchema = object({
181852
182747
  * authored before this field meant. An editor turns it off by writing
181853
182748
  * `false`, so it needs no `clear` key.
181854
182749
  */
181855
- askVerdict: boolean().optional()
182750
+ askVerdict: boolean().optional(),
182751
+ /**
182752
+ * Operator tags (D1054), kept on the rule like a core block's. Absent = no
182753
+ * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
182754
+ * does not name `tags` keeps the stored ones (the store merges), and an
182755
+ * editor empties them by sending `[]` (the store drops an empty list).
182756
+ * Renamed or removed fleet-wide only through the `tags` cap, which writes
182757
+ * here with `setRuleTags`.
182758
+ */
182759
+ tags: TagsFieldSchema.optional()
182760
+ });
182761
+ /**
182762
+ * The rule kinds that carry tags (D1054) — each one its own store. Every kind
182763
+ * labels its rules the same way; this names which store a tag write goes to.
182764
+ */
182765
+ var NcTaggedRuleKindSchema = _enum([
182766
+ "event",
182767
+ "summary",
182768
+ "timelapse",
182769
+ "calendar-events"
182770
+ ]);
182771
+ /** One rule's tags, as the `tags` cap reads them across every kind. */
182772
+ var NcRuleTagsEntrySchema = object({
182773
+ kind: NcTaggedRuleKindSchema,
182774
+ ruleId: string(),
182775
+ tags: array(string())
181856
182776
  });
181857
182777
  /**
181858
182778
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -182869,6 +183789,16 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
182869
183789
  }), object({ success: literal(true) }), {
182870
183790
  kind: "mutation",
182871
183791
  auth: "admin"
183792
+ }), method(object({}), object({ rules: array(NcRuleTagsEntrySchema) }), {
183793
+ kind: "query",
183794
+ auth: "admin"
183795
+ }), method(object({
183796
+ kind: NcTaggedRuleKindSchema,
183797
+ ruleId: string(),
183798
+ tags: TagsFieldSchema
183799
+ }), object({ success: literal(true) }), {
183800
+ kind: "mutation",
183801
+ auth: "admin"
182872
183802
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
182873
183803
  deviceId: number$1().int(),
182874
183804
  muted: boolean()
@@ -188872,7 +189802,18 @@ var videoclipsCapability = {
188872
189802
  * older than this field keeps working unchanged (D382 — an unstated
188873
189803
  * ask is zero).
188874
189804
  */
188875
- audio: ClipStreamAudioSchema.optional()
189805
+ audio: ClipStreamAudioSchema.optional(),
189806
+ /**
189807
+ * The operator's authorisation to wake a sleeping camera for this
189808
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
189809
+ * — the default — means a sleeping standalone battery camera is
189810
+ * REFUSED by name before any URL is minted. A caller sets it only
189811
+ * when a viewer itself asked for the clip (the broker's `playClip`);
189812
+ * a prefetch, a reconcile or a retry never does. With it, the
189813
+ * provider wakes the camera and waits under a bound; a camera that
189814
+ * does not come up is refused `wake-timeout`, naming the wait.
189815
+ */
189816
+ wake: ClipWakeSchema.optional()
188876
189817
  }), ClipStreamDialSchema, {
188877
189818
  kind: "query",
188878
189819
  auth: "protected"
@@ -189176,7 +190117,8 @@ _enum([
189176
190117
  "camera-refused",
189177
190118
  "fetch-failed",
189178
190119
  "too-large-to-transfer",
189179
- "wake-expired"
190120
+ "wake-expired",
190121
+ "wake-timeout"
189180
190122
  ]);
189181
190123
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
189182
190124
  function clipExportFailure(code, detail) {
@@ -191436,6 +192378,16 @@ var SirenOptionsSchema = object({
191436
192378
  rangeSeconds: SirenDurationRangeSchema.nullable(),
191437
192379
  /** The camera's default duration, seconds. */
191438
192380
  defaultSeconds: number$1().positive(),
192381
+ /**
192382
+ * Discrete play counts the operator may pick; `null` when the camera gives a
192383
+ * range or does not count plays. Defaults to `null` so a provider that
192384
+ * predates plays (#589) reads as declaring none.
192385
+ */
192386
+ allowedPlays: array(number$1().int().positive()).nullable().default(null),
192387
+ /** Continuous range of play counts; `null` when listed or not counted. */
192388
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
192389
+ /** The camera's default play count; `null` when the camera does not count plays. */
192390
+ defaultPlays: number$1().int().positive().nullable().default(null),
191439
192391
  /** What the camera counts natively. */
191440
192392
  unit: _enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
191441
192393
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -191452,9 +192404,28 @@ var SirenStatusSchema = object({
191452
192404
  activeUntil: number$1().nullable(),
191453
192405
  /** Duration of the current / last activation, seconds; `null` when none yet. */
191454
192406
  durationSeconds: number$1().nullable(),
192407
+ /**
192408
+ * The play count of the current / last activation when it was asked in plays;
192409
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
192410
+ */
192411
+ plays: number$1().int().positive().nullable().default(null),
192412
+ /**
192413
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
192414
+ * not report — the siren may fall silent somewhat earlier or later.
192415
+ */
192416
+ activeUntilEstimated: boolean().default(false),
191455
192417
  /** Ms epoch of the last trigger (0 = never). */
191456
192418
  lastTriggeredAt: number$1()
191457
192419
  });
192420
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
192421
+ var SirenTriggerInputSchema = object({
192422
+ deviceId: number$1().int().nonnegative(),
192423
+ durationSeconds: number$1().positive().optional(),
192424
+ plays: number$1().int().positive().optional()
192425
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
192426
+ message: "a siren trigger takes durationSeconds or plays, not both",
192427
+ path: ["plays"]
192428
+ });
191458
192429
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
191459
192430
  /** Ms epoch of the last successful camera read of the options (0 = never). */
191460
192431
  lastFetchedAt: number$1() });
@@ -191471,13 +192442,20 @@ var sirenCapability = {
191471
192442
  auth: "protected"
191472
192443
  }),
191473
192444
  /**
191474
- * Sound the siren. Without `durationSeconds` the camera default applies.
191475
- * Answers the state at the moment of the trigger (`activeUntil` included).
192445
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
192446
+ * its range spelled out. Empty for a siren that counts seconds.
191476
192447
  */
191477
- trigger: method(object({
191478
- deviceId: number$1().int().nonnegative(),
191479
- durationSeconds: number$1().positive().optional()
191480
- }), SirenStatusSchema, {
192448
+ getPlayChoices: method(object({ deviceId: number$1().int().nonnegative() }), array(number$1().int().positive()), {
192449
+ kind: "query",
192450
+ auth: "protected"
192451
+ }),
192452
+ /**
192453
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
192454
+ * neither the camera default applies. A count on a siren that declares no
192455
+ * plays is refused. Answers the state at the moment of the trigger
192456
+ * (`activeUntil` included).
192457
+ */
192458
+ trigger: method(SirenTriggerInputSchema, SirenStatusSchema, {
191481
192459
  kind: "mutation",
191482
192460
  auth: "protected",
191483
192461
  actions: [{
@@ -191486,6 +192464,21 @@ var sirenCapability = {
191486
192464
  phrase: t("Sound {device}", "Fai suonare {device}"),
191487
192465
  icon: "siren",
191488
192466
  args: {}
192467
+ }, {
192468
+ id: "siren.triggerPlays",
192469
+ label: t("Sound the siren N times", "Fai suonare la sirena N volte"),
192470
+ phrase: t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
192471
+ icon: "siren",
192472
+ openArgs: [{
192473
+ key: "plays",
192474
+ label: t("Plays", "Riproduzioni"),
192475
+ offer: {
192476
+ kind: "dynamic",
192477
+ from: "method",
192478
+ method: "getPlayChoices",
192479
+ valueKind: "number"
192480
+ }
192481
+ }]
191489
192482
  }]
191490
192483
  }),
191491
192484
  /** Silence the siren now. */
@@ -192776,6 +193769,27 @@ var SwitchStatusSchema = object({
192776
193769
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
192777
193770
  lastChangedAt: number$1()
192778
193771
  });
193772
+ /**
193773
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
193774
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
193775
+ *
193776
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
193777
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
193778
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
193779
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
193780
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
193781
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
193782
+ * read that failed or is pending changes nothing (D315).
193783
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
193784
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
193785
+ * `power-source.forceRestart` uses it instead of off / wait / on.
193786
+ */
193787
+ var SwitchOptionsSchema = object({
193788
+ supportsSetState: boolean().default(true),
193789
+ supportsPowerCycle: boolean().default(false)
193790
+ });
193791
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
193792
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
192779
193793
  var switchCapability = {
192780
193794
  name: "switch",
192781
193795
  scope: "device",
@@ -192803,7 +193817,8 @@ var switchCapability = {
192803
193817
  field: "on",
192804
193818
  value: true
192805
193819
  },
192806
- args: { on: true }
193820
+ args: { on: true },
193821
+ offeredWhen: SWITCH_SETTABLE_GATE
192807
193822
  }, {
192808
193823
  id: "switch.off",
192809
193824
  label: t("Turn off", "Spegni"),
@@ -192813,9 +193828,16 @@ var switchCapability = {
192813
193828
  field: "on",
192814
193829
  value: false
192815
193830
  },
192816
- args: { on: false }
193831
+ args: { on: false },
193832
+ offeredWhen: SWITCH_SETTABLE_GATE
192817
193833
  }]
192818
193834
  }),
193835
+ getOptions: optionalMethod(object({ deviceId: number$1() }), SwitchOptionsSchema, { auth: "protected" }),
193836
+ powerCycle: optionalMethod(object({ deviceId: number$1() }), _void(), {
193837
+ kind: "mutation",
193838
+ auth: "protected",
193839
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
193840
+ }),
192819
193841
  toggle: optionalMethod(object({ deviceId: number$1() }), _void(), {
192820
193842
  kind: "mutation",
192821
193843
  auth: "protected",
@@ -192823,7 +193845,8 @@ var switchCapability = {
192823
193845
  id: "switch.toggle",
192824
193846
  label: t("Toggle", "Commuta"),
192825
193847
  phrase: t("Toggle {device}", "Commuta {device}"),
192826
- icon: "toggle-right"
193848
+ icon: "toggle-right",
193849
+ offeredWhen: SWITCH_SETTABLE_GATE
192827
193850
  }]
192828
193851
  })
192829
193852
  },
@@ -192845,6 +193868,16 @@ var switchCapability = {
192845
193868
  * not need to re-query the provider after a setState mutation.
192846
193869
  */
192847
193870
  runtimeState: SwitchStatusSchema,
193871
+ composedMethods: {
193872
+ getOptions: {
193873
+ kind: "answer",
193874
+ value: SWITCH_DEFAULT_OPTIONS
193875
+ },
193876
+ powerCycle: {
193877
+ kind: "refuse",
193878
+ reason: "a composed switch has no native power cycle"
193879
+ }
193880
+ },
192848
193881
  /**
192849
193882
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
192850
193883
  *
@@ -193018,6 +194051,26 @@ var switchCapability = {
193018
194051
  "switch.off": { icon: "plug" }
193019
194052
  },
193020
194053
  state: { on: { icon: "plug-zap" } }
194054
+ },
194055
+ [DeviceRole.PoePort]: {
194056
+ actions: {
194057
+ "switch.on": {
194058
+ label: t("Power on", "Alimenta"),
194059
+ phrase: t("Power on {device}", "Alimenta {device}"),
194060
+ icon: "plug-zap"
194061
+ },
194062
+ "switch.off": {
194063
+ label: t("Power off", "Togli alimentazione"),
194064
+ phrase: t("Power off {device}", "Togli alimentazione a {device}"),
194065
+ icon: "unplug"
194066
+ }
194067
+ },
194068
+ state: { on: {
194069
+ label: t("Powered", "Alimentata"),
194070
+ whenTrue: t("When {device} is powered", "Quando {device} viene alimentata"),
194071
+ whenFalse: t("When {device} loses power", "Quando {device} perde l’alimentazione"),
194072
+ icon: "plug-zap"
194073
+ } }
193021
194074
  }
193022
194075
  }
193023
194076
  }
@@ -193607,10 +194660,11 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
193607
194660
  /**
193608
194661
  * tags — the registry of tag STYLES and the one place that renames or removes a
193609
194662
  * tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
193610
- * labels (a core block, a scheduler, a template, an action, a device); only its
194663
+ * labels (a core block, a scheduler, a template, an action, a device, a
194664
+ * notification rule); only its
193611
194665
  * colour token and icon are registered here. Provided by the core-blocks builtin,
193612
- * the one place that knows every owner kind; devices are reached through
193613
- * `deviceManager` over `ctx.api`.
194666
+ * the one place that knows every owner kind; devices and notification rules
194667
+ * are reached through `deviceManager` / `notificationRules` over `ctx.api`.
193614
194668
  *
193615
194669
  * Tags compare trimmed and case-insensitively. `list` is the union of styled tags
193616
194670
  * and tags in use; a tag with no style answers a colour derived from its name and
@@ -193621,7 +194675,21 @@ var TagUsageCountsSchema = object({
193621
194675
  schedulers: number$1().int().nonnegative(),
193622
194676
  templates: number$1().int().nonnegative(),
193623
194677
  actions: number$1().int().nonnegative(),
193624
- devices: number$1().int().nonnegative()
194678
+ devices: number$1().int().nonnegative(),
194679
+ notificationRules: number$1().int().nonnegative()
194680
+ });
194681
+ /**
194682
+ * The counts `list` answers. An owner that could not be read (a forked addon
194683
+ * that is down, redeploying or not installed) is `null` — unknown, never `0`
194684
+ * (D393) — and `list` still answers with the other owners' tags.
194685
+ */
194686
+ var TagListCountsSchema = object({
194687
+ coreBlocks: number$1().int().nonnegative().nullable(),
194688
+ schedulers: number$1().int().nonnegative().nullable(),
194689
+ templates: number$1().int().nonnegative().nullable(),
194690
+ actions: number$1().int().nonnegative().nullable(),
194691
+ devices: number$1().int().nonnegative().nullable(),
194692
+ notificationRules: number$1().int().nonnegative().nullable()
193625
194693
  });
193626
194694
  var TagEntrySchema = object({
193627
194695
  name: TagNameSchema,
@@ -193629,7 +194697,8 @@ var TagEntrySchema = object({
193629
194697
  icon: IconKeySchema,
193630
194698
  /** `false` when the operator never chose a style: colour and icon are the derived defaults. */
193631
194699
  styled: boolean(),
193632
- counts: TagUsageCountsSchema
194700
+ /** Per owner kind; `null` = that owner could not be read on this call. */
194701
+ counts: TagListCountsSchema
193633
194702
  });
193634
194703
  method(object({}), array(TagEntrySchema), { auth: "protected" }), method(object({
193635
194704
  name: TagNameSchema,
@@ -194170,7 +195239,6 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
194170
195239
  });
194171
195240
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
194172
195241
  var ProfileSettingsSchemaBridge = unknown().nullable();
194173
- var ProfileSettingsBagSchema = record(string(), unknown());
194174
195242
  /**
194175
195243
  * A live terminal session hosted by the provider addon. Output and input do
194176
195244
  * NOT flow through the capability — they use the addon data plane
@@ -194189,7 +195257,11 @@ var TerminalSessionInfoSchema = object({
194189
195257
  cols: number$1().int().positive(),
194190
195258
  rows: number$1().int().positive(),
194191
195259
  /** ms-epoch the session's pty was spawned. */
194192
- startedAt: number$1()
195260
+ startedAt: number$1(),
195261
+ /** User id of the admin who opened it; `unattributed` when the caller was not passed. */
195262
+ openedBy: string().optional(),
195263
+ /** ms-epoch of the last pty input or output — what the idle timeout measures. */
195264
+ lastActivityAt: number$1().optional()
194193
195265
  });
194194
195266
  /**
194195
195267
  * A profile the operator may open — a pre-declared, allowlisted program
@@ -194209,39 +195281,6 @@ var TerminalProfileInfoSchema = object({
194209
195281
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
194210
195282
  settingsSchema: ProfileSettingsSchemaBridge.optional()
194211
195283
  });
194212
- /**
194213
- * A durable operator-created Terminal instance. Profiles are templates; only
194214
- * an instance declares a camera.
194215
- */
194216
- var TerminalInstanceInfoSchema = object({
194217
- instanceId: string(),
194218
- cameraStableId: string(),
194219
- nodeId: string(),
194220
- /**
194221
- * False while the node the instance is bound to is not in the cluster
194222
- * topology (forgotten, renamed, re-paired). The instance is kept; the
194223
- * operator re-points it on the Terminal page.
194224
- */
194225
- nodeInCluster: boolean(),
194226
- profileId: string(),
194227
- profileLabel: string(),
194228
- name: string(),
194229
- enabled: boolean(),
194230
- executable: string(),
194231
- args: array(string()).readonly(),
194232
- cwd: string(),
194233
- environment: array(string()).readonly(),
194234
- profileSettings: ProfileSettingsBagSchema
194235
- });
194236
- var TerminalLegacyCameraSchema = object({
194237
- stableId: string(),
194238
- nodeId: string(),
194239
- profileId: string(),
194240
- profileLabel: string(),
194241
- name: string(),
194242
- /** Only legacy monitor cameras can retain their historic stable identity. */
194243
- adoptable: boolean()
194244
- });
194245
195284
  var TerminalOutputEventSchema = discriminatedUnion("kind", [object({
194246
195285
  seq: number$1().int().positive(),
194247
195286
  kind: literal("data"),
@@ -194269,13 +195308,7 @@ var TerminalOutputBatchSchema = object({
194269
195308
  snapshot: string().optional(),
194270
195309
  events: array(TerminalOutputEventSchema).readonly()
194271
195310
  });
194272
- method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }), method(object({
194273
- stableId: string().min(1),
194274
- name: string().trim().min(1).max(160).optional()
194275
- }), TerminalInstanceInfoSchema, {
194276
- kind: "mutation",
194277
- auth: "admin"
194278
- }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
195311
+ method(_void(), array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }), method(_void(), array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }), method(_void(), ServerShellStatusSchema, { auth: "admin" }), method(object({
194279
195312
  profileId: string(),
194280
195313
  cols: number$1().int().positive(),
194281
195314
  rows: number$1().int().positive(),
@@ -196993,6 +198026,427 @@ DeviceType.Camera, method(object({ deviceId: number$1().int().nonnegative() }),
196993
198026
  deviceId: number$1().int().nonnegative(),
196994
198027
  sessionId: string()
196995
198028
  }), WebrtcSessionDebugSchema, { kind: "query" });
198029
+ var WorkloadStateSchema = _enum([
198030
+ "running",
198031
+ "paused",
198032
+ "stopped",
198033
+ "starting",
198034
+ "stopping",
198035
+ "crashed"
198036
+ ]);
198037
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
198038
+ var WORKLOAD_ROLES = [
198039
+ DeviceRole.Vm,
198040
+ DeviceRole.AppContainer,
198041
+ DeviceRole.Lxc,
198042
+ DeviceRole.App,
198043
+ DeviceRole.Host
198044
+ ];
198045
+ /**
198046
+ * What the workload uses. Every value is `null` when not reported (D393). A host
198047
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
198048
+ */
198049
+ var WorkloadResourcesSchema = object({
198050
+ /** CPU use, percent of the CPUs it may use (0–100). */
198051
+ cpuPercent: number$1().nullable().meta(readingMeta("percentage", { precision: 1 })),
198052
+ memoryUsedBytes: number$1().nullable().meta(readingMeta("information")),
198053
+ /**
198054
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
198055
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
198056
+ */
198057
+ memoryPercent: number$1().nullable().optional().meta(readingMeta("percentage", { precision: 1 })),
198058
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
198059
+ memoryLimitBytes: number$1().nullable().meta(readingMeta("information")),
198060
+ vcpus: number$1().nullable().meta(readingMeta("count")),
198061
+ diskUsedBytes: number$1().nullable().meta(readingMeta("information")),
198062
+ diskTotalBytes: number$1().nullable().meta(readingMeta("information")),
198063
+ /** Network received, kbit/s. */
198064
+ netRxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198065
+ /** Network sent, kbit/s. */
198066
+ netTxKbps: number$1().nullable().meta(readingMeta("bitrate")),
198067
+ /** One-minute load average (a host). */
198068
+ load1: number$1().nullable().meta(readingMeta("index", { precision: 2 })),
198069
+ /** CPU / board temperature (a host). */
198070
+ temperature: number$1().nullable().meta(readingMeta("temperature", { precision: 1 }))
198071
+ });
198072
+ var WorkloadPortProtocolSchema = _enum(["tcp", "udp"]);
198073
+ /** One published port: the workload's own port and where the host exposes it. */
198074
+ var WorkloadPortSchema = object({
198075
+ port: number$1().int().meta(readingMeta("none")),
198076
+ /** The host port it is published on; null = not published. */
198077
+ hostPort: number$1().int().nullable().meta(readingMeta("none")),
198078
+ /** The host address it is bound to; null = every address. */
198079
+ hostIp: string().nullable(),
198080
+ protocol: WorkloadPortProtocolSchema
198081
+ });
198082
+ var WorkloadStatusSchema = object({
198083
+ /** null = unknown, never stopped (D393). */
198084
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
198085
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
198086
+ since: number$1().nullable().meta(readingMeta("none")),
198087
+ /** The `host` device this runs on, when the provider has adopted it. */
198088
+ hostDeviceId: number$1().int().nullable().meta(readingMeta("device")),
198089
+ /** The image a container runs (`nginx:1.27`). */
198090
+ image: string().nullable(),
198091
+ /** The operating system (a VM, an LXC, a host). */
198092
+ os: string().nullable(),
198093
+ /** The version or firmware it runs. */
198094
+ version: string().nullable(),
198095
+ /** Starts with its host; null when the platform does not say. */
198096
+ autostart: boolean().nullable(),
198097
+ resources: WorkloadResourcesSchema,
198098
+ ports: array(WorkloadPortSchema),
198099
+ /** The addresses it is reachable on (IPs or host names). */
198100
+ addresses: array(string()),
198101
+ /** A newer image / version exists. Installing it stays the `update` cap. */
198102
+ updateAvailable: boolean().nullable(),
198103
+ lastFetchedAt: number$1()
198104
+ });
198105
+ /**
198106
+ * What this device can do, probed by its provider (D14 honesty): a flag is
198107
+ * `true` only when the platform really serves it for THIS device.
198108
+ */
198109
+ var WorkloadOptionsSchema = object({
198110
+ supportsStart: boolean(),
198111
+ supportsStop: boolean(),
198112
+ supportsRestart: boolean(),
198113
+ /** Pause AND resume. */
198114
+ supportsPause: boolean(),
198115
+ supportsForceStop: boolean(),
198116
+ hasResources: boolean(),
198117
+ hasPorts: boolean(),
198118
+ hasAddresses: boolean(),
198119
+ hasAutostart: boolean(),
198120
+ hasUpdateCheck: boolean()
198121
+ });
198122
+ var WorkloadDeviceInputSchema = object({ deviceId: number$1().int().nonnegative() });
198123
+ var WorkloadTransitionEventDataSchema = object({
198124
+ deviceId: number$1(),
198125
+ state: WorkloadStateSchema,
198126
+ previous: WorkloadStateSchema,
198127
+ since: number$1().nullable()
198128
+ });
198129
+ EventCategory.WorkloadStarted, EventCategory.WorkloadStopped, EventCategory.WorkloadCrashed, EventCategory.WorkloadRecovered;
198130
+ var workloadCapability = {
198131
+ name: "workload",
198132
+ scope: "device",
198133
+ deviceNative: true,
198134
+ mode: "singleton",
198135
+ deviceTypes: [DeviceType.Workload],
198136
+ deviceRoles: { [DeviceType.Workload]: WORKLOAD_ROLES },
198137
+ /**
198138
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
198139
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
198140
+ * second on/off state. A device whose provider serves no start / stop gets no
198141
+ * switch.
198142
+ */
198143
+ power: {
198144
+ kind: "methods",
198145
+ field: "state",
198146
+ offValues: ["stopped", "crashed"],
198147
+ on: "start",
198148
+ off: "stop"
198149
+ },
198150
+ methods: {
198151
+ start: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198152
+ kind: "mutation",
198153
+ auth: "protected",
198154
+ actions: [{
198155
+ id: "workload.start",
198156
+ label: t("Start", "Avvia"),
198157
+ phrase: t("Start {device}", "Avvia {device}"),
198158
+ icon: "play",
198159
+ effect: {
198160
+ field: "state",
198161
+ value: "running"
198162
+ }
198163
+ }]
198164
+ }),
198165
+ stop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198166
+ kind: "mutation",
198167
+ auth: "protected",
198168
+ actions: [{
198169
+ id: "workload.stop",
198170
+ label: t("Stop", "Arresta"),
198171
+ phrase: t("Stop {device}", "Arresta {device}"),
198172
+ icon: "square",
198173
+ effect: {
198174
+ field: "state",
198175
+ value: "stopped"
198176
+ }
198177
+ }]
198178
+ }),
198179
+ restart: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198180
+ kind: "mutation",
198181
+ auth: "protected",
198182
+ actions: [{
198183
+ id: "workload.restart",
198184
+ label: t("Restart", "Riavvia"),
198185
+ phrase: t("Restart {device}", "Riavvia {device}"),
198186
+ icon: "rotate-ccw"
198187
+ }]
198188
+ }),
198189
+ pause: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198190
+ kind: "mutation",
198191
+ auth: "protected",
198192
+ actions: [{
198193
+ id: "workload.pause",
198194
+ label: t("Pause", "Metti in pausa"),
198195
+ phrase: t("Pause {device}", "Metti in pausa {device}"),
198196
+ icon: "pause",
198197
+ effect: {
198198
+ field: "state",
198199
+ value: "paused"
198200
+ }
198201
+ }]
198202
+ }),
198203
+ resume: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198204
+ kind: "mutation",
198205
+ auth: "protected",
198206
+ actions: [{
198207
+ id: "workload.resume",
198208
+ label: t("Resume", "Riprendi"),
198209
+ phrase: t("Resume {device}", "Riprendi {device}"),
198210
+ icon: "circle-play",
198211
+ effect: {
198212
+ field: "state",
198213
+ value: "running"
198214
+ }
198215
+ }]
198216
+ }),
198217
+ forceStop: optionalMethod(WorkloadDeviceInputSchema, _void(), {
198218
+ kind: "mutation",
198219
+ auth: "admin",
198220
+ actions: [{
198221
+ id: "workload.forceStop",
198222
+ label: t("Force stop", "Arresto forzato"),
198223
+ phrase: t("Force {device} to stop", "Forza l’arresto di {device}"),
198224
+ icon: "octagon-x",
198225
+ effect: {
198226
+ field: "state",
198227
+ value: "stopped"
198228
+ }
198229
+ }]
198230
+ }),
198231
+ /** What THIS device can do, probed — the UI is derived from it. */
198232
+ getOptions: method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
198233
+ },
198234
+ events: {
198235
+ onStarted: {
198236
+ data: WorkloadTransitionEventDataSchema,
198237
+ trigger: {
198238
+ category: EventCategory.WorkloadStarted,
198239
+ label: t("Started", "Avviato"),
198240
+ phrase: t("When {device} starts", "Quando {device} si avvia"),
198241
+ icon: "play"
198242
+ }
198243
+ },
198244
+ onStopped: {
198245
+ data: WorkloadTransitionEventDataSchema,
198246
+ trigger: {
198247
+ category: EventCategory.WorkloadStopped,
198248
+ label: t("Stopped", "Arrestato"),
198249
+ phrase: t("When {device} stops", "Quando {device} si arresta"),
198250
+ icon: "square"
198251
+ }
198252
+ },
198253
+ onCrashed: {
198254
+ data: WorkloadTransitionEventDataSchema,
198255
+ trigger: {
198256
+ category: EventCategory.WorkloadCrashed,
198257
+ label: t("Crashed", "Arrestato in modo anomalo"),
198258
+ phrase: t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
198259
+ icon: "triangle-alert"
198260
+ }
198261
+ },
198262
+ onRecovered: {
198263
+ data: WorkloadTransitionEventDataSchema,
198264
+ trigger: {
198265
+ category: EventCategory.WorkloadRecovered,
198266
+ label: t("Recovered", "Ripristinato"),
198267
+ phrase: t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
198268
+ icon: "heart-pulse"
198269
+ }
198270
+ }
198271
+ },
198272
+ status: {
198273
+ schema: WorkloadStatusSchema,
198274
+ kind: "poll"
198275
+ },
198276
+ runtimeState: WorkloadStatusSchema,
198277
+ /**
198278
+ * Runtime-state durability: **session** — the provider answers on its next
198279
+ * poll; the series are recorded, so a restart that clears the slice loses
198280
+ * nothing a reader needs. The events are judged from the first state seen.
198281
+ */
198282
+ durability: "session",
198283
+ /**
198284
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
198285
+ * the charts need no per-metric child device.
198286
+ */
198287
+ history: {
198288
+ primary: "resources.cpuPercent",
198289
+ priority: 40,
198290
+ fields: {
198291
+ state: { kind: "enum" },
198292
+ "resources.cpuPercent": {
198293
+ kind: "gauge",
198294
+ unit: "%",
198295
+ deadband: 2,
198296
+ displayName: "CPU"
198297
+ },
198298
+ "resources.memoryUsedBytes": {
198299
+ kind: "gauge",
198300
+ unit: "bytes",
198301
+ displayName: "Memory used"
198302
+ },
198303
+ "resources.memoryPercent": {
198304
+ kind: "gauge",
198305
+ unit: "%",
198306
+ deadband: 2,
198307
+ displayName: "Memory"
198308
+ },
198309
+ "resources.netRxKbps": {
198310
+ group: "network",
198311
+ kind: "gauge",
198312
+ unit: "kbps",
198313
+ displayName: "Network received"
198314
+ },
198315
+ "resources.netTxKbps": {
198316
+ group: "network",
198317
+ kind: "gauge",
198318
+ unit: "kbps",
198319
+ displayName: "Network sent"
198320
+ }
198321
+ }
198322
+ },
198323
+ volatileStateFields: ["lastFetchedAt"],
198324
+ vocabulary: {
198325
+ noun: t("Workload", "Carico di lavoro"),
198326
+ order: 2400,
198327
+ state: [
198328
+ {
198329
+ kind: "enum",
198330
+ field: "state",
198331
+ label: t("State", "Stato"),
198332
+ values: [
198333
+ {
198334
+ value: "running",
198335
+ label: t("Running", "In esecuzione"),
198336
+ phrase: t("When {device} is running", "Quando {device} è in esecuzione")
198337
+ },
198338
+ {
198339
+ value: "paused",
198340
+ label: t("Paused", "In pausa")
198341
+ },
198342
+ {
198343
+ value: "stopped",
198344
+ label: t("Stopped", "Arrestato"),
198345
+ phrase: t("When {device} is stopped", "Quando {device} è arrestato")
198346
+ },
198347
+ {
198348
+ value: "starting",
198349
+ label: t("Starting", "In avvio")
198350
+ },
198351
+ {
198352
+ value: "stopping",
198353
+ label: t("Stopping", "In arresto")
198354
+ },
198355
+ {
198356
+ value: "crashed",
198357
+ label: t("Crashed", "Arrestato in modo anomalo"),
198358
+ phrase: t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
198359
+ }
198360
+ ],
198361
+ icon: "activity"
198362
+ },
198363
+ {
198364
+ kind: "numeric",
198365
+ field: "resources.cpuPercent",
198366
+ quantity: t("the CPU use", "l'uso della CPU"),
198367
+ label: t("CPU", "CPU"),
198368
+ unit: "%",
198369
+ icon: "cpu"
198370
+ },
198371
+ {
198372
+ kind: "numeric",
198373
+ field: "resources.memoryPercent",
198374
+ quantity: t("the memory use", "l'uso della memoria"),
198375
+ label: t("Memory", "Memoria"),
198376
+ unit: "%",
198377
+ icon: "memory-stick"
198378
+ },
198379
+ {
198380
+ kind: "numeric",
198381
+ field: "resources.temperature",
198382
+ quantity: t("the temperature", "la temperatura"),
198383
+ label: t("Temperature", "Temperatura"),
198384
+ unit: "°C",
198385
+ icon: "thermometer"
198386
+ }
198387
+ ],
198388
+ overrides: { byRole: {
198389
+ [DeviceRole.Vm]: {
198390
+ actions: { "workload.start": { icon: "monitor" } },
198391
+ state: { state: { icon: "monitor" } }
198392
+ },
198393
+ [DeviceRole.AppContainer]: {
198394
+ actions: { "workload.start": { icon: "container" } },
198395
+ state: { state: { icon: "container" } }
198396
+ },
198397
+ [DeviceRole.Lxc]: {
198398
+ actions: { "workload.start": { icon: "box" } },
198399
+ state: { state: { icon: "box" } }
198400
+ },
198401
+ [DeviceRole.App]: {
198402
+ actions: { "workload.start": { icon: "app-window" } },
198403
+ state: { state: { icon: "app-window" } }
198404
+ },
198405
+ [DeviceRole.Host]: {
198406
+ actions: {
198407
+ "workload.start": {
198408
+ label: t("Power on", "Accendi"),
198409
+ phrase: t("Power on {device}", "Accendi {device}"),
198410
+ icon: "power"
198411
+ },
198412
+ "workload.stop": {
198413
+ label: t("Shut down", "Spegni"),
198414
+ phrase: t("Shut down {device}", "Spegni {device}"),
198415
+ icon: "power-off"
198416
+ },
198417
+ "workload.restart": {
198418
+ label: t("Reboot", "Riavvia"),
198419
+ phrase: t("Reboot {device}", "Riavvia {device}"),
198420
+ icon: "refresh-cw"
198421
+ }
198422
+ },
198423
+ state: { state: { icon: "server" } },
198424
+ events: {
198425
+ onStarted: {
198426
+ label: t("Came online", "Tornato in linea"),
198427
+ phrase: t("When {device} comes online", "Quando {device} torna in linea"),
198428
+ icon: "server"
198429
+ },
198430
+ onStopped: {
198431
+ label: t("Shut down", "Spento"),
198432
+ phrase: t("When {device} shuts down", "Quando {device} si spegne"),
198433
+ icon: "server-off"
198434
+ },
198435
+ onCrashed: {
198436
+ label: t("Went down", "Caduto"),
198437
+ phrase: t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
198438
+ icon: "server-crash"
198439
+ },
198440
+ onRecovered: {
198441
+ label: t("Came online", "Tornato in linea"),
198442
+ phrase: t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
198443
+ icon: "server"
198444
+ }
198445
+ }
198446
+ }
198447
+ } }
198448
+ }
198449
+ };
196996
198450
  /**
196997
198451
  * Per-zone occupancy aggregation produced by the analytics frame
196998
198452
  * processor on every inference result. Covers the full combinatorial
@@ -197613,34 +199067,36 @@ var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_K
197613
199067
  * Pure duration maths for the `siren` cap, shared by every provider so a
197614
199068
  * trigger and the countdown it publishes mean the same thing everywhere.
197615
199069
  */
199070
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
199071
+ var MAX_PLAY_CHOICES = 200;
197616
199072
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
197617
199073
  function sirenIdleStatus(previous) {
197618
199074
  return {
197619
199075
  active: false,
197620
199076
  activeUntil: null,
197621
199077
  durationSeconds: previous?.durationSeconds ?? null,
199078
+ plays: previous?.plays ?? null,
199079
+ activeUntilEstimated: false,
197622
199080
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
197623
199081
  };
197624
199082
  }
197625
- /** The state right after a timed trigger: sounding until `now + seconds`. */
197626
- function sirenTriggeredStatus(nowMs, seconds) {
199083
+ /**
199084
+ * The state right after a timed trigger: sounding until `now + seconds`. A
199085
+ * trigger asked in plays passes its count, and whether that end is an estimate.
199086
+ */
199087
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
197627
199088
  return {
197628
199089
  active: true,
197629
199090
  activeUntil: nowMs + Math.round(seconds * 1e3),
197630
199091
  durationSeconds: seconds,
199092
+ plays: activation?.plays ?? null,
199093
+ activeUntilEstimated: activation?.estimated ?? false,
197631
199094
  lastTriggeredAt: nowMs
197632
199095
  };
197633
199096
  }
197634
- /**
197635
- * The duration a trigger will really use: the request (or the camera default)
197636
- * snapped to what the camera allows — the nearest listed value, or clamped and
197637
- * stepped inside the range. Never longer or shorter than the camera can play.
197638
- */
197639
- function resolveSirenSeconds(options, requested) {
197640
- const wanted = requested ?? options.defaultSeconds;
197641
- const list = options.allowedSeconds;
199097
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
199098
+ function snap(list, range, wanted) {
197642
199099
  if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
197643
- const range = options.rangeSeconds;
197644
199100
  if (range !== null) {
197645
199101
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
197646
199102
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -197649,6 +199105,60 @@ function resolveSirenSeconds(options, requested) {
197649
199105
  return wanted;
197650
199106
  }
197651
199107
  /**
199108
+ * The duration a trigger will really use: the request (or the camera default)
199109
+ * snapped to what the camera allows — the nearest listed value, or clamped and
199110
+ * stepped inside the range. Never longer or shorter than the camera can play.
199111
+ */
199112
+ function resolveSirenSeconds(options, requested) {
199113
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
199114
+ }
199115
+ /**
199116
+ * The play count a trigger will really use, snapped like the seconds; `null`
199117
+ * when the camera declares no plays (it counts seconds).
199118
+ */
199119
+ function resolveSirenPlays(options, requested) {
199120
+ if (options.defaultPlays === null) return null;
199121
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
199122
+ }
199123
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
199124
+ function sirenPlayChoices(options) {
199125
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
199126
+ const range = options.rangePlays;
199127
+ if (range === null) return [];
199128
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
199129
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
199130
+ }
199131
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
199132
+ function playsEndIsEstimate(options) {
199133
+ return options.source !== SirenOptionsSource.Camera;
199134
+ }
199135
+ /**
199136
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
199137
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
199138
+ * snapping. Never both — the input schema refuses that before it gets here.
199139
+ */
199140
+ function planSirenTrigger(options, request) {
199141
+ if (request.plays !== void 0) {
199142
+ const plays = resolveSirenPlays(options, request.plays);
199143
+ if (plays === null) return {
199144
+ asked: "refused",
199145
+ reason: "this siren counts seconds, not plays"
199146
+ };
199147
+ const factor = options.secondsPerPlay;
199148
+ return {
199149
+ asked: "plays",
199150
+ plays,
199151
+ seconds: factor === null ? null : plays * factor,
199152
+ estimated: factor === null || playsEndIsEstimate(options)
199153
+ };
199154
+ }
199155
+ return {
199156
+ asked: "seconds",
199157
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
199158
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
199159
+ };
199160
+ }
199161
+ /**
197652
199162
  * Day-of-week names in the cap's index order (0 = Monday), for messages
197653
199163
  * an operator reads and for Hikvision's `<DayOfWeek>` element.
197654
199164
  */
@@ -198727,11 +200237,65 @@ var DEVICE_LOCAL_STATE_CAPS = {
198727
200237
  waterHeater: waterHeaterCapability,
198728
200238
  weather: weatherCapability,
198729
200239
  weatherStation: weatherStationCapability,
200240
+ workload: workloadCapability,
198730
200241
  zoneAnalytics: zoneAnalyticsCapability,
198731
200242
  zoneRules: zoneRulesCapability,
198732
200243
  zones: zonesCapability
198733
200244
  };
198734
200245
  /**
200246
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
200247
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
200248
+ * read keeps what was stored) — pass everything the provider read in one call.
200249
+ */
200250
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
200251
+ const { deviceId, logger, writer } = deps;
200252
+ const { unread, ...normaliseOptions } = options;
200253
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
200254
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
200255
+ tags: { deviceId },
200256
+ meta: {
200257
+ key: r.key,
200258
+ value: r.value,
200259
+ reason: r.reason
200260
+ }
200261
+ });
200262
+ const unreadKinds = new Set(unread ?? []);
200263
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
200264
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
200265
+ return {
200266
+ outcome: "nothing-to-declare",
200267
+ identifiers
200268
+ };
200269
+ }
200270
+ if (writer === void 0) {
200271
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
200272
+ return {
200273
+ outcome: "unavailable",
200274
+ identifiers
200275
+ };
200276
+ }
200277
+ try {
200278
+ await writer.mutate({
200279
+ deviceId,
200280
+ identifiers,
200281
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
200282
+ });
200283
+ return {
200284
+ outcome: "declared",
200285
+ identifiers
200286
+ };
200287
+ } catch (err) {
200288
+ logger.warn("identifiers not declared — setIdentifiers failed", {
200289
+ tags: { deviceId },
200290
+ meta: { error: errMsg$3(err) }
200291
+ });
200292
+ return {
200293
+ outcome: "failed",
200294
+ identifiers
200295
+ };
200296
+ }
200297
+ }
200298
+ /**
198735
200299
  * The edge between two readings, or `null` for no edge.
198736
200300
  *
198737
200301
  * - `null`/cold → `true` is a START (a fault already open at boot is one);
@@ -198783,6 +200347,8 @@ var BaseDevice = class {
198783
200347
  id;
198784
200348
  stableId;
198785
200349
  type;
200350
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
200351
+ statusIsExternal;
198786
200352
  name;
198787
200353
  parentDeviceId;
198788
200354
  role;
@@ -198931,21 +200497,26 @@ var BaseDevice = class {
198931
200497
  };
198932
200498
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
198933
200499
  ctx.bindRuntimeState?.(this.runtimeState);
198934
- ctx.registerNativeCap?.(deviceStatusCapability, {});
198935
- const seed = {
198936
- online: true,
198937
- lastChangedAt: Date.now()
198938
- };
198939
- this.runtimeState.setCapState("device-status", seed);
198940
- ctx.registerNativeCap?.(featureProbeCapability, {});
198941
- this.runtimeState.setCapState("feature-probe", {
198942
- flags: {},
198943
- deviceType: null,
198944
- model: null,
198945
- channelCount: null,
198946
- lastProbedAt: 0,
198947
- lastFetchedAt: 0
198948
- });
200500
+ this.statusIsExternal = options.deviceStatus === "external";
200501
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
200502
+ if (!this.statusIsExternal) {
200503
+ const seed = {
200504
+ online: true,
200505
+ lastChangedAt: Date.now()
200506
+ };
200507
+ this.runtimeState.setCapState("device-status", seed);
200508
+ }
200509
+ if (!this.statusIsExternal) {
200510
+ ctx.registerNativeCap?.(featureProbeCapability, {});
200511
+ this.runtimeState.setCapState("feature-probe", {
200512
+ flags: {},
200513
+ deviceType: null,
200514
+ model: null,
200515
+ channelCount: null,
200516
+ lastProbedAt: 0,
200517
+ lastFetchedAt: 0
200518
+ });
200519
+ }
198949
200520
  }
198950
200521
  deviceActions = /* @__PURE__ */ new Map();
198951
200522
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -198973,7 +200544,7 @@ var BaseDevice = class {
198973
200544
  * override to gate side effects on the transition.
198974
200545
  */
198975
200546
  markOnline(online) {
198976
- if (this.online === online) return;
200547
+ if (this.statusIsExternal || this.online === online) return;
198977
200548
  const next = {
198978
200549
  online,
198979
200550
  lastChangedAt: Date.now()
@@ -199043,6 +200614,24 @@ var BaseDevice = class {
199043
200614
  }));
199044
200615
  }
199045
200616
  /**
200617
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
200618
+ * machine uuid, hostname, IP — what a later step matches across integrations.
200619
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
200620
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
200621
+ * only from the provider that owns this device. Each kind it carries replaces
200622
+ * the stored one and each kind it lacks is removed — except the kinds listed in
200623
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
200624
+ * everything read in one call; a call where every kind is unread writes
200625
+ * nothing. Best-effort: never throws.
200626
+ */
200627
+ async declareIdentifiers(raw, options) {
200628
+ return declareDeviceIdentifiers({
200629
+ deviceId: this.id,
200630
+ logger: this.ctx.logger,
200631
+ writer: this.ctx.api.deviceManager?.setIdentifiers
200632
+ }, raw, options);
200633
+ }
200634
+ /**
199046
200635
  * Re-publish the device's current `features` array to the persisted
199047
200636
  * meta blob. Drivers call this after a probe finishes when the live
199048
200637
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -199247,6 +200836,7 @@ var BaseDevice = class {
199247
200836
  * `lastProbedAt`) once their probe actually succeeds.
199248
200837
  */
199249
200838
  async onProbe() {
200839
+ if (this.statusIsExternal) return;
199250
200840
  const base = this.runtimeState.getCapState("feature-probe") ?? {
199251
200841
  flags: {},
199252
200842
  deviceType: null,
@@ -200087,7 +201677,7 @@ var BaseDeviceProvider = class extends BaseAddon {
200087
201677
  }
200088
201678
  };
200089
201679
  DeviceType.HeatPump;
200090
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
201680
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
200091
201681
  new Set(Object.values(DeviceType));
200092
201682
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
200093
201683
  function contribution(cap, schema, build) {
@@ -202143,7 +203733,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
202143
203733
  ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
202144
203734
  ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
202145
203735
  ];
202146
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
203736
+ DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
202147
203737
  /**
202148
203738
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
202149
203739
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -202787,8 +204377,8 @@ lookOf({
202787
204377
  standby: MUTED
202788
204378
  });
202789
204379
  DeviceType.Climate;
202790
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
202791
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
204380
+ 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;
204381
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
202792
204382
  Object.freeze({
202793
204383
  "accessories.getStatus": {
202794
204384
  capName: "accessories",
@@ -205450,6 +207040,13 @@ Object.freeze({
205450
207040
  access: "create",
205451
207041
  role: "admin"
205452
207042
  },
207043
+ "deviceManager.setIdentifiers": {
207044
+ capName: "device-manager",
207045
+ capScope: "system",
207046
+ addonId: null,
207047
+ access: "create",
207048
+ role: "admin"
207049
+ },
205453
207050
  "deviceManager.setIntegrationId": {
205454
207051
  capName: "device-manager",
205455
207052
  capScope: "system",
@@ -208334,6 +209931,13 @@ Object.freeze({
208334
209931
  access: "view",
208335
209932
  role: "admin"
208336
209933
  },
209934
+ "notificationRules.listRuleTags": {
209935
+ capName: "notification-rules",
209936
+ capScope: "system",
209937
+ addonId: null,
209938
+ access: "view",
209939
+ role: "admin"
209940
+ },
208337
209941
  "notificationRules.listSnoozes": {
208338
209942
  capName: "notification-rules",
208339
209943
  capScope: "system",
@@ -208390,6 +209994,13 @@ Object.freeze({
208390
209994
  access: "create",
208391
209995
  role: "admin"
208392
209996
  },
209997
+ "notificationRules.setRuleTags": {
209998
+ capName: "notification-rules",
209999
+ capScope: "system",
210000
+ addonId: null,
210001
+ access: "create",
210002
+ role: "admin"
210003
+ },
208393
210004
  "notificationRules.testRule": {
208394
210005
  capName: "notification-rules",
208395
210006
  capScope: "system",
@@ -211358,6 +212969,13 @@ Object.freeze({
211358
212969
  access: "view",
211359
212970
  role: "viewer"
211360
212971
  },
212972
+ "siren.getPlayChoices": {
212973
+ capName: "siren",
212974
+ capScope: "device",
212975
+ addonId: null,
212976
+ access: "view",
212977
+ role: "viewer"
212978
+ },
211361
212979
  "siren.getStatus": {
211362
212980
  capName: "siren",
211363
212981
  capScope: "device",
@@ -212170,6 +213788,13 @@ Object.freeze({
212170
213788
  access: "view",
212171
213789
  role: "viewer"
212172
213790
  },
213791
+ "switch.getOptions": {
213792
+ capName: "switch",
213793
+ capScope: "device",
213794
+ addonId: null,
213795
+ access: "view",
213796
+ role: "viewer"
213797
+ },
212173
213798
  "switch.getStatus": {
212174
213799
  capName: "switch",
212175
213800
  capScope: "device",
@@ -212177,6 +213802,13 @@ Object.freeze({
212177
213802
  access: "view",
212178
213803
  role: "viewer"
212179
213804
  },
213805
+ "switch.powerCycle": {
213806
+ capName: "switch",
213807
+ capScope: "device",
213808
+ addonId: null,
213809
+ access: "create",
213810
+ role: "viewer"
213811
+ },
212180
213812
  "switch.setState": {
212181
213813
  capName: "switch",
212182
213814
  capScope: "device",
@@ -212380,13 +214012,6 @@ Object.freeze({
212380
214012
  access: "create",
212381
214013
  role: "admin"
212382
214014
  },
212383
- "terminalSession.adoptLegacyMonitor": {
212384
- capName: "terminal-session",
212385
- capScope: "system",
212386
- addonId: null,
212387
- access: "create",
212388
- role: "admin"
212389
- },
212390
214015
  "terminalSession.close": {
212391
214016
  capName: "terminal-session",
212392
214017
  capScope: "system",
@@ -212394,13 +214019,6 @@ Object.freeze({
212394
214019
  access: "create",
212395
214020
  role: "admin"
212396
214021
  },
212397
- "terminalSession.listLegacyCameras": {
212398
- capName: "terminal-session",
212399
- capScope: "system",
212400
- addonId: null,
212401
- access: "view",
212402
- role: "admin"
212403
- },
212404
214022
  "terminalSession.listProfiles": {
212405
214023
  capName: "terminal-session",
212406
214024
  capScope: "system",
@@ -213262,6 +214880,62 @@ Object.freeze({
213262
214880
  access: "view",
213263
214881
  role: "viewer"
213264
214882
  },
214883
+ "workload.forceStop": {
214884
+ capName: "workload",
214885
+ capScope: "device",
214886
+ addonId: null,
214887
+ access: "create",
214888
+ role: "admin"
214889
+ },
214890
+ "workload.getOptions": {
214891
+ capName: "workload",
214892
+ capScope: "device",
214893
+ addonId: null,
214894
+ access: "view",
214895
+ role: "viewer"
214896
+ },
214897
+ "workload.getStatus": {
214898
+ capName: "workload",
214899
+ capScope: "device",
214900
+ addonId: null,
214901
+ access: "view",
214902
+ role: "viewer"
214903
+ },
214904
+ "workload.pause": {
214905
+ capName: "workload",
214906
+ capScope: "device",
214907
+ addonId: null,
214908
+ access: "create",
214909
+ role: "viewer"
214910
+ },
214911
+ "workload.restart": {
214912
+ capName: "workload",
214913
+ capScope: "device",
214914
+ addonId: null,
214915
+ access: "create",
214916
+ role: "viewer"
214917
+ },
214918
+ "workload.resume": {
214919
+ capName: "workload",
214920
+ capScope: "device",
214921
+ addonId: null,
214922
+ access: "create",
214923
+ role: "viewer"
214924
+ },
214925
+ "workload.start": {
214926
+ capName: "workload",
214927
+ capScope: "device",
214928
+ addonId: null,
214929
+ access: "create",
214930
+ role: "viewer"
214931
+ },
214932
+ "workload.stop": {
214933
+ capName: "workload",
214934
+ capScope: "device",
214935
+ addonId: null,
214936
+ access: "create",
214937
+ role: "viewer"
214938
+ },
213265
214939
  "zoneAnalytics.getCameraHistory": {
213266
214940
  capName: "zone-analytics",
213267
214941
  capScope: "device",
@@ -213398,8 +215072,8 @@ function offered(received) {
213398
215072
  };
213399
215073
  }
213400
215074
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
213401
- DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
213402
- DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
215075
+ 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;
215076
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.SwitchLight, DeviceRole.PoePort, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter, DeviceRole.Vm, DeviceRole.AppContainer, DeviceRole.Lxc, DeviceRole.App, DeviceRole.Host;
213403
215077
  new Set(Object.values(DeviceType));
213404
215078
  new Set(Object.values(DeviceRole));
213405
215079
  var LAST_FETCHED_FIELD = "lastFetchedAt";
@@ -214253,6 +215927,11 @@ Object.freeze({
214253
215927
  form: "single",
214254
215928
  optional: false
214255
215929
  }],
215930
+ "deviceManager.setIdentifiers": [{
215931
+ name: "deviceId",
215932
+ form: "single",
215933
+ optional: false
215934
+ }],
214256
215935
  "deviceManager.setIntegrationId": [{
214257
215936
  name: "deviceId",
214258
215937
  form: "single",
@@ -216247,6 +217926,11 @@ Object.freeze({
216247
217926
  form: "single",
216248
217927
  optional: false
216249
217928
  }],
217929
+ "siren.getPlayChoices": [{
217930
+ name: "deviceId",
217931
+ form: "single",
217932
+ optional: false
217933
+ }],
216250
217934
  "siren.getStatus": [{
216251
217935
  name: "deviceId",
216252
217936
  form: "single",
@@ -216429,11 +218113,21 @@ Object.freeze({
216429
218113
  form: "single",
216430
218114
  optional: false
216431
218115
  }],
218116
+ "switch.getOptions": [{
218117
+ name: "deviceId",
218118
+ form: "single",
218119
+ optional: false
218120
+ }],
216432
218121
  "switch.getStatus": [{
216433
218122
  name: "deviceId",
216434
218123
  form: "single",
216435
218124
  optional: false
216436
218125
  }],
218126
+ "switch.powerCycle": [{
218127
+ name: "deviceId",
218128
+ form: "single",
218129
+ optional: false
218130
+ }],
216437
218131
  "switch.setState": [{
216438
218132
  name: "deviceId",
216439
218133
  form: "single",
@@ -216674,6 +218368,46 @@ Object.freeze({
216674
218368
  form: "single",
216675
218369
  optional: false
216676
218370
  }],
218371
+ "workload.forceStop": [{
218372
+ name: "deviceId",
218373
+ form: "single",
218374
+ optional: false
218375
+ }],
218376
+ "workload.getOptions": [{
218377
+ name: "deviceId",
218378
+ form: "single",
218379
+ optional: false
218380
+ }],
218381
+ "workload.getStatus": [{
218382
+ name: "deviceId",
218383
+ form: "single",
218384
+ optional: false
218385
+ }],
218386
+ "workload.pause": [{
218387
+ name: "deviceId",
218388
+ form: "single",
218389
+ optional: false
218390
+ }],
218391
+ "workload.restart": [{
218392
+ name: "deviceId",
218393
+ form: "single",
218394
+ optional: false
218395
+ }],
218396
+ "workload.resume": [{
218397
+ name: "deviceId",
218398
+ form: "single",
218399
+ optional: false
218400
+ }],
218401
+ "workload.start": [{
218402
+ name: "deviceId",
218403
+ form: "single",
218404
+ optional: false
218405
+ }],
218406
+ "workload.stop": [{
218407
+ name: "deviceId",
218408
+ form: "single",
218409
+ optional: false
218410
+ }],
216677
218411
  "zoneAnalytics.getCameraHistory": [{
216678
218412
  name: "deviceId",
216679
218413
  form: "single",
@@ -217890,6 +219624,8 @@ var TimelapseRuleInputSchema = object({
217890
219624
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
217891
219625
  priority: PriorityField.default(3),
217892
219626
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219627
+ /** Operator labels (D1054) — optional and NEVER defaulted: an absent key leaves the stored tags alone; `[]` clears them. Admin-only. */
219628
+ tags: TagsFieldSchema.optional(),
217893
219629
  targetOverrides: NcTargetOverridesSchema.optional()
217894
219630
  });
217895
219631
  object({
@@ -217908,6 +219644,8 @@ object({
217908
219644
  reportClasses: ReportClassesField.optional(),
217909
219645
  priority: PriorityField.optional(),
217910
219646
  /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
219647
+ /** Absent = keep the stored tags; `[]` clears them (D1054). Never defaulted. */
219648
+ tags: TagsFieldSchema.optional(),
217911
219649
  targetOverrides: NcTargetOverridesSchema.optional()
217912
219650
  });
217913
219651
  TimelapseRuleInputSchema.extend({
@@ -220069,7 +221807,8 @@ var STREAM_HEADERS = {
220069
221807
  [CLIP_STREAM_TRANSPORT_HEADER]: "forward-only"
220070
221808
  };
220071
221809
  /** The status a refusal answers. `404` = nothing here to serve; `409` = a
220072
- * clip that exists and cannot be served right now; `502` = the camera. */
221810
+ * clip that exists and cannot be served right now; `502` = the camera;
221811
+ * `504` = the camera did not come up inside the wake's bound. */
220073
221812
  function streamRefusalStatus(code) {
220074
221813
  switch (code) {
220075
221814
  case "unknown-device":
@@ -220079,6 +221818,7 @@ function streamRefusalStatus(code) {
220079
221818
  case "clip-in-progress": return 409;
220080
221819
  case "camera-refused":
220081
221820
  case "fetch-failed": return 502;
221821
+ case "wake-timeout": return 504;
220082
221822
  }
220083
221823
  }
220084
221824
  function createClipStreamHandler(deps) {
@@ -223083,7 +224823,7 @@ function createReolinkVideoclipsProvider(deps) {
223083
224823
  * actually carries. Refusing left the operator with `high` looking
223084
224824
  * unsupported, and left two transports behind one pointer.
223085
224825
  */
223086
- dialClipStream: async ({ deviceId, clipId, profile, audio }) => {
224826
+ dialClipStream: async ({ deviceId, clipId, profile, audio, wake }) => {
223087
224827
  const tags = { deviceId };
223088
224828
  const refuse = (code, detail, meta) => {
223089
224829
  deps.logger.warn("videoclips: refusing a clip stream dial", {
@@ -223122,7 +224862,8 @@ function createReolinkVideoclipsProvider(deps) {
223122
224862
  deviceId,
223123
224863
  row,
223124
224864
  twin: chosen.twin,
223125
- audio: askedAudio
224865
+ audio: askedAudio,
224866
+ ...wake !== void 0 ? { wake } : {}
223126
224867
  });
223127
224868
  if (outcome.kind === "refused") return refuse(outcome.code, outcome.detail, {
223128
224869
  clipKey,
@@ -223360,6 +225101,13 @@ function createReolinkVideoclipsProvider(deps) {
223360
225101
  * constructs a `ReolinkBaichuanApi`, and that is enforced by the provider spec
223361
225102
  * rather than by hope.
223362
225103
  */
225104
+ /**
225105
+ * How long an AUTHORISED clip read or dial waits for a sleeping standalone
225106
+ * battery camera to come up — the bound `wakeIfSleeping` already applies to
225107
+ * every other operator wake on this provider. Past it the read is refused
225108
+ * `wake-timeout`, naming this number, and no session is opened.
225109
+ */
225110
+ var CLIP_WAKE_TIMEOUT_MS = 15e3;
223363
225111
  function createClipService(deps) {
223364
225112
  const now = deps.now ?? (() => Date.now());
223365
225113
  const cache = new ClipCatalogCache({ now });
@@ -223391,6 +225139,21 @@ function createClipService(deps) {
223391
225139
  * a battery camera the operator authorised once.
223392
225140
  */
223393
225141
  const producing = /* @__PURE__ */ new Map();
225142
+ /**
225143
+ * One wake in flight per camera. The file map above de-duplicates a
225144
+ * production per twin; a dial and a read of DIFFERENT twins, or two dials,
225145
+ * would otherwise each send their own wake to the same radio.
225146
+ */
225147
+ const waking = /* @__PURE__ */ new Map();
225148
+ const wakeOnce = (deviceId) => {
225149
+ const inFlight = waking.get(deviceId);
225150
+ if (inFlight !== void 0) return inFlight;
225151
+ const started = deps.wakeDevice(deviceId, CLIP_WAKE_TIMEOUT_MS).finally(() => {
225152
+ waking.delete(deviceId);
225153
+ });
225154
+ waking.set(deviceId, started);
225155
+ return started;
225156
+ };
223394
225157
  const rowFor = (deviceId, clipKey) => {
223395
225158
  return cache.findBy(deviceId, (row) => row.clipKey === clipKey);
223396
225159
  };
@@ -223580,7 +225343,7 @@ function createClipService(deps) {
223580
225343
  const gateClipDevice = async (input) => {
223581
225344
  const { deviceId, clipKey, twin, path } = input;
223582
225345
  const tags = { deviceId };
223583
- const device = await deps.resolveDevice(deviceId);
225346
+ let device = await deps.resolveDevice(deviceId);
223584
225347
  if (device === null) {
223585
225348
  deps.logger.warn("videoclips: no Reolink camera here to fetch this clip from", {
223586
225349
  tags,
@@ -223622,9 +225385,47 @@ function createClipService(deps) {
223622
225385
  clipKey,
223623
225386
  twin,
223624
225387
  path,
223625
- branch: "wake-authorised"
225388
+ branch: "wake-authorised",
225389
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
223626
225390
  }
223627
225391
  });
225392
+ if (!await wakeOnce(deviceId)) {
225393
+ deps.logger.warn("videoclips: the authorised wake did not bring the camera up in time", {
225394
+ tags,
225395
+ meta: {
225396
+ clipKey,
225397
+ twin,
225398
+ path,
225399
+ branch: "wake-timeout",
225400
+ timeoutMs: CLIP_WAKE_TIMEOUT_MS
225401
+ }
225402
+ });
225403
+ return {
225404
+ kind: "refused",
225405
+ branch: "wake-timeout",
225406
+ code: "wake-timeout",
225407
+ 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`
225408
+ };
225409
+ }
225410
+ const awake = await deps.resolveDevice(deviceId);
225411
+ if (awake === null) {
225412
+ deps.logger.warn("videoclips: the camera left this runner while it was being woken", {
225413
+ tags,
225414
+ meta: {
225415
+ clipKey,
225416
+ twin,
225417
+ path,
225418
+ branch: "unknown-device"
225419
+ }
225420
+ });
225421
+ return {
225422
+ kind: "refused",
225423
+ branch: "unknown-device",
225424
+ code: "catalog-unreachable",
225425
+ detail: `device ${deviceId} is not a Reolink camera on this node`
225426
+ };
225427
+ }
225428
+ device = awake;
223628
225429
  }
223629
225430
  if (uidIsMissing(device)) {
223630
225431
  deps.logger.warn("videoclips: no uid for this camera — its clip cannot be addressed", {
@@ -223939,12 +225740,13 @@ function createClipService(deps) {
223939
225740
  }),
223940
225741
  prepareBytes,
223941
225742
  prepareOffer,
223942
- prepareStreamDial: async ({ deviceId, row, twin, audio }) => {
225743
+ prepareStreamDial: async ({ deviceId, row, twin, audio, wake }) => {
223943
225744
  const gate = await gateClipDevice({
223944
225745
  deviceId,
223945
225746
  clipKey: row.clipKey,
223946
225747
  twin,
223947
- path: "stream"
225748
+ path: "stream",
225749
+ ...wake !== void 0 ? { wake } : {}
223948
225750
  });
223949
225751
  if (gate.kind === "refused") return {
223950
225752
  kind: "refused",
@@ -227944,6 +229746,13 @@ function buildReolinkSirenOptions(input) {
227944
229746
  step: secondsPerPlay
227945
229747
  },
227946
229748
  defaultSeconds: secondsForPlays(defaultPlays, secondsPerPlay),
229749
+ allowedPlays: null,
229750
+ rangePlays: {
229751
+ min: 1,
229752
+ max: 60,
229753
+ step: 1
229754
+ },
229755
+ defaultPlays,
227947
229756
  unit: SirenDurationUnit.Plays,
227948
229757
  secondsPerPlay,
227949
229758
  source: SirenOptionsSource.Fallback,
@@ -228204,9 +230013,9 @@ var SirenAccessory = class extends BaseDevice {
228204
230013
  });
228205
230014
  }
228206
230015
  /** Arms the countdown for a timed activation and clears the slice when it elapses. */
228207
- armSirenCountdown(seconds) {
230016
+ armSirenCountdown(seconds, activation) {
228208
230017
  this.clearSirenTimer();
228209
- this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds));
230018
+ this.writeSirenStatus(sirenTriggeredStatus(Date.now(), seconds, activation));
228210
230019
  this.sirenTimer = setTimeout(() => {
228211
230020
  this.sirenTimer = null;
228212
230021
  this.writeSirenStatus(sirenIdleStatus(this.sirenView()));
@@ -228225,7 +230034,10 @@ var SirenAccessory = class extends BaseDevice {
228225
230034
  return;
228226
230035
  }
228227
230036
  if (plays !== void 0) {
228228
- this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay));
230037
+ this.armSirenCountdown(secondsForPlays(plays, this.secondsPerPlay), {
230038
+ plays,
230039
+ estimated: true
230040
+ });
228229
230041
  return;
228230
230042
  }
228231
230043
  this.clearSirenTimer();
@@ -228233,6 +230045,8 @@ var SirenAccessory = class extends BaseDevice {
228233
230045
  active: true,
228234
230046
  activeUntil: null,
228235
230047
  durationSeconds: null,
230048
+ plays: null,
230049
+ activeUntilEstimated: false,
228236
230050
  lastTriggeredAt: Date.now()
228237
230051
  });
228238
230052
  }
@@ -228240,9 +230054,27 @@ var SirenAccessory = class extends BaseDevice {
228240
230054
  this.ctx.registerNativeCap(sirenCapability, {
228241
230055
  getStatus: async () => this.sirenView(),
228242
230056
  getOptions: async () => this.sirenOptions(),
228243
- trigger: async ({ deviceId, durationSeconds }) => {
230057
+ getPlayChoices: async () => sirenPlayChoices(this.sirenOptions()),
230058
+ trigger: async ({ deviceId, durationSeconds, plays: askedPlays }) => {
228244
230059
  if (deviceId !== this.id) return this.sirenView();
228245
- const plays = playsForSeconds(resolveSirenSeconds(this.sirenOptions(), durationSeconds), this.secondsPerPlay);
230060
+ const plan = planSirenTrigger(this.sirenOptions(), {
230061
+ durationSeconds,
230062
+ plays: askedPlays
230063
+ });
230064
+ if (plan.asked === "refused") {
230065
+ this.ctx.logger.warn("siren trigger refused", {
230066
+ tags: {
230067
+ deviceId: this.id,
230068
+ channel: this.channel
230069
+ },
230070
+ meta: {
230071
+ reason: plan.reason,
230072
+ plays: askedPlays
230073
+ }
230074
+ });
230075
+ throw new Error(`siren trigger refused: ${plan.reason}`);
230076
+ }
230077
+ const plays = plan.asked === "plays" ? plan.plays : playsForSeconds(plan.seconds, this.secondsPerPlay);
228246
230078
  const api = await this.api;
228247
230079
  try {
228248
230080
  await api.setSiren(this.channel, true, plays);
@@ -228266,7 +230098,8 @@ var SirenAccessory = class extends BaseDevice {
228266
230098
  channel: this.channel
228267
230099
  },
228268
230100
  meta: {
228269
- requested: durationSeconds ?? "default",
230101
+ requested: askedPlays ?? durationSeconds ?? "default",
230102
+ unit: plan.asked,
228270
230103
  plays,
228271
230104
  seconds: actualSeconds
228272
230105
  }
@@ -228275,7 +230108,10 @@ var SirenAccessory = class extends BaseDevice {
228275
230108
  on: true,
228276
230109
  lastChangedAt: Date.now()
228277
230110
  });
228278
- this.armSirenCountdown(actualSeconds);
230111
+ this.armSirenCountdown(actualSeconds, {
230112
+ plays: plan.asked === "plays" ? plays : null,
230113
+ estimated: plan.estimated
230114
+ });
228279
230115
  return this.sirenView();
228280
230116
  },
228281
230117
  stop: async ({ deviceId }) => {
@@ -228693,7 +230529,7 @@ async function populateReolinkMetadata(api, channel, target) {
228693
230529
  ...channelCount !== void 0 ? { channelCount } : {}
228694
230530
  };
228695
230531
  try {
228696
- await target.ctx.api?.deviceManager?.setMetadata?.mutate?.({
230532
+ await target.ctx.api.deviceManager?.setMetadata?.mutate({
228697
230533
  deviceId: target.id,
228698
230534
  patch
228699
230535
  });
@@ -228710,6 +230546,26 @@ async function populateReolinkMetadata(api, channel, target) {
228710
230546
  meta: { error: err instanceof Error ? err.message : String(err) }
228711
230547
  });
228712
230548
  }
230549
+ const hostRead = channel === void 0;
230550
+ const identifierMac = hostRead ? mac : void 0;
230551
+ const identifierIp = hostRead ? ip : void 0;
230552
+ const unread = hostRead ? [...mac === void 0 ? ["mac"] : [], ...ip === void 0 ? ["ip"] : []] : [];
230553
+ await declareDeviceIdentifiers({
230554
+ deviceId: target.id,
230555
+ logger: target.ctx.logger,
230556
+ writer: target.ctx.api.deviceManager?.setIdentifiers
230557
+ }, {
230558
+ mac: identifierMac ?? null,
230559
+ serial: info.serialNumber ? {
230560
+ manufacturer: "Reolink",
230561
+ serial: info.serialNumber
230562
+ } : null,
230563
+ vendorUid: target.uid ? {
230564
+ vendor: "reolink",
230565
+ id: target.uid
230566
+ } : null,
230567
+ ip: identifierIp ?? null
230568
+ }, { unread });
228713
230569
  const cachePatch = {};
228714
230570
  if (info.serialNumber) cachePatch["serialNumber"] = info.serialNumber;
228715
230571
  if (mac) cachePatch["mac"] = mac;
@@ -231611,6 +233467,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
231611
233467
  async wakeForClipCatalogRefresh() {
231612
233468
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
231613
233469
  }
233470
+ /**
233471
+ * Wake this camera because the OPERATOR asked for one of its clips — a
233472
+ * viewer pressing play, or an export — carrying `ClipWake` `authorised`.
233473
+ * The same forced wake `wakeIfSleeping` drives for a config button, under
233474
+ * the clip service's bound. Resolves whether the camera is up; never throws,
233475
+ * so the service can refuse `wake-timeout` by name.
233476
+ */
233477
+ async wakeForClipRead(timeoutMs) {
233478
+ return this.wakeIfSleeping(timeoutMs);
233479
+ }
231614
233480
  clipTimeZoneWarned = { done: false };
231615
233481
  getClipDeviceRef() {
231616
233482
  const configUid = this.config.get("uid");
@@ -239343,6 +241209,97 @@ var EmailPushBridge = class {
239343
241209
  function pickMailbox(list) {
239344
241210
  return list.find((b) => b.id === "smtp-inbound-default")?.id ?? list[0]?.id ?? null;
239345
241211
  }
241212
+ //#endregion
241213
+ //#region src/reolink-connection-test.ts
241214
+ /**
241215
+ * The Reolink NVR / Home Hub connection test (planning#581): log in over Baichuan with the
241216
+ * connection as the form holds it — the same login the hub session makes — and answer a typed
241217
+ * verdict with a reason.
241218
+ *
241219
+ * The library reports failures only by message. What they tell apart:
241220
+ * - a socket that never connected, or a login that timed out — the hub did not answer;
241221
+ * - `Baichuan login failed: empty reply` after the nonce exchange succeeded — the hub is there
241222
+ * and refused the username or password (a mains-powered hub does not sleep, and the test's
241223
+ * socket is fresh, so the library's other two guesses for this message do not apply);
241224
+ * - anything else — the login failed with the library's own words, inconclusive.
241225
+ * Whether the host is an NVR / Home Hub rather than a single camera is NOT a reason here: a hub
241226
+ * with no camera paired answers zero channels just like a camera would.
241227
+ */
241228
+ /** The bound on login plus the channel read; the test logs in once (no library retry). */
241229
+ var REOLINK_HUB_TEST_DEADLINE_MS = 2e4;
241230
+ /** A real Baichuan session, dialled the way `connectReolinkHub` dials one. */
241231
+ var liveReolinkHubProbe = (connection) => {
241232
+ const api = new ReolinkBaichuanApi({
241233
+ host: connection.host,
241234
+ port: connection.port,
241235
+ username: connection.username,
241236
+ password: connection.password,
241237
+ transport: connection.transport,
241238
+ ...connection.uid ? { uid: connection.uid } : {}
241239
+ });
241240
+ return {
241241
+ login: () => api.login(void 0, { maxAttempts: 1 }),
241242
+ channelCount: async () => {
241243
+ try {
241244
+ return (await api.getNvrChannelsSummary({ timeoutMs: 5e3 })).devices.length;
241245
+ } catch {
241246
+ return null;
241247
+ }
241248
+ },
241249
+ close: () => api.close({ reason: "connection-test" })
241250
+ };
241251
+ };
241252
+ /** The verdict for a failed login. */
241253
+ function reolinkHubFailureOf(err, connection) {
241254
+ const where = `${connection.host}:${connection.port}`;
241255
+ const message = errMsg$3(err);
241256
+ if (message.includes("login failed: empty reply")) return {
241257
+ success: false,
241258
+ status: "rejected",
241259
+ error: `reolink: the NVR / Home Hub refused the username or password (user "${connection.username}")`
241260
+ };
241261
+ if (isConnectivityFailure(err) || message.includes("connect timeout")) return {
241262
+ success: false,
241263
+ status: "inconclusive",
241264
+ error: `reolink: the NVR / Home Hub did not answer on ${where} (${message}) — check the host and the Baichuan port (9000 by default)`
241265
+ };
241266
+ return {
241267
+ success: false,
241268
+ status: "inconclusive",
241269
+ error: `reolink: the login to ${where} failed: ${message}`
241270
+ };
241271
+ }
241272
+ async function testReolinkHubConnection(connection, makeProbe, deadlineMs = REOLINK_HUB_TEST_DEADLINE_MS) {
241273
+ const started = Date.now();
241274
+ const probe = makeProbe(connection);
241275
+ let timer = null;
241276
+ const deadline = new Promise((resolve) => {
241277
+ timer = setTimeout(() => resolve({ kind: "deadline" }), deadlineMs);
241278
+ });
241279
+ const login = probe.login().then(() => ({ kind: "ok" }), (err) => ({
241280
+ kind: "error",
241281
+ err
241282
+ }));
241283
+ try {
241284
+ const outcome = await Promise.race([login, deadline]);
241285
+ if (outcome.kind === "error") return reolinkHubFailureOf(outcome.err, connection);
241286
+ if (outcome.kind === "deadline") return {
241287
+ success: false,
241288
+ status: "inconclusive",
241289
+ 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`
241290
+ };
241291
+ const channels = await probe.channelCount();
241292
+ return {
241293
+ success: true,
241294
+ status: "validated",
241295
+ latencyMs: Date.now() - started,
241296
+ ...channels !== null ? { detail: `${channels} channels` } : {}
241297
+ };
241298
+ } finally {
241299
+ if (timer !== null) clearTimeout(timer);
241300
+ await probe.close().catch(() => null);
241301
+ }
241302
+ }
239346
241303
  var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239347
241304
  title: "Reolink integrations",
239348
241305
  schema: entryBody({
@@ -239362,6 +241319,44 @@ var reolinkConnectionsEntryKind = defineEntryKind("connections", {
239362
241319
  });
239363
241320
  /** Every kind this addon declares, keyed by its name. */
239364
241321
  var reolinkRecordKinds = { connections: reolinkConnectionsEntryKind };
241322
+ /**
241323
+ * The connection test: the stored hub under the edited form. A saved password is never retyped
241324
+ * (the form hands back its redacted view), so the keychain value stands in.
241325
+ */
241326
+ async function testReolinkInstance(records, deps, input) {
241327
+ const handle = records.kind(reolinkConnectionsEntryKind);
241328
+ const stored = input.id === null ? null : (await handle.getResolved(input.id))?.data ?? null;
241329
+ const typed = input.values["password"];
241330
+ const password = typeof typed === "string" && typed !== "" && typed !== "__camstack_redacted__" ? typed : stored?.password;
241331
+ const merged = {};
241332
+ for (const [key, value] of Object.entries({
241333
+ ...stored,
241334
+ ...input.values,
241335
+ password
241336
+ })) {
241337
+ if (key === "name" || value === null || value === void 0) continue;
241338
+ merged[key] = value;
241339
+ }
241340
+ const read = readHubConnection(merged);
241341
+ switch (read.kind) {
241342
+ case "no-host": return {
241343
+ success: false,
241344
+ status: "inconclusive",
241345
+ error: "reolink: no NVR / Home Hub host on this integration — standalone cameras are tested one by one when they are added"
241346
+ };
241347
+ case "no-password": return {
241348
+ success: false,
241349
+ status: "rejected",
241350
+ error: "reolink: enter the NVR / Home Hub password"
241351
+ };
241352
+ case "password-locked": return {
241353
+ success: false,
241354
+ status: "inconclusive",
241355
+ error: "reolink: the stored password cannot be read right now (keychain unavailable)"
241356
+ };
241357
+ case "ok": return testReolinkHubConnection(read.connection, deps.makeHubProbe);
241358
+ }
241359
+ }
239365
241360
  /** The record body as the connection form's flat values: no name, no unset keys. */
239366
241361
  function hubSettingsOf(body) {
239367
241362
  const out = {};
@@ -239405,7 +241400,7 @@ function buildReolinkInstances(records, deps) {
239405
241400
  },
239406
241401
  instanceMode: "multiple",
239407
241402
  kind: "connection",
239408
- canTest: false,
241403
+ canTest: true,
239409
241404
  kinds: [{
239410
241405
  id: "connection",
239411
241406
  label: "Reolink",
@@ -239416,7 +241411,8 @@ function buildReolinkInstances(records, deps) {
239416
241411
  formSchema: () => buildHubInstanceSchema(),
239417
241412
  initialBody: (name) => ({ name }),
239418
241413
  configured: (body) => (body.host ?? "").length === 0 || (body.password ?? "").length > 0,
239419
- onChanged: () => deps.onChanged()
241414
+ onChanged: () => deps.onChanged(),
241415
+ test: (input) => testReolinkInstance(records, deps, input)
239420
241416
  });
239421
241417
  }
239422
241418
  /**
@@ -240921,6 +242917,10 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240921
242917
  resolveDevice: async (deviceId) => {
240922
242918
  const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
240923
242919
  return device instanceof ReolinkCamera ? device.getClipDeviceRef() : null;
242920
+ },
242921
+ wakeDevice: async (deviceId, timeoutMs) => {
242922
+ const device = this.ctx.kernel.deviceRegistry?.getById(deviceId);
242923
+ return device instanceof ReolinkCamera ? device.wakeForClipRead(timeoutMs) : false;
240924
242924
  }
240925
242925
  });
240926
242926
  regs.push({
@@ -240961,7 +242961,8 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
240961
242961
  };
240962
242962
  const instances = buildReolinkInstances(records, {
240963
242963
  onChanged: () => this.reconcileIntegrations(),
240964
- registryEvidenceOf
242964
+ registryEvidenceOf,
242965
+ makeHubProbe: liveReolinkHubProbe
240965
242966
  });
240966
242967
  this.instances = instances;
240967
242968
  this.hubIntegrationProbe = (id) => integrationIsHub(instances, { registryEvidenceOf }, id);