@camstack/server 1.2.851 → 1.2.853

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +9 -9
  3. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/system/dist/builtins/autotrack/index.js +1 -1
  10. package/system/dist/builtins/autotrack/index.mjs +1 -1
  11. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  12. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  13. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  14. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  15. package/system/dist/builtins/camera-grid/index.js +1 -1
  16. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  17. package/system/dist/builtins/composer/composer.addon.js +4 -4
  18. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  19. package/system/dist/builtins/console-logging/index.js +1 -1
  20. package/system/dist/builtins/console-logging/index.mjs +1 -1
  21. package/system/dist/builtins/core-blocks/composition-sources.d.ts +2 -0
  22. package/system/dist/builtins/core-blocks/core-blocks.addon.js +15 -5
  23. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +15 -5
  24. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  25. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  26. package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
  27. package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  28. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  29. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  30. package/system/dist/builtins/keychain/index.js +4 -4
  31. package/system/dist/builtins/keychain/index.mjs +4 -4
  32. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  33. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  34. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  35. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  36. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  37. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  38. package/system/dist/builtins/loki-logging/index.js +1 -1
  39. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  40. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  41. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  42. package/system/dist/builtins/platform-probe/index.js +1 -1
  43. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  44. package/system/dist/builtins/record-entries/index.js +1 -1
  45. package/system/dist/builtins/record-entries/index.mjs +1 -1
  46. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  47. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  48. package/system/dist/builtins/snapshot/index.js +1 -1
  49. package/system/dist/builtins/snapshot/index.mjs +1 -1
  50. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  51. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  52. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  53. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  54. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  55. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  56. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  57. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  58. package/system/dist/builtins/system-config/system-config.addon.js +12 -3
  59. package/system/dist/builtins/system-config/system-config.addon.mjs +12 -3
  60. package/system/dist/builtins/winston-logging/index.js +1 -1
  61. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  62. package/system/dist/{capture-engine-Bshtl7Kd.mjs → capture-engine-BPz4ejJj.mjs} +1 -1
  63. package/system/dist/{capture-engine-BM9nGdvv.js → capture-engine-Bj7UIRm8.js} +1 -1
  64. package/system/dist/{composition-sources-63HlIklt.js → composition-sources-BKTc629o.js} +2 -1
  65. package/system/dist/{composition-sources-CYpKKHtf.mjs → composition-sources-Crz0fywh.mjs} +2 -1
  66. package/system/dist/{constants-lHbp6u7t.js → constants-Cmlov8uj.js} +1 -1
  67. package/system/dist/{constants-15k32igK.mjs → constants-Lp7Vr4-r.mjs} +1 -1
  68. package/system/dist/{device-ca-BmKBCV_4.mjs → device-ca-BgIrp4CF.mjs} +1 -1
  69. package/system/dist/{device-ca-aB_rFHhZ.js → device-ca-Dr6H7uBQ.js} +1 -1
  70. package/system/dist/{dist-DNDhIlAe.js → dist-CBSKYKwq.js} +360 -161
  71. package/system/dist/{dist-DY7OGObz.mjs → dist-CahntDDE.mjs} +349 -162
  72. package/system/dist/file-host-worker.js +1 -1
  73. package/system/dist/file-host-worker.mjs +1 -1
  74. package/system/dist/{hub-identity-dcbGnvVX.js → hub-identity-CFQa7ECA.js} +1 -1
  75. package/system/dist/{hub-identity-BMz4OOYu.mjs → hub-identity-Vp3W2gbI.mjs} +1 -1
  76. package/system/dist/{hub-mdns-ciao-Y7YjcHQ4.js → hub-mdns-ciao-Bimi2gP6.js} +2 -2
  77. package/system/dist/{hub-mdns-ciao-BOecE4tm.mjs → hub-mdns-ciao-DZNHJrVS.mjs} +2 -2
  78. package/system/dist/index.js +8 -8
  79. package/system/dist/index.mjs +8 -8
  80. package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +5 -0
  81. package/system/dist/{legacy-integration-rows-door-BQKarbeM.js → legacy-integration-rows-door-DKSreg4e.js} +1 -1
  82. package/system/dist/{legacy-integration-rows-door-87W9dzLF.mjs → legacy-integration-rows-door-f1SeDqI4.mjs} +1 -1
  83. package/system/dist/{rename-composition-block-p_8C4nY4.js → rename-composition-block-BsfC8uTI.js} +1 -1
  84. package/system/dist/{rename-composition-block-DOzzdV9v.mjs → rename-composition-block-QJrduoIS.mjs} +1 -1
  85. package/system/dist/{restore-archive-Bc-Xm8TB.js → restore-archive-Cu1-Aptf.js} +1 -1
  86. package/system/dist/{restore-archive-TpUr6_kg.mjs → restore-archive-D0F1Cn_F.mjs} +1 -1
  87. package/system/dist/{wal-maintenance-CE7-afh9.mjs → wal-maintenance-BF9svCua.mjs} +0 -0
  88. package/system/dist/{wal-maintenance-auHpWNP7.js → wal-maintenance-Cq52zXhg.js} +0 -0
  89. package/system/package.json +1 -1
@@ -812,7 +812,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
812
812
  return EventCategory;
813
813
  }({});
814
814
  //#endregion
815
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
815
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
816
816
  /**
817
817
  import { errMsg } from '@camstack/types'
818
818
  * Extract a human-readable message from an unknown error value.
@@ -1163,6 +1163,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1163
1163
  * with the switch's on/off only. Speed or oscillation appear only when the
1164
1164
  * device also has a fan cap (D1033). */
1165
1165
  DeviceRole["SwitchFan"] = "switch-fan";
1166
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1167
+ * slider), presented to the exports as a light with power only. Not a
1168
+ * `light` type: the provider owns the type, and a light implies brightness
1169
+ * or colour this relay lacks. */
1170
+ DeviceRole["SwitchLight"] = "switch-light";
1166
1171
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1167
1172
  DeviceRole["ClimateAc"] = "climate-ac";
1168
1173
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -1252,7 +1257,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1252
1257
  */
1253
1258
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1254
1259
  //#endregion
1255
- //#region ../types/dist/sleep-DyIxjZZt.mjs
1260
+ //#region ../types/dist/sleep-BvVGLl30.mjs
1256
1261
  /**
1257
1262
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1258
1263
  * window to float samples (D455).
@@ -6822,6 +6827,13 @@ var ACTUATOR_CAP_VOCABULARY = {
6822
6827
  },
6823
6828
  state: { on: { icon: "lightbulb" } }
6824
6829
  },
6830
+ [DeviceRole.SwitchLight]: {
6831
+ actions: {
6832
+ "switch.on": { icon: "lightbulb" },
6833
+ "switch.off": { icon: "lightbulb-off" }
6834
+ },
6835
+ state: { on: { icon: "lightbulb" } }
6836
+ },
6825
6837
  [DeviceRole.Chime]: { actions: {
6826
6838
  "switch.on": {
6827
6839
  label: t("Enable chime", "Attiva il campanello"),
@@ -13996,7 +14008,7 @@ function sleep(ms) {
13996
14008
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
13997
14009
  }
13998
14010
  //#endregion
13999
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
14011
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
14000
14012
  var AUDIO_ENCODER_BY_CODEC = {
14001
14013
  opus: "libopus",
14002
14014
  aac: "aac",
@@ -14443,6 +14455,80 @@ function portable(target) {
14443
14455
  }
14444
14456
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
14445
14457
  /**
14458
+ * A device's KIND is its type plus its role (D1033): the type is the set of
14459
+ * controls it has, the role says which thing it is among the devices that
14460
+ * share those controls. A plug-in heater is a `switch` with role
14461
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
14462
+ * told apart by their `climate-*` role.
14463
+ */
14464
+ /**
14465
+ * Type values a persisted row may still carry after the type was retired, and
14466
+ * the type each one is read as. The row is rewritten by the next registration
14467
+ * of the device (its provider stamps the live type), so this is a read alias,
14468
+ * not a migration.
14469
+ *
14470
+ * `heater` is deliberately absent: the only heaters were composed devices the
14471
+ * operator deletes. Such a row stays an unknown type, which every reader
14472
+ * treats as a generic device.
14473
+ */
14474
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
14475
+ /** The live type a stored `type` value stands for (itself unless retired). */
14476
+ function canonicalStoredDeviceType(stored) {
14477
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
14478
+ }
14479
+ zod.z.preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, zod.z.enum(DeviceType));
14480
+ /** The `climate-*` roles, in the order the role picker lists them. */
14481
+ var CLIMATE_ROLES = [
14482
+ DeviceRole.ClimateThermostat,
14483
+ DeviceRole.ClimateAc,
14484
+ DeviceRole.ClimateRadiator,
14485
+ DeviceRole.ClimateFloor,
14486
+ DeviceRole.ClimateHeater,
14487
+ DeviceRole.ClimateHeatPumpCircuit
14488
+ ];
14489
+ function isClimateRole(role) {
14490
+ return CLIMATE_ROLES.some((candidate) => candidate === role);
14491
+ }
14492
+ /**
14493
+ * Which climate device this is. A climate device with no role, or a role that
14494
+ * is not a climate one, is a room thermostat: that is what most of them are,
14495
+ * and it is the presentation a thermostat had before the types were folded.
14496
+ */
14497
+ function climateRoleOf(role) {
14498
+ return role !== null && role !== void 0 && isClimateRole(role) ? role : DeviceRole.ClimateThermostat;
14499
+ }
14500
+ /** An air conditioner: exports present it as an AC unit, not a thermostat. */
14501
+ function isAirConditioner(type, role) {
14502
+ return type === DeviceType.Climate && climateRoleOf(role) === DeviceRole.ClimateAc;
14503
+ }
14504
+ /**
14505
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
14506
+ * drawn and exported as a light, with the switch's power only. The one place
14507
+ * that reads the role for it — a consumer asks this, never the role string.
14508
+ */
14509
+ function isSwitchLight(type, role) {
14510
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
14511
+ }
14512
+ /**
14513
+ * Is a capability offered on a device of this type and role?
14514
+ *
14515
+ * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
14516
+ * list) applies to every device, and an unknown type never filters (a failed
14517
+ * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
14518
+ * is offered only to the roles listed there; an unknown role is NOT one of
14519
+ * them, so a `switch` whose role could not be read is not a heater.
14520
+ */
14521
+ function capAppliesToDeviceKind(gate, deviceType, role) {
14522
+ if (deviceType === void 0) return true;
14523
+ const types = gate?.deviceTypes;
14524
+ if (!types || types.length === 0) return true;
14525
+ const type = types.find((candidate) => candidate === deviceType);
14526
+ if (type === void 0) return false;
14527
+ const roles = gate?.deviceRoles?.[type];
14528
+ if (roles === void 0) return true;
14529
+ return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
14530
+ }
14531
+ /**
14446
14532
  * THE table "which boolean of this device type counts as HIGH", and the
14447
14533
  * pure evaluator of its EDGE.
14448
14534
  *
@@ -16596,6 +16682,41 @@ var CompositionNewTargetSchema = zod.z.object({
16596
16682
  type: zod.z.enum(DeviceType),
16597
16683
  role: zod.z.enum(DeviceRole).optional()
16598
16684
  });
16685
+ /**
16686
+ * A STORED block, read back: the `new` target of its composition may name a
16687
+ * device type D1033 retired (`thermostat`). {@link CompositionNewTargetSchema}
16688
+ * stays a strict enum on the wire, so the store rewrites the retired name to
16689
+ * its canonical type (`source.composition.target.type`) before it parses the
16690
+ * row. Anything else is returned untouched, for the schema to judge.
16691
+ */
16692
+ function canonicalStoredBlockTarget(block) {
16693
+ if (!isPlainObject(block)) return block;
16694
+ const source = Reflect.get(block, "source");
16695
+ if (!isPlainObject(source)) return block;
16696
+ const composition = Reflect.get(source, "composition");
16697
+ if (!isPlainObject(composition)) return block;
16698
+ const target = Reflect.get(composition, "target");
16699
+ if (!isPlainObject(target)) return block;
16700
+ const type = Reflect.get(target, "type");
16701
+ if (typeof type !== "string") return block;
16702
+ const canonical = {
16703
+ ...target,
16704
+ type: canonicalStoredDeviceType(type)
16705
+ };
16706
+ return {
16707
+ ...block,
16708
+ source: {
16709
+ ...source,
16710
+ composition: {
16711
+ ...composition,
16712
+ target: canonical
16713
+ }
16714
+ }
16715
+ };
16716
+ }
16717
+ function isPlainObject(value) {
16718
+ return value !== null && typeof value === "object" && !Array.isArray(value);
16719
+ }
16599
16720
  /** Customize an EXISTING device: each feature adds a capability or replaces fields of a native one (D663). */
16600
16721
  var CompositionExistingTargetSchema = zod.z.object({
16601
16722
  kind: zod.z.literal("existing"),
@@ -22167,7 +22288,7 @@ var DeviceTokenScopeSchema = zod.z.object({
22167
22288
  function migrateLegacyTokenScope(raw) {
22168
22289
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
22169
22290
  if (Reflect.get(raw, "type") !== "device") return raw;
22170
- if (Reflect.get(raw, "selector") !== void 0) return raw;
22291
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
22171
22292
  const targets = Reflect.get(raw, "targets");
22172
22293
  if (!Array.isArray(targets)) return raw;
22173
22294
  return {
@@ -22179,6 +22300,27 @@ function migrateLegacyTokenScope(raw) {
22179
22300
  access: Reflect.get(raw, "access")
22180
22301
  };
22181
22302
  }
22303
+ /**
22304
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
22305
+ * grant is read back through this same preprocess, so the retired name is
22306
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
22307
+ * stays a strict enum on the wire.
22308
+ */
22309
+ function canonicalSelectorTypes(raw) {
22310
+ const selector = Reflect.get(raw, "selector");
22311
+ if (selector === null || typeof selector !== "object") return raw;
22312
+ if (Reflect.get(selector, "kind") !== "types") return raw;
22313
+ const types = Reflect.get(selector, "types");
22314
+ if (!Array.isArray(types)) return raw;
22315
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
22316
+ return {
22317
+ ...raw,
22318
+ selector: {
22319
+ ...selector,
22320
+ types: canonical
22321
+ }
22322
+ };
22323
+ }
22182
22324
  var TokenScopeSchema = zod.z.preprocess(migrateLegacyTokenScope, zod.z.discriminatedUnion("type", [
22183
22325
  zod.z.object({
22184
22326
  type: zod.z.literal("category"),
@@ -42546,6 +42688,36 @@ var ActionTargetSchema = zod.z.discriminatedUnion("kind", [
42546
42688
  name: zod.z.string().min(1)
42547
42689
  })
42548
42690
  ]);
42691
+ /**
42692
+ * A STORED list of steps, read back: a `domain` target may name a device type
42693
+ * D1033 retired (`thermostat`). The step schema stays a strict enum on the
42694
+ * wire, so the store rewrites the retired name to its canonical type before
42695
+ * it parses the row — on the step and on each step of its `else` list. Any
42696
+ * other value is returned untouched, for the schema to judge.
42697
+ */
42698
+ function canonicalStoredStepTargets(steps) {
42699
+ if (!Array.isArray(steps)) return steps;
42700
+ return steps.map(canonicalStoredStep);
42701
+ }
42702
+ function canonicalStoredStep(step) {
42703
+ if (step === null || typeof step !== "object" || Array.isArray(step)) return step;
42704
+ const target = Reflect.get(step, "target");
42705
+ const elseSteps = Reflect.get(step, "else");
42706
+ return {
42707
+ ...step,
42708
+ ...target === void 0 ? {} : { target: canonicalStoredTarget(target) },
42709
+ ...elseSteps === void 0 ? {} : { else: canonicalStoredStepTargets(elseSteps) }
42710
+ };
42711
+ }
42712
+ function canonicalStoredTarget(target) {
42713
+ if (target === null || typeof target !== "object" || Array.isArray(target)) return target;
42714
+ const deviceType = Reflect.get(target, "deviceType");
42715
+ if (typeof deviceType !== "string") return target;
42716
+ return {
42717
+ ...target,
42718
+ deviceType: canonicalStoredDeviceType(deviceType)
42719
+ };
42720
+ }
42549
42721
  /** The events after which a cached domain is stale. */
42550
42722
  var ACTION_TARGET_INVALIDATION_EVENTS = [
42551
42723
  EventCategory.DeviceRegistered,
@@ -56554,68 +56726,6 @@ var BY_ID = new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
56554
56726
  function groupTemplate(id) {
56555
56727
  return BY_ID.get(id) ?? null;
56556
56728
  }
56557
- var COLOR_MODE_FEATURES = [
56558
- DeviceFeature.LightColorRgb,
56559
- DeviceFeature.LightColorHsv,
56560
- DeviceFeature.LightColorMired
56561
- ];
56562
- /** `at-least-one` is any included member on; `all` is every included member on. */
56563
- function reducerForActive(active) {
56564
- return active === "all" ? "all" : "any";
56565
- }
56566
- /**
56567
- * Colour modes every member advertises. Offline does not remove a mode:
56568
- * the caller passes device features, not liveness. No members → no mode.
56569
- */
56570
- function sharedColorModes(memberFeatures) {
56571
- if (memberFeatures.length === 0) return [];
56572
- return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
56573
- }
56574
- /**
56575
- * One call per member that binds `cap`. Offline members stay in the list.
56576
- * A member without the cap is not called — the command cannot reach it.
56577
- */
56578
- function fanOutTargets(members, cap, method, args) {
56579
- return members.flatMap((member) => member.caps.includes(cap) ? [{
56580
- deviceId: member.deviceId,
56581
- cap,
56582
- method,
56583
- args: { ...args }
56584
- }] : []);
56585
- }
56586
- /**
56587
- * Run every call. A throw is that member's result; the other calls still run.
56588
- * At most {@link FAN_OUT_CONCURRENCY} are in flight.
56589
- */
56590
- async function runFanOut(calls, invoke) {
56591
- const results = [];
56592
- let next = 0;
56593
- const worker = async () => {
56594
- for (;;) {
56595
- const index = next;
56596
- next += 1;
56597
- const call = calls[index];
56598
- if (call === void 0) return;
56599
- try {
56600
- await invoke(call);
56601
- results[index] = {
56602
- deviceId: call.deviceId,
56603
- ok: true
56604
- };
56605
- } catch (err) {
56606
- const error = err instanceof Error ? err.message : String(err);
56607
- results[index] = {
56608
- deviceId: call.deviceId,
56609
- ok: false,
56610
- error
56611
- };
56612
- }
56613
- }
56614
- };
56615
- const width = Math.min(4, calls.length);
56616
- await Promise.all(Array.from({ length: width }, () => worker()));
56617
- return results;
56618
- }
56619
56729
  /**
56620
56730
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
56621
56731
  * 44 caps with series (89 series), 36 caps answered `'none'`.
@@ -57100,6 +57210,74 @@ var HISTORY_ITEM_CATALOG = {
57100
57210
  function historyFieldsFor(capName) {
57101
57211
  return HISTORY_CATALOG[capName] ?? {};
57102
57212
  }
57213
+ /** `sourcePickAcceptsDevice` over a bare list of member types. */
57214
+ function memberKindAccepted(allowed, deviceType, role) {
57215
+ if (allowed.length === 0) return true;
57216
+ if (allowed.some((type) => type === deviceType)) return true;
57217
+ return isSwitchLight(deviceType, role) && allowed.includes(DeviceType.Light);
57218
+ }
57219
+ var COLOR_MODE_FEATURES = [
57220
+ DeviceFeature.LightColorRgb,
57221
+ DeviceFeature.LightColorHsv,
57222
+ DeviceFeature.LightColorMired
57223
+ ];
57224
+ /** `at-least-one` is any included member on; `all` is every included member on. */
57225
+ function reducerForActive(active) {
57226
+ return active === "all" ? "all" : "any";
57227
+ }
57228
+ /**
57229
+ * Colour modes every member advertises. Offline does not remove a mode:
57230
+ * the caller passes device features, not liveness. No members → no mode.
57231
+ */
57232
+ function sharedColorModes(memberFeatures) {
57233
+ if (memberFeatures.length === 0) return [];
57234
+ return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
57235
+ }
57236
+ /**
57237
+ * One call per member that binds `cap`. Offline members stay in the list.
57238
+ * A member without the cap is not called — the command cannot reach it.
57239
+ */
57240
+ function fanOutTargets(members, cap, method, args) {
57241
+ return members.flatMap((member) => member.caps.includes(cap) ? [{
57242
+ deviceId: member.deviceId,
57243
+ cap,
57244
+ method,
57245
+ args: { ...args }
57246
+ }] : []);
57247
+ }
57248
+ /**
57249
+ * Run every call. A throw is that member's result; the other calls still run.
57250
+ * At most {@link FAN_OUT_CONCURRENCY} are in flight.
57251
+ */
57252
+ async function runFanOut(calls, invoke) {
57253
+ const results = [];
57254
+ let next = 0;
57255
+ const worker = async () => {
57256
+ for (;;) {
57257
+ const index = next;
57258
+ next += 1;
57259
+ const call = calls[index];
57260
+ if (call === void 0) return;
57261
+ try {
57262
+ await invoke(call);
57263
+ results[index] = {
57264
+ deviceId: call.deviceId,
57265
+ ok: true
57266
+ };
57267
+ } catch (err) {
57268
+ const error = err instanceof Error ? err.message : String(err);
57269
+ results[index] = {
57270
+ deviceId: call.deviceId,
57271
+ ok: false,
57272
+ error
57273
+ };
57274
+ }
57275
+ }
57276
+ };
57277
+ const width = Math.min(4, calls.length);
57278
+ await Promise.all(Array.from({ length: width }, () => worker()));
57279
+ return results;
57280
+ }
57103
57281
  /**
57104
57282
  * Project a statistics or integral helper onto a new device (D944 §3).
57105
57283
  * The value field is `series`: the composer fills it from history.
@@ -57601,8 +57779,10 @@ function deviceTypeProblems(spec, facts) {
57601
57779
  const template = groupTemplate(spec.templateId);
57602
57780
  if (template === null) return [];
57603
57781
  return spec.members.flatMap((member, index) => {
57604
- const deviceType = facts.get(compositionSourceKey(member.source))?.deviceType;
57605
- if (deviceType === void 0 || template.memberDeviceTypes.includes(deviceType)) return [];
57782
+ const fact = facts.get(compositionSourceKey(member.source));
57783
+ const deviceType = fact?.deviceType;
57784
+ if (deviceType === void 0) return [];
57785
+ if (memberKindAccepted(template.memberDeviceTypes, deviceType, fact?.role)) return [];
57606
57786
  return [problem("member-constraint", `helper.members[${index}]`, `a ${template.id} group takes ${template.memberDeviceTypes.join(" or ")} devices; this member is a ${deviceType}`)];
57607
57787
  });
57608
57788
  }
@@ -58409,6 +58589,7 @@ function validateComposition(composition, ctx) {
58409
58589
  });
58410
58590
  const facts = new Map([...ctx.sources].flatMap(([key, source]) => source.kind === "found" ? [[key, {
58411
58591
  deviceType: source.deviceType,
58592
+ role: source.role,
58412
58593
  quantity: source.quantity
58413
58594
  }]] : []));
58414
58595
  const problems = [
@@ -66604,6 +66785,15 @@ var HeroTextSchema = zod.z.object({
66604
66785
  it: zod.z.string()
66605
66786
  });
66606
66787
  /**
66788
+ * What a device that has not reported says in place of its value: an empty "—",
66789
+ * never a word like "Unknown" and never a 0 (D393). The card stays its normal
66790
+ * self; only the value is empty.
66791
+ */
66792
+ var NOT_REPORTED = {
66793
+ en: "—",
66794
+ it: "—"
66795
+ };
66796
+ /**
66607
66797
  * The ONE measurement a simple sensor shows (card wave, phase 1).
66608
66798
  *
66609
66799
  * A sensor that measures a single quantity (a temperature, a humidity, a power,
@@ -66758,6 +66948,62 @@ function textMeasurement(text, since) {
66758
66948
  historyKey: null
66759
66949
  };
66760
66950
  }
66951
+ /** What each quantity draws beside its value, reported or not. */
66952
+ var QUANTITY_FACE = {
66953
+ temperature: {
66954
+ icon: "thermometer",
66955
+ unit: "°C",
66956
+ sinceKind: "updated",
66957
+ historyKey: "cap:temperature-sensor.temperature"
66958
+ },
66959
+ humidity: {
66960
+ icon: "droplets",
66961
+ unit: "%",
66962
+ sinceKind: "updated",
66963
+ historyKey: "cap:humidity-sensor.humidity"
66964
+ },
66965
+ power: {
66966
+ icon: "zap",
66967
+ unit: "W",
66968
+ sinceKind: "updated",
66969
+ historyKey: "cap:power-meter.power"
66970
+ },
66971
+ contact: {
66972
+ icon: null,
66973
+ unit: null,
66974
+ sinceKind: "changed",
66975
+ historyKey: null
66976
+ },
66977
+ text: {
66978
+ icon: null,
66979
+ unit: null,
66980
+ sinceKind: "updated",
66981
+ historyKey: null
66982
+ }
66983
+ };
66984
+ /**
66985
+ * The measurement of a sensor that has not reported yet: its normal card with
66986
+ * an empty "—" value and its unit — never a placeholder, never a 0 (D393). The
66987
+ * reading is `null` (nothing to format), the scene does not move, and nothing
66988
+ * claims a moment.
66989
+ */
66990
+ function emptyMeasurement(quantity) {
66991
+ const face = QUANTITY_FACE[quantity];
66992
+ return {
66993
+ quantity,
66994
+ reading: null,
66995
+ icon: face.icon,
66996
+ value: NOT_REPORTED,
66997
+ unit: face.unit,
66998
+ band: null,
66999
+ level: null,
67000
+ word: NOT_REPORTED,
67001
+ tone: "muted",
67002
+ since: null,
67003
+ sinceKind: face.sinceKind,
67004
+ historyKey: face.historyKey
67005
+ };
67006
+ }
66761
67007
  /**
66762
67008
  * Roles whose reading is ANOTHER field of the slice a measurement comes from: an
66763
67009
  * energy, voltage or current sensor rides the `power-meter` slice, which also carries
@@ -66885,6 +67131,7 @@ var HERO_SCENE_BY_ROLE = {
66885
67131
  [DeviceRole.Outlet]: "plug",
66886
67132
  [DeviceRole.SwitchHeater]: "heater",
66887
67133
  [DeviceRole.SwitchFan]: "fan",
67134
+ [DeviceRole.SwitchLight]: "light",
66888
67135
  [DeviceRole.ClimateAc]: "ac",
66889
67136
  [DeviceRole.ClimateThermostat]: "inherit",
66890
67137
  [DeviceRole.ClimateFloor]: "inherit",
@@ -66931,17 +67178,17 @@ var HERO_SCENE_BY_ROLE = {
66931
67178
  [DeviceRole.GenericNotifier]: "inherit",
66932
67179
  [DeviceRole.IrTransmitter]: "inherit"
66933
67180
  };
66934
- function isDeviceType$2(type) {
67181
+ function isDeviceType$3(type) {
66935
67182
  return Object.values(DeviceType).includes(type);
66936
67183
  }
66937
- function isDeviceRole$1(role) {
67184
+ function isDeviceRole$2(role) {
66938
67185
  return Object.values(DeviceRole).includes(role);
66939
67186
  }
66940
67187
  /** The scene id of a (role, type) pair. Role beats type; a type this build does not know gets the terminal. */
66941
67188
  function resolveHeroSceneId(role, type) {
66942
- const byRole = role !== null && isDeviceRole$1(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
67189
+ const byRole = role !== null && isDeviceRole$2(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
66943
67190
  if (byRole !== void 0 && byRole !== "inherit") return byRole;
66944
- return isDeviceType$2(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
67191
+ return isDeviceType$3(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
66945
67192
  }
66946
67193
  var HeroRowIdSchema = zod.z.enum([
66947
67194
  "progress",
@@ -101358,71 +101605,6 @@ var DeclaredDevices = class {
101358
101605
  return removed;
101359
101606
  }
101360
101607
  };
101361
- /**
101362
- * A device's KIND is its type plus its role (D1033): the type is the set of
101363
- * controls it has, the role says which thing it is among the devices that
101364
- * share those controls. A plug-in heater is a `switch` with role
101365
- * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
101366
- * told apart by their `climate-*` role.
101367
- */
101368
- /**
101369
- * Type values a persisted row may still carry after the type was retired, and
101370
- * the type each one is read as. The row is rewritten by the next registration
101371
- * of the device (its provider stamps the live type), so this is a read alias,
101372
- * not a migration.
101373
- *
101374
- * `heater` is deliberately absent: the only heaters were composed devices the
101375
- * operator deletes. Such a row stays an unknown type, which every reader
101376
- * treats as a generic device.
101377
- */
101378
- var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
101379
- /** The live type a stored `type` value stands for (itself unless retired). */
101380
- function canonicalStoredDeviceType(stored) {
101381
- return RETIRED_DEVICE_TYPES[stored] ?? stored;
101382
- }
101383
- /** The `climate-*` roles, in the order the role picker lists them. */
101384
- var CLIMATE_ROLES = [
101385
- DeviceRole.ClimateThermostat,
101386
- DeviceRole.ClimateAc,
101387
- DeviceRole.ClimateRadiator,
101388
- DeviceRole.ClimateFloor,
101389
- DeviceRole.ClimateHeater,
101390
- DeviceRole.ClimateHeatPumpCircuit
101391
- ];
101392
- function isClimateRole(role) {
101393
- return CLIMATE_ROLES.some((candidate) => candidate === role);
101394
- }
101395
- /**
101396
- * Which climate device this is. A climate device with no role, or a role that
101397
- * is not a climate one, is a room thermostat: that is what most of them are,
101398
- * and it is the presentation a thermostat had before the types were folded.
101399
- */
101400
- function climateRoleOf(role) {
101401
- return role !== null && role !== void 0 && isClimateRole(role) ? role : DeviceRole.ClimateThermostat;
101402
- }
101403
- /** An air conditioner: exports present it as an AC unit, not a thermostat. */
101404
- function isAirConditioner(type, role) {
101405
- return type === DeviceType.Climate && climateRoleOf(role) === DeviceRole.ClimateAc;
101406
- }
101407
- /**
101408
- * Is a capability offered on a device of this type and role?
101409
- *
101410
- * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
101411
- * list) applies to every device, and an unknown type never filters (a failed
101412
- * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
101413
- * is offered only to the roles listed there; an unknown role is NOT one of
101414
- * them, so a `switch` whose role could not be read is not a heater.
101415
- */
101416
- function capAppliesToDeviceKind(gate, deviceType, role) {
101417
- if (deviceType === void 0) return true;
101418
- const types = gate?.deviceTypes;
101419
- if (!types || types.length === 0) return true;
101420
- const type = types.find((candidate) => candidate === deviceType);
101421
- if (type === void 0) return false;
101422
- const roles = gate?.deviceRoles?.[type];
101423
- if (roles === void 0) return true;
101424
- return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
101425
- }
101426
101608
  DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
101427
101609
  new Set(Object.values(DeviceType));
101428
101610
  /** True when a value is a navigable node: a plain object OR a tRPC v11 client
@@ -101578,7 +101760,7 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
101578
101760
  const state = slice?.state ?? null;
101579
101761
  const words = state === null ? null : LOCK_WORDS[state];
101580
101762
  const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
101581
- const title = words?.title ?? t("Unknown", "Sconosciuto");
101763
+ const title = words?.title ?? NOT_REPORTED;
101582
101764
  return {
101583
101765
  reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
101584
101766
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
@@ -101670,7 +101852,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
101670
101852
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
101671
101853
  return {
101672
101854
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
101673
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
101855
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
101674
101856
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
101675
101857
  ...words === null ? {} : { tiles: {
101676
101858
  left: [{
@@ -101701,7 +101883,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
101701
101883
  return {
101702
101884
  reading: reading("automation-control", state, false, title),
101703
101885
  rows: [row$1("automation", "workflow", joinText([
101704
- title ?? t("Unknown", "Sconosciuto"),
101886
+ title ?? NOT_REPORTED,
101705
101887
  last === null ? null : t(`Ran ${last.en}`, `Eseguita ${last.it}`),
101706
101888
  slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
101707
101889
  ]), [asAction(run), toggle])],
@@ -101717,7 +101899,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
101717
101899
  return {
101718
101900
  reading: reading("script-runner", state, false, title),
101719
101901
  rows: [row$1("script", "scroll-text", joinText([
101720
- title ?? t("Unknown", "Sconosciuto"),
101902
+ title ?? NOT_REPORTED,
101721
101903
  last === null ? null : t(`Ran ${last.en}`, `Eseguito ${last.it}`),
101722
101904
  slice?.lastError == null ? null : t(slice.lastError, slice.lastError)
101723
101905
  ]), [asAction(control)])],
@@ -101726,7 +101908,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
101726
101908
  }),
101727
101909
  "do-not-disturb": contribution("do-not-disturb", DoNotDisturbStatusSchema, (slice) => {
101728
101910
  const on = slice?.enabled ?? null;
101729
- return { rows: [row$1("do-not-disturb", "bell-off", on === null ? t("Unknown", "Sconosciuto") : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
101911
+ return { rows: [row$1("do-not-disturb", "bell-off", on === null ? NOT_REPORTED : on ? t("Do not disturb on", "Non disturbare attivo") : t("Do not disturb off", "Non disturbare spento"), [{
101730
101912
  kind: "toggle",
101731
101913
  id: "do-not-disturb.toggle",
101732
101914
  label: t("Do not disturb", "Non disturbare"),
@@ -101744,7 +101926,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
101744
101926
  * is absent from the facts, never a zero (D393).
101745
101927
  */
101746
101928
  var has$3 = (ctx, f) => ctx.features.includes(f);
101747
- var unknownText = t("Unknown", "Sconosciuto");
101929
+ var unknownText = NOT_REPORTED;
101748
101930
  var pct$2 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
101749
101931
  var unit = (n) => Math.min(1, Math.max(0, n / 100));
101750
101932
  /** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
@@ -103150,13 +103332,13 @@ function sensorFragment(value, id, icon, en, it, text) {
103150
103332
  tiles: { right: [tile$1(en, it, text)] }
103151
103333
  };
103152
103334
  }
103153
- var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? void 0 : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
103154
- var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? void 0 : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
103335
+ var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => measured(sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)), slice?.temperature == null ? emptyMeasurement("temperature") : temperatureMeasurement(slice.temperature, slice.lastFetchedAt)));
103336
+ var humidityContribution = contribution("humidity-sensor", HumiditySensorStatusSchema, (slice) => measured(sensorFragment(slice?.humidity ?? null, "humidity", "droplets", "Humidity", "Umidità", `${Math.round(slice?.humidity ?? 0)}%`), slice?.humidity == null ? emptyMeasurement("humidity") : humidityMeasurement(slice.humidity, slice.lastFetchedAt)));
103155
103337
  var pressureContribution = contribution("pressure-sensor", PressureSensorStatusSchema, (slice) => sensorFragment(slice?.pressure ?? null, "pressure", "gauge", "Pressure", "Pressione", `${Math.round(slice?.pressure ?? 0)} hPa`));
103156
103338
  var illuminanceContribution = contribution("ambient-light-sensor", AmbientLightSensorStatusSchema, (slice) => sensorFragment(slice?.illuminance ?? null, "illuminance", "sun", "Light", "Luce", `${Math.round(slice?.illuminance ?? 0)} lx`));
103157
103339
  var numericContribution = contribution("numeric-sensor", NumericSensorStatusSchema, (slice) => sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", String(Number((slice?.value ?? 0).toFixed(2)))));
103158
103340
  var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
103159
- if (slice === void 0 || slice.value === "") return { reading: reading("sensor", "unknown") };
103341
+ if (slice === void 0 || slice.value === "") return measured({ reading: reading("sensor", "unknown") }, emptyMeasurement("text"));
103160
103342
  if (slice.timestamp === true) return { reading: reading("sensor", "on") };
103161
103343
  return measured(sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value), textMeasurement(slice.value, slice.lastFetchedAt));
103162
103344
  });
@@ -103280,7 +103462,7 @@ function circuitControl(circuit) {
103280
103462
  return picker(`heat-pump.${circuit.id}.mode`, t("Mode", "Modalità"), circuit.operationMode, method, args);
103281
103463
  }
103282
103464
  /** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
103283
- var UNKNOWN_STATUS = same("—");
103465
+ var UNKNOWN_STATUS = NOT_REPORTED;
103284
103466
  function circuitRow(circuit) {
103285
103467
  const control = circuitControl(circuit);
103286
103468
  const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
@@ -103723,7 +103905,7 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
103723
103905
  };
103724
103906
  });
103725
103907
  var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
103726
- if (slice?.power === void 0) return {};
103908
+ if (slice?.power === void 0) return { measurement: emptyMeasurement("power") };
103727
103909
  const detail = [];
103728
103910
  if (slice.energy !== void 0) detail.push({
103729
103911
  label: t("Energy", "Energia"),
@@ -103811,14 +103993,14 @@ var contactContribution = contribution("contact", ContactStatusSchema, (slice) =
103811
103993
  const row = {
103812
103994
  id: "contact",
103813
103995
  icon: slice?.entryOpen === true ? "door-open" : "door-closed",
103814
- status: slice === void 0 ? t("Unknown", "Sconosciuto") : slice.entryOpen ? t("Open", "Aperto") : t("Closed", "Chiuso"),
103996
+ status: slice === void 0 ? NOT_REPORTED : slice.entryOpen ? t("Open", "Aperto") : t("Closed", "Chiuso"),
103815
103997
  controls: []
103816
103998
  };
103817
103999
  return measured({
103818
104000
  reading: reading("contact", slice === void 0 ? "unknown" : slice.entryOpen ? "on" : "off"),
103819
104001
  rows: [row],
103820
104002
  ...slice === void 0 ? {} : { scene: { mode: slice.entryOpen ? "open" : "closed" } }
103821
- }, slice === void 0 ? void 0 : contactMeasurement(slice.entryOpen, slice.lastChangedAt > 0 ? slice.lastChangedAt : null));
104003
+ }, slice === void 0 ? emptyMeasurement("contact") : contactMeasurement(slice.entryOpen, slice.lastChangedAt > 0 ? slice.lastChangedAt : null));
103822
104004
  });
103823
104005
  var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStatusSchema, (slice) => {
103824
104006
  const on = slice?.enabled ?? null;
@@ -103833,7 +104015,7 @@ var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStat
103833
104015
  return { rows: [{
103834
104016
  id: "motion-trigger",
103835
104017
  icon: "activity",
103836
- status: on === null ? t("Unknown", "Sconosciuto") : on ? t("Follows motion", "Segue il movimento") : t("Ignores motion", "Ignora il movimento"),
104018
+ status: on === null ? NOT_REPORTED : on ? t("Follows motion", "Segue il movimento") : t("Ignores motion", "Ignora il movimento"),
103837
104019
  controls: [toggle]
103838
104020
  }] };
103839
104021
  });
@@ -104320,13 +104502,14 @@ var HERO_LAYOUT_BY_TYPE = {
104320
104502
  [DeviceType.Dryer]: APPLIANCE_LAYOUT,
104321
104503
  [DeviceType.Gateway]: HERO_LAYOUT_DEFAULT
104322
104504
  };
104323
- function isDeviceType$1(type) {
104505
+ function isDeviceType$2(type) {
104324
104506
  return Object.values(DeviceType).includes(type);
104325
104507
  }
104326
104508
  /** The layout of a type; a type this build does not know gets the default. */
104327
104509
  function resolveHeroLayout(type, role = null) {
104328
104510
  if (type === DeviceType.Switch && role === DeviceRole.SwitchHeater) return HEATER_LAYOUT;
104329
- return isDeviceType$1(type) ? HERO_LAYOUT_BY_TYPE[type] : HERO_LAYOUT_DEFAULT;
104511
+ const live = canonicalStoredDeviceType(type);
104512
+ return isDeviceType$2(live) ? HERO_LAYOUT_BY_TYPE[live] : HERO_LAYOUT_DEFAULT;
104330
104513
  }
104331
104514
  /**
104332
104515
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
@@ -104350,9 +104533,8 @@ function look(icon, tone, background, animation) {
104350
104533
  animation
104351
104534
  };
104352
104535
  }
104353
- /** A state a device is in whatever it is: unreachable, or silent. Identical for every look. */
104536
+ /** Unreachable: identical for every look. */
104354
104537
  var OFFLINE = look("wifi-off", "muted", "plain", "none");
104355
- var UNKNOWN = look("circle-question-mark", "muted", "plain", "none");
104356
104538
  var ALERT = look("triangle-alert", "danger", "alert-wash", "pulse");
104357
104539
  function lookOf(spec) {
104358
104540
  const at = (s) => look(spec.icon, s[0], s[1], s[2]);
@@ -104364,7 +104546,7 @@ function lookOf(spec) {
104364
104546
  standby: at(spec.standby),
104365
104547
  alert: spec.alert ?? ALERT,
104366
104548
  offline: OFFLINE,
104367
- unknown: UNKNOWN
104549
+ unknown: look(spec.icon, "muted", "plain", "none")
104368
104550
  };
104369
104551
  }
104370
104552
  var MUTED = [
@@ -105066,6 +105248,7 @@ var HERO_LOOK_BY_ROLE = {
105066
105248
  [DeviceRole.Outlet]: "inherit",
105067
105249
  [DeviceRole.SwitchHeater]: HEATER_LOOK,
105068
105250
  [DeviceRole.SwitchFan]: FAN_LOOK,
105251
+ [DeviceRole.SwitchLight]: LIGHT_LOOK,
105069
105252
  [DeviceRole.ClimateAc]: "inherit",
105070
105253
  [DeviceRole.ClimateThermostat]: "inherit",
105071
105254
  [DeviceRole.ClimateFloor]: "inherit",
@@ -105112,10 +105295,10 @@ var HERO_LOOK_BY_ROLE = {
105112
105295
  [DeviceRole.GenericNotifier]: "inherit",
105113
105296
  [DeviceRole.IrTransmitter]: "inherit"
105114
105297
  };
105115
- function isDeviceType(type) {
105298
+ function isDeviceType$1(type) {
105116
105299
  return Object.values(DeviceType).includes(type);
105117
105300
  }
105118
- function isDeviceRole(role) {
105301
+ function isDeviceRole$1(role) {
105119
105302
  return Object.values(DeviceRole).includes(role);
105120
105303
  }
105121
105304
  /**
@@ -105123,14 +105306,14 @@ function isDeviceRole(role) {
105123
105306
  * A climate device that is on draws its MODE (`mode` is the scene's); a role never loses to it.
105124
105307
  */
105125
105308
  function resolveHeroLook(role, type, state, mode = null) {
105126
- const byRole = role !== null && isDeviceRole(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
105309
+ const byRole = role !== null && isDeviceRole$1(role) ? HERO_LOOK_BY_ROLE[role] : void 0;
105127
105310
  if (byRole !== void 0 && byRole !== "inherit") return byRole[state];
105128
105311
  if (mode !== null && (state === "on" || state === "running") && MODE_LOOK_TYPES.includes(type)) {
105129
105312
  const byMode = HERO_MODE_LOOK[mode];
105130
105313
  if (byMode !== null) return byMode;
105131
105314
  }
105132
105315
  if (isAirConditioner(type, role)) return CLIMATE_LOOK[state];
105133
- return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
105316
+ return ((isDeviceType$1(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
105134
105317
  }
105135
105318
  /** The media player's offer outranks a bound switch: the player's own state is the device's. */
105136
105319
  var OWN_POWER_SOURCE_ORDER = [
@@ -105203,7 +105386,7 @@ var STATE_TEXT = {
105203
105386
  standby: t("Standby", "In standby"),
105204
105387
  alert: t("Alert", "Allarme"),
105205
105388
  offline: t("Offline", "Non raggiungibile"),
105206
- unknown: t("Unknown", "Sconosciuto")
105389
+ unknown: NOT_REPORTED
105207
105390
  };
105208
105391
  function pickReading(readings) {
105209
105392
  for (const source of STATE_SOURCE_ORDER) {
@@ -116015,6 +116198,10 @@ function offered(received) {
116015
116198
  };
116016
116199
  }
116017
116200
  offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
116201
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.HeatPump, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
116202
+ 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;
116203
+ new Set(Object.values(DeviceType));
116204
+ new Set(Object.values(DeviceRole));
116018
116205
  /**
116019
116206
  * Runtime list of cap names with status. Used by the settings
116020
116207
  * aggregator to enumerate caps whose `status` should be polled +
@@ -122667,12 +122854,24 @@ Object.defineProperty(exports, "canonicalIconKey", {
122667
122854
  return canonicalIconKey;
122668
122855
  }
122669
122856
  });
122857
+ Object.defineProperty(exports, "canonicalStoredBlockTarget", {
122858
+ enumerable: true,
122859
+ get: function() {
122860
+ return canonicalStoredBlockTarget;
122861
+ }
122862
+ });
122670
122863
  Object.defineProperty(exports, "canonicalStoredDeviceType", {
122671
122864
  enumerable: true,
122672
122865
  get: function() {
122673
122866
  return canonicalStoredDeviceType;
122674
122867
  }
122675
122868
  });
122869
+ Object.defineProperty(exports, "canonicalStoredStepTargets", {
122870
+ enumerable: true,
122871
+ get: function() {
122872
+ return canonicalStoredStepTargets;
122873
+ }
122874
+ });
122676
122875
  Object.defineProperty(exports, "capAppliesToDeviceKind", {
122677
122876
  enumerable: true,
122678
122877
  get: function() {