@camstack/addon-export-google 0.1.123 → 0.1.124

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.
@@ -863,7 +863,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
863
863
  return EventCategory;
864
864
  }({});
865
865
  //#endregion
866
- //#region ../types/dist/device-type-BOWLtoOt.mjs
866
+ //#region ../types/dist/device-type-D1fH5kaC.mjs
867
867
  /**
868
868
  import { errMsg } from '@camstack/types'
869
869
  * Extract a human-readable message from an unknown error value.
@@ -1052,6 +1052,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1052
1052
  DeviceFeature["CoverPositionable"] = "cover-positionable";
1053
1053
  /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
1054
1054
  DeviceFeature["CoverTilt"] = "cover-tilt";
1055
+ /** Cover has a real stop: `stop` halts the travel in place. Gates the stop
1056
+ * control in exporters; a provider whose `stop` is a no-op never declares it. */
1057
+ DeviceFeature["CoverStoppable"] = "cover-stoppable";
1055
1058
  /** Valve exposes intermediate position control (0..100). Gates the
1056
1059
  * position slider / drag surface UI. */
1057
1060
  DeviceFeature["ValvePositionable"] = "valve-positionable";
@@ -1091,6 +1094,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1091
1094
  DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1092
1095
  /** Media player exposes stop distinct from pause. */
1093
1096
  DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1097
+ /** Media player exposes volume up / down in steps (an infrared TV has no level). */
1098
+ DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
1099
+ /** Media player exposes channel up / down in steps. */
1100
+ DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1101
+ /** Media player exposes power on / off. */
1102
+ DeviceFeature["MediaPlayerPower"] = "media-player-power";
1094
1103
  /** Alarm panel requires a PIN code on arm/disarm. */
1095
1104
  DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1096
1105
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
@@ -5917,7 +5926,7 @@ var ZodIssueCode = {
5917
5926
  var ZodFirstPartyTypeKind;
5918
5927
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5919
5928
  //#endregion
5920
- //#region ../types/dist/sleep-CdJHPm-k.mjs
5929
+ //#region ../types/dist/sleep-BkzQdpzF.mjs
5921
5930
  /**
5922
5931
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5923
5932
  * window to float samples (D455).
@@ -5996,6 +6005,22 @@ function buildAlawTable() {
5996
6005
  }
5997
6006
  buildUlawTable();
5998
6007
  buildAlawTable();
6008
+ /**
6009
+ * An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
6010
+ * so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
6011
+ * co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
6012
+ * bundles its own copy of this module, so the class the runner sees is not the one that threw.
6013
+ */
6014
+ var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
6015
+ var AddonMigrationsBlockedError = class extends Error {
6016
+ /** The ledger ids that did not apply and block the owner. */
6017
+ migrationIds;
6018
+ constructor(migrationIds) {
6019
+ super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
6020
+ this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
6021
+ this.migrationIds = migrationIds;
6022
+ }
6023
+ };
5999
6024
  /** Is this field's stored value a credential? */
6000
6025
  function isSecretConfigField(field) {
6001
6026
  if (field.type === "password") return true;
@@ -7649,7 +7674,7 @@ var BaseAddon = class {
7649
7674
  startMigration: (input) => api.startMigration.mutate(input),
7650
7675
  finishMigration: (input) => api.finishMigration.mutate(input)
7651
7676
  }, migrations, this.ctx.logger);
7652
- if (report.blockOwner.length > 0) throw new Error(`migration(s) ${report.blockOwner.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
7677
+ if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7653
7678
  return report;
7654
7679
  }
7655
7680
  /**
@@ -7989,6 +8014,10 @@ var BaseAddon = class {
7989
8014
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7990
8015
  const patch = {};
7991
8016
  for (const key of keys) {
8017
+ if (tree.get(key)?.kind === "array") {
8018
+ patch[key] = [];
8019
+ continue;
8020
+ }
7992
8021
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7993
8022
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7994
8023
  }
@@ -9385,6 +9414,7 @@ var CAP_NAMES = Object.freeze([
9385
9414
  "backup",
9386
9415
  "battery",
9387
9416
  "binary",
9417
+ "board-key-source",
9388
9418
  "brightness",
9389
9419
  "broker",
9390
9420
  "button",
@@ -9506,6 +9536,7 @@ var CAP_NAMES = Object.freeze([
9506
9536
  "privacy-mask",
9507
9537
  "ptz",
9508
9538
  "ptz-autotrack",
9539
+ "pump-cycle",
9509
9540
  "reboot",
9510
9541
  "record-entries",
9511
9542
  "recording",
@@ -10798,18 +10829,6 @@ Object.freeze({
10798
10829
  "path": "pumpRunning",
10799
10830
  "valueType": "boolean"
10800
10831
  },
10801
- {
10802
- "path": "pumpIntervalEnabled",
10803
- "valueType": "boolean"
10804
- },
10805
- {
10806
- "path": "pumpOnTime",
10807
- "valueType": "number"
10808
- },
10809
- {
10810
- "path": "pumpOffTime",
10811
- "valueType": "number"
10812
- },
10813
10832
  {
10814
10833
  "path": "lastDrink",
10815
10834
  "valueType": "number"
@@ -10933,6 +10952,20 @@ Object.freeze({
10933
10952
  "valueType": "number"
10934
10953
  }
10935
10954
  ],
10955
+ "pump-cycle": [
10956
+ {
10957
+ "path": "enabled",
10958
+ "valueType": "boolean"
10959
+ },
10960
+ {
10961
+ "path": "onTime",
10962
+ "valueType": "number"
10963
+ },
10964
+ {
10965
+ "path": "offTime",
10966
+ "valueType": "number"
10967
+ }
10968
+ ],
10936
10969
  "recording-archive": [
10937
10970
  {
10938
10971
  "path": "deviceId",
@@ -11382,7 +11415,7 @@ object({
11382
11415
  params: record(string(), union([string(), number()])).optional()
11383
11416
  });
11384
11417
  //#endregion
11385
- //#region ../types/dist/composition-BDUoQsw9.mjs
11418
+ //#region ../types/dist/composition-CRNwcFYY.mjs
11386
11419
  /**
11387
11420
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11388
11421
  *
@@ -12145,38 +12178,6 @@ function validateExpressionSource(src) {
12145
12178
  return null;
12146
12179
  }
12147
12180
  /**
12148
- * One power reading becomes a washer, dryer or dishwasher (D944 helper).
12149
- *
12150
- * Standby of the control board is under 5 W; a motor or a heater is far
12151
- * above that, so 5 W is the line. A door lock or a short pump spike is not
12152
- * a cycle, so running starts only after 30 s above the line.
12153
- *
12154
- * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
12155
- * bursts) lasts several minutes. Ending the cycle on the first dip would
12156
- * report "finished" in the middle of the program, so the stop dwell is
12157
- * 10 minutes on every type. The number is stored per type so one machine
12158
- * can move later without moving the others.
12159
- */
12160
- var APPLIANCE_TEMPLATE_ID = "appliance";
12161
- var APPLIANCE_KINDS = [
12162
- "washer",
12163
- "dryer",
12164
- "dishwasher"
12165
- ];
12166
- DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
12167
- /**
12168
- * A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
12169
- *
12170
- * The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
12171
- * (D967), so the heater switches exactly as the plug does. Running is the
12172
- * plug being on; when a power reading is also named, running is the draw
12173
- * staying above the line instead (a plug left on with the stove's own
12174
- * thermostat open is not heating). 50 W is far above any standby and below
12175
- * the smallest radiator.
12176
- */
12177
- var HEATER_TEMPLATE_ID = "heater";
12178
- DeviceType.Heater;
12179
- /**
12180
12181
  * Statistics and integrals over a history read (D944).
12181
12182
  *
12182
12183
  * Pure: the same points always give the same answer, so a restart recomputes
@@ -12320,34 +12321,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
12320
12321
  /** Actuator groups only. Readings leave this unset. */
12321
12322
  active: ActiveCriterionSchema.optional()
12322
12323
  }),
12323
- object({
12324
- kind: literal("appliance"),
12325
- templateId: literal(APPLIANCE_TEMPLATE_ID),
12326
- appliance: _enum(APPLIANCE_KINDS),
12327
- thresholdWatts: number().positive(),
12328
- startDwellMs: number().int().nonnegative(),
12329
- stopDwellMs: number().int().nonnegative(),
12330
- member: HelperMemberSchema,
12331
- /**
12332
- * The plug that powers the appliance (`switch.on`). Optional: when set, the
12333
- * composition carries a `power-source` feature, so the hub can cut and restore
12334
- * that plug (power-source link of a NEW-target composition).
12335
- */
12336
- powerSwitch: HelperMemberSchema.optional(),
12337
- /** How long a forced restart keeps the plug off; the cap's default when unset. */
12338
- offSeconds: number().optional()
12339
- }),
12340
- object({
12341
- kind: literal("heater"),
12342
- templateId: literal(HEATER_TEMPLATE_ID),
12343
- /** The plug, read and commanded at `switch.on`. */
12344
- plug: HelperMemberSchema,
12345
- /** The plug's power reading, when it has one: running is then the draw, not the switch. */
12346
- meter: HelperMemberSchema.optional(),
12347
- thresholdWatts: number().positive(),
12348
- startDwellMs: number().int().nonnegative(),
12349
- stopDwellMs: number().int().nonnegative()
12350
- }),
12351
12324
  object({
12352
12325
  kind: literal("statistic"),
12353
12326
  stat: _enum(STATISTIC_STATS),
@@ -12519,7 +12492,14 @@ var CompositionForwardCommandSchema = object({
12519
12492
  method: string().min(1),
12520
12493
  args: record(string().min(1), CompositionForwardArgSchema).optional()
12521
12494
  });
12522
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
12495
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [
12496
+ CompositionForwardCommandSchema,
12497
+ CompositionCodeSourceSchema,
12498
+ object({
12499
+ kind: literal("extension"),
12500
+ target: literal("remote")
12501
+ })
12502
+ ]);
12523
12503
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
12524
12504
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
12525
12505
  /**
@@ -12564,7 +12544,7 @@ var CompositionSchema = object({
12564
12544
  kind: literal("existing"),
12565
12545
  device: CompositionSourceRefSchema
12566
12546
  })]),
12567
- features: array(CompositionFeatureSchema).min(1).max(16),
12547
+ features: array(CompositionFeatureSchema).min(0).max(16),
12568
12548
  /**
12569
12549
  * Present when the block is a helper template. Absent on a free
12570
12550
  * composition (the room example, device 4603). The editor reads this,
@@ -12596,6 +12576,73 @@ var NodeColorIdSchema = _enum([
12596
12576
  "node-g",
12597
12577
  "node-h"
12598
12578
  ]);
12579
+ //#endregion
12580
+ //#region ../types/dist/index.mjs
12581
+ var SMTP_INBOUND_DEFAULT_PORT = 2525;
12582
+ var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
12583
+ var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
12584
+ /** The text excerpt a message carries on the bus. */
12585
+ var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
12586
+ var PortSchema = number().int().min(1).max(65535);
12587
+ /** A recipient local-part: what stands before the `@`. */
12588
+ var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
12589
+ object({
12590
+ port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
12591
+ bindHost: string().min(1).default("0.0.0.0"),
12592
+ domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
12593
+ requireAuth: boolean().default(true),
12594
+ username: string().default(""),
12595
+ password: string().default("").meta({ secret: true }),
12596
+ starttls: boolean().default(false),
12597
+ maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
12598
+ });
12599
+ object({
12600
+ host: string().min(1).nullable(),
12601
+ hostReason: string().nullable(),
12602
+ port: PortSchema,
12603
+ domain: string().min(1),
12604
+ requireAuth: boolean(),
12605
+ username: string(),
12606
+ password: string(),
12607
+ starttls: boolean()
12608
+ });
12609
+ object({
12610
+ recipients: array(SmtpRecipientSchema).min(1),
12611
+ /**
12612
+ * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
12613
+ * recipients (the way a consumer that restarted, or lost a device, declares its set again);
12614
+ * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
12615
+ * Absent, the subscriber is anonymous and unique.
12616
+ */
12617
+ subscriberId: string().min(1).max(64).optional()
12618
+ });
12619
+ var SmtpInboundAttachmentSchema = object({
12620
+ filename: string(),
12621
+ contentType: string(),
12622
+ bytes: number().int().nonnegative()
12623
+ });
12624
+ /** The payload of one `broker.message` (the key is the recipient local-part). */
12625
+ var SmtpInboundMessageSchema = object({
12626
+ /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
12627
+ seq: number().int().positive(),
12628
+ messageId: string(),
12629
+ receivedAt: number().int().nonnegative(),
12630
+ from: string(),
12631
+ to: string(),
12632
+ subject: string(),
12633
+ text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
12634
+ attachments: array(SmtpInboundAttachmentSchema)
12635
+ });
12636
+ object({
12637
+ /** The newest seq issued so far (0 before any mail). */
12638
+ lastSeq: number().int().nonnegative(),
12639
+ /** The oldest seq still retained; messages below it are gone. */
12640
+ oldestSeq: number().int().nonnegative(),
12641
+ messages: array(object({
12642
+ key: string(),
12643
+ message: SmtpInboundMessageSchema
12644
+ }))
12645
+ });
12599
12646
  new Set([
12600
12647
  "track",
12601
12648
  "face",
@@ -19002,24 +19049,52 @@ var APPLIANCE_CAP_VOCABULARY = {
19002
19049
  args: { on: false }
19003
19050
  },
19004
19051
  {
19005
- id: "petFountain.intervalOn",
19006
- method: "setPumpInterval",
19052
+ id: "petFountain.resetDailyConsumption",
19053
+ method: "resetDailyConsumption",
19054
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19055
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19056
+ icon: "rotate-ccw"
19057
+ }
19058
+ ],
19059
+ state: [{
19060
+ kind: "boolean",
19061
+ field: "empty",
19062
+ label: t("Tank empty", "Serbatoio vuoto"),
19063
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19064
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19065
+ icon: "droplet"
19066
+ }, {
19067
+ kind: "numeric",
19068
+ field: "waterLevel",
19069
+ quantity: t("the water level", "il livello dell’acqua"),
19070
+ label: t("Water level", "Livello dell’acqua"),
19071
+ unit: "%",
19072
+ icon: "droplets"
19073
+ }]
19074
+ },
19075
+ "pump-cycle": {
19076
+ scope: "device",
19077
+ noun: t("Pump cycle", "Ciclo della pompa"),
19078
+ actions: [
19079
+ {
19080
+ id: "pumpCycle.on",
19081
+ method: "setEnabled",
19007
19082
  label: t("Pump cycle on", "Ciclo pompa attivo"),
19008
19083
  phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
19009
19084
  icon: "timer",
19010
19085
  args: { on: true }
19011
19086
  },
19012
19087
  {
19013
- id: "petFountain.intervalOff",
19014
- method: "setPumpInterval",
19088
+ id: "pumpCycle.off",
19089
+ method: "setEnabled",
19015
19090
  label: t("Pump cycle off", "Ciclo pompa spento"),
19016
19091
  phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
19017
19092
  icon: "timer-off",
19018
19093
  args: { on: false }
19019
19094
  },
19020
19095
  {
19021
- id: "petFountain.pumpOnMinutes",
19022
- method: "setPumpOnMinutes",
19096
+ id: "pumpCycle.onMinutes",
19097
+ method: "setOnMinutes",
19023
19098
  label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
19024
19099
  phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
19025
19100
  icon: "timer",
@@ -19035,8 +19110,8 @@ var APPLIANCE_CAP_VOCABULARY = {
19035
19110
  }]
19036
19111
  },
19037
19112
  {
19038
- id: "petFountain.pumpOffMinutes",
19039
- method: "setPumpOffMinutes",
19113
+ id: "pumpCycle.offMinutes",
19114
+ method: "setOffMinutes",
19040
19115
  label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
19041
19116
  phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
19042
19117
  icon: "timer-off",
@@ -19050,35 +19125,63 @@ var APPLIANCE_CAP_VOCABULARY = {
19050
19125
  unit: "min"
19051
19126
  }
19052
19127
  }]
19053
- },
19054
- {
19055
- id: "petFountain.resetDailyConsumption",
19056
- method: "resetDailyConsumption",
19057
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19058
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19059
- icon: "rotate-ccw"
19060
19128
  }
19061
19129
  ],
19062
19130
  state: [{
19063
19131
  kind: "boolean",
19064
- field: "empty",
19065
- label: t("Tank empty", "Serbatoio vuoto"),
19066
- whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19067
- whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19068
- icon: "droplet"
19069
- }, {
19070
- kind: "numeric",
19071
- field: "waterLevel",
19072
- quantity: t("the water level", "il livello dell’acqua"),
19073
- label: t("Water level", "Livello dell’acqua"),
19074
- unit: "%",
19075
- icon: "droplets"
19132
+ field: "enabled",
19133
+ label: t("Pump cycle", "Ciclo pompa"),
19134
+ whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
19135
+ whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
19136
+ icon: "timer"
19076
19137
  }]
19077
19138
  },
19078
19139
  "media-player": {
19079
19140
  scope: "device",
19080
19141
  noun: t("Media player", "Lettore multimediale"),
19081
19142
  actions: [
19143
+ {
19144
+ id: "media.turnOn",
19145
+ method: "turnOn",
19146
+ label: t("Turn on", "Accendi"),
19147
+ phrase: t("Turn on {device}", "Accendi {device}"),
19148
+ icon: "power"
19149
+ },
19150
+ {
19151
+ id: "media.turnOff",
19152
+ method: "turnOff",
19153
+ label: t("Turn off", "Spegni"),
19154
+ phrase: t("Turn off {device}", "Spegni {device}"),
19155
+ icon: "power"
19156
+ },
19157
+ {
19158
+ id: "media.volumeUp",
19159
+ method: "volumeUp",
19160
+ label: t("Volume up", "Alza il volume"),
19161
+ phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
19162
+ icon: "volume-2"
19163
+ },
19164
+ {
19165
+ id: "media.volumeDown",
19166
+ method: "volumeDown",
19167
+ label: t("Volume down", "Abbassa il volume"),
19168
+ phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
19169
+ icon: "volume-2"
19170
+ },
19171
+ {
19172
+ id: "media.channelUp",
19173
+ method: "channelUp",
19174
+ label: t("Channel up", "Canale successivo"),
19175
+ phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
19176
+ icon: "skip-forward"
19177
+ },
19178
+ {
19179
+ id: "media.channelDown",
19180
+ method: "channelDown",
19181
+ label: t("Channel down", "Canale precedente"),
19182
+ phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
19183
+ icon: "skip-back"
19184
+ },
19082
19185
  {
19083
19186
  id: "media.play",
19084
19187
  method: "play",
@@ -20965,6 +21068,7 @@ var SYSTEM_CAP_VOCABULARY = {
20965
21068
  "audio-analyzer": system(PIPELINE),
20966
21069
  "audio-codec": system(INTERNAL),
20967
21070
  "auth-provider": system(IDENTITY),
21071
+ "board-key-source": system(INTERNAL),
20968
21072
  backup: system("system backups — run and restored from the Backups page"),
20969
21073
  broker: system("message-broker connections — configured, not actuated"),
20970
21074
  "calendar-source": system(INTERNAL),
@@ -45511,6 +45615,49 @@ object({
45511
45615
  });
45512
45616
  DeviceType.Sensor;
45513
45617
  /**
45618
+ * Why a board key could not be read. Typed so a caller reports the cause and
45619
+ * never treats "could not read" as "has no key" (D49).
45620
+ */
45621
+ var BoardKeyFailureReasonSchema = _enum([
45622
+ "unknown-source",
45623
+ "not-admin",
45624
+ "no-builder",
45625
+ "no-ingress-url",
45626
+ "unreachable",
45627
+ "unknown-board",
45628
+ "no-encryption-key",
45629
+ "unreadable-config"
45630
+ ]);
45631
+ var BoardKeySourceSchema = object({
45632
+ sourceId: string(),
45633
+ name: string()
45634
+ });
45635
+ var BoardKeyBoardSchema = object({
45636
+ /** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
45637
+ configuration: string(),
45638
+ /** The node name the builder gives the board. */
45639
+ name: string(),
45640
+ /** The address the builder knows the board by, when it has one. */
45641
+ address: string().nullable()
45642
+ });
45643
+ var BoardKeyFailureSchema = object({
45644
+ ok: literal(false),
45645
+ reason: BoardKeyFailureReasonSchema,
45646
+ detail: string().optional()
45647
+ });
45648
+ var ListBoardsResultSchema = discriminatedUnion("ok", [object({
45649
+ ok: literal(true),
45650
+ boards: array(BoardKeyBoardSchema).readonly()
45651
+ }), BoardKeyFailureSchema]);
45652
+ var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
45653
+ ok: literal(true),
45654
+ key: string()
45655
+ }), BoardKeyFailureSchema]);
45656
+ method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
45657
+ sourceId: string().min(1),
45658
+ configuration: string().min(1)
45659
+ }), GetBoardKeyResultSchema, { auth: "admin" });
45660
+ /**
45514
45661
  * Dimmable-light brightness control. Co-exists with `switch` on the
45515
45662
  * same device — the switch toggles on/off, this cap sets the level
45516
45663
  * applied when the light is on. Drivers map their per-vendor dim
@@ -47599,6 +47746,188 @@ DeviceType.Control, method(object({
47599
47746
  kind: "mutation",
47600
47747
  auth: "protected"
47601
47748
  });
47749
+ /**
47750
+ * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
47751
+ * Apple TV, Spotify, Roku, generic OTT receivers, …) on
47752
+ * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
47753
+ * surface — those use `DeviceType.Camera` + the broker pipeline.
47754
+ *
47755
+ * The cap declares a wide method surface; not every backend supports
47756
+ * every method. Drivers signal sub-capability via the
47757
+ * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
47758
+ * corresponding method) so the UI gates buttons without a slice
47759
+ * fetch — same pattern as `PanTiltZoom` for cameras.
47760
+ */
47761
+ var MediaPlayerStateSchema = _enum([
47762
+ "off",
47763
+ "on",
47764
+ "idle",
47765
+ "playing",
47766
+ "paused",
47767
+ "buffering",
47768
+ "standby"
47769
+ ]);
47770
+ var MediaPlayerRepeatSchema = _enum([
47771
+ "off",
47772
+ "all",
47773
+ "one"
47774
+ ]);
47775
+ var MediaInfoSchema = object({
47776
+ /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
47777
+ * `podcast`, …). */
47778
+ type: string(),
47779
+ /** Human-readable title. */
47780
+ title: string(),
47781
+ /** Optional artist / channel / station label. */
47782
+ artist: string().optional(),
47783
+ /** Optional album / season / show name. */
47784
+ album: string().optional(),
47785
+ /** Optional cover-art / thumbnail URL. */
47786
+ imageUrl: string().optional()
47787
+ });
47788
+ /**
47789
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
47790
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
47791
+ * tracks what it last SENT; it moves only after a send was accepted, and a
47792
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
47793
+ * guess, never as a reading.
47794
+ */
47795
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
47796
+ /** The fields of a media-player status a driver can only guess. */
47797
+ var MediaPlayerAssumedFieldSchema = _enum([
47798
+ "state",
47799
+ "volumeLevel",
47800
+ "isMuted",
47801
+ "source"
47802
+ ]);
47803
+ var MediaPlayerStatusSchema = object({
47804
+ /** Playback lifecycle state. */
47805
+ state: MediaPlayerStateSchema,
47806
+ /**
47807
+ * Whether the state fields are readings or the driver's own bookkeeping.
47808
+ * A slice written before this field existed parses as `reported`.
47809
+ */
47810
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
47811
+ /**
47812
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
47813
+ * this is not empty; a field not listed here is a reading even then (power
47814
+ * from a running-state source, mute guessed from the last send).
47815
+ */
47816
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
47817
+ /** Volume as 0..100 inclusive. Null when the device has no volume
47818
+ * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
47819
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
47820
+ /** Mute toggle distinct from volume=0. Null when no mute surface.
47821
+ * Pair with `DeviceFeature.MediaPlayerMute`. */
47822
+ isMuted: boolean().nullable(),
47823
+ /** Active source / input. Empty when no source surface. */
47824
+ source: string(),
47825
+ /** Selectable sources. Empty when no source surface.
47826
+ * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
47827
+ availableSources: array(string()),
47828
+ /** Currently-playing media info. Null when nothing is playing. */
47829
+ currentMedia: MediaInfoSchema.nullable(),
47830
+ /** Current playback position in ms. Null when not seekable or
47831
+ * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
47832
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
47833
+ /** Total duration of the current media in ms. Null when unknown
47834
+ * (live stream) or nothing is playing. */
47835
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
47836
+ /** Shuffle toggle. Null when no shuffle surface.
47837
+ * Pair with `DeviceFeature.MediaPlayerShuffle`. */
47838
+ shuffle: boolean().nullable(),
47839
+ /** Repeat mode. Null when no repeat surface.
47840
+ * Pair with `DeviceFeature.MediaPlayerRepeat`. */
47841
+ repeat: MediaPlayerRepeatSchema.nullable(),
47842
+ /** Ms epoch when the slice was last updated. */
47843
+ lastChangedAt: number()
47844
+ });
47845
+ var stepInput = object({
47846
+ deviceId: number().int().nonnegative(),
47847
+ /** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
47848
+ steps: number().int().min(1).max(50).default(1)
47849
+ });
47850
+ var deviceOnly = object({ deviceId: number().int().nonnegative() });
47851
+ DeviceType.MediaPlayer, method(deviceOnly, _void(), {
47852
+ kind: "mutation",
47853
+ auth: "protected"
47854
+ }), method(deviceOnly, _void(), {
47855
+ kind: "mutation",
47856
+ auth: "protected"
47857
+ }), method(stepInput, _void(), {
47858
+ kind: "mutation",
47859
+ auth: "protected"
47860
+ }), method(stepInput, _void(), {
47861
+ kind: "mutation",
47862
+ auth: "protected"
47863
+ }), method(stepInput, _void(), {
47864
+ kind: "mutation",
47865
+ auth: "protected"
47866
+ }), method(stepInput, _void(), {
47867
+ kind: "mutation",
47868
+ auth: "protected"
47869
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47870
+ kind: "mutation",
47871
+ auth: "protected"
47872
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47873
+ kind: "mutation",
47874
+ auth: "protected"
47875
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47876
+ kind: "mutation",
47877
+ auth: "protected"
47878
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47879
+ kind: "mutation",
47880
+ auth: "protected"
47881
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47882
+ kind: "mutation",
47883
+ auth: "protected"
47884
+ }), method(object({
47885
+ deviceId: number().int().nonnegative(),
47886
+ position: number().int().nonnegative()
47887
+ }), _void(), {
47888
+ kind: "mutation",
47889
+ auth: "protected"
47890
+ }), method(object({
47891
+ deviceId: number().int().nonnegative(),
47892
+ volumeLevel: number().min(0).max(100)
47893
+ }), _void(), {
47894
+ kind: "mutation",
47895
+ auth: "protected"
47896
+ }), method(object({
47897
+ deviceId: number().int().nonnegative(),
47898
+ muted: boolean()
47899
+ }), _void(), {
47900
+ kind: "mutation",
47901
+ auth: "protected"
47902
+ }), method(object({
47903
+ deviceId: number().int().nonnegative(),
47904
+ shuffle: boolean()
47905
+ }), _void(), {
47906
+ kind: "mutation",
47907
+ auth: "protected"
47908
+ }), method(object({
47909
+ deviceId: number().int().nonnegative(),
47910
+ repeat: MediaPlayerRepeatSchema
47911
+ }), _void(), {
47912
+ kind: "mutation",
47913
+ auth: "protected"
47914
+ }), method(object({
47915
+ deviceId: number().int().nonnegative(),
47916
+ source: string().min(1)
47917
+ }), _void(), {
47918
+ kind: "mutation",
47919
+ auth: "protected"
47920
+ }), method(object({
47921
+ deviceId: number().int().nonnegative(),
47922
+ /** Media identifier / URL. */
47923
+ mediaId: string().min(1),
47924
+ /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
47925
+ * passes it through to the upstream service. */
47926
+ mediaType: string().min(1)
47927
+ }), _void(), {
47928
+ kind: "mutation",
47929
+ auth: "protected"
47930
+ });
47602
47931
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, 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.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
47603
47932
  var NUMBER = {
47604
47933
  kind: "fixed",
@@ -48046,49 +48375,6 @@ function actuator(input) {
48046
48375
  };
48047
48376
  }
48048
48377
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
48049
- var PowerSourceRefusalReasonSchema = _enum([
48050
- "no-power-source",
48051
- "switch-missing",
48052
- "switch-offline",
48053
- "switch-unknown",
48054
- "restart-in-progress",
48055
- "switch-call-failed"
48056
- ]);
48057
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
48058
- accepted: literal(false),
48059
- reason: PowerSourceRefusalReasonSchema,
48060
- /** One line for the operator, naming the switch. */
48061
- message: string()
48062
- })]);
48063
- var PowerSourceInfoSchema = object({
48064
- /** False when the device has no power source linked; the rest is then empty. */
48065
- linked: boolean(),
48066
- switchDeviceId: number().nullable(),
48067
- switchName: string().nullable(),
48068
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
48069
- switchOn: boolean().nullable(),
48070
- switchOnline: boolean().nullable(),
48071
- restartInProgress: boolean(),
48072
- offSeconds: number().int()
48073
- });
48074
- object({
48075
- /** Null while the switch has not reported: unknown is never `false` (D393). */
48076
- switchOn: boolean().nullable(),
48077
- offSeconds: number().int(),
48078
- lastFetchedAt: number()
48079
- });
48080
- DeviceType.Gateway, DeviceType.Hub, 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;
48081
- var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
48082
- systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48083
- kind: "mutation",
48084
- auth: "admin"
48085
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48086
- kind: "mutation",
48087
- auth: "admin"
48088
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48089
- kind: "mutation",
48090
- auth: "admin"
48091
- });
48092
48378
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
48093
48379
  DeviceType.Camera;
48094
48380
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
@@ -48116,6 +48402,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
48116
48402
  }).optional()
48117
48403
  })) });
48118
48404
  /**
48405
+ * A saved Customize assignment (D936). The schema is the type: callers use
48406
+ * `z.infer`, they do not restate the shape.
48407
+ */
48408
+ var OverrideSourceSchema = object({
48409
+ addonId: string().min(1),
48410
+ stableId: string().min(1),
48411
+ cap: string().min(1),
48412
+ fieldPath: string().min(1)
48413
+ });
48414
+ var IdentityTransformDraftSchema = object({ kind: literal("identity") });
48415
+ var InvertTransformDraftSchema = object({ kind: literal("invert") });
48416
+ var ThresholdTransformDraftSchema = object({
48417
+ kind: literal("threshold"),
48418
+ comparison: _enum(["gte", "lte"]),
48419
+ threshold: number(),
48420
+ startDwellMs: number().nonnegative(),
48421
+ stopDwellMs: number().nonnegative()
48422
+ });
48423
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
48424
+ IdentityTransformDraftSchema,
48425
+ InvertTransformDraftSchema,
48426
+ ThresholdTransformDraftSchema,
48427
+ object({
48428
+ kind: literal("linear"),
48429
+ scale: number(),
48430
+ offset: number(),
48431
+ clampMin: number().optional(),
48432
+ clampMax: number().optional()
48433
+ }),
48434
+ object({
48435
+ kind: literal("enum-map"),
48436
+ mapping: record(string(), string().nullable())
48437
+ }),
48438
+ object({ kind: literal("number") })
48439
+ ]);
48440
+ var ScalarOverrideDraftSchema = object({
48441
+ kind: literal("scalar"),
48442
+ cap: string().min(1),
48443
+ targetId: string().min(1),
48444
+ source: OverrideSourceSchema,
48445
+ transform: CustomizeTransformDraftSchema
48446
+ });
48447
+ var KeyedArrayOverrideDraftSchema = object({
48448
+ kind: literal("keyedArray"),
48449
+ cap: string().min(1),
48450
+ targetId: string().min(1),
48451
+ key: string().min(1),
48452
+ label: string().min(1),
48453
+ fieldPath: string().min(1),
48454
+ source: OverrideSourceSchema,
48455
+ transform: CustomizeTransformDraftSchema
48456
+ });
48457
+ var PulseOverrideDraftSchema = object({
48458
+ kind: literal("pulse"),
48459
+ cap: string().min(1),
48460
+ targetId: string().min(1),
48461
+ enabled: boolean(),
48462
+ debounceMs: number().nonnegative(),
48463
+ edges: array(_enum([
48464
+ "rising",
48465
+ "button",
48466
+ "native-event"
48467
+ ])).min(1).optional(),
48468
+ sources: array(OverrideSourceSchema).min(1)
48469
+ });
48470
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
48471
+ "in-addition",
48472
+ "confirm",
48473
+ "replace"
48474
+ ]).optional() });
48475
+ discriminatedUnion("kind", [
48476
+ ScalarOverrideDraftSchema,
48477
+ KeyedArrayOverrideDraftSchema,
48478
+ PulseOverrideDraftSchema,
48479
+ object({
48480
+ kind: literal("span"),
48481
+ cap: string().min(1),
48482
+ targetId: string().min(1),
48483
+ timeoutMs: number().nonnegative(),
48484
+ cooldownMs: number().nonnegative().optional(),
48485
+ sources: array(SpanSourceDraftSchema)
48486
+ })
48487
+ ]);
48488
+ object({
48489
+ targetId: string().min(1),
48490
+ configured: boolean(),
48491
+ source: _enum(["native", "assigned"]),
48492
+ state: _enum([
48493
+ "active",
48494
+ "stale",
48495
+ "released",
48496
+ "unavailable"
48497
+ ]),
48498
+ reason: string().nullable()
48499
+ });
48500
+ /**
48501
+ * What a running-threshold proposal says (planning#405). The schema is the
48502
+ * type: the algorithm, the capability method and the UI all read `z.infer`.
48503
+ *
48504
+ * A proposal is read-only advice: it carries the numbers it was derived from
48505
+ * (`evidence`) so the operator can judge it, and an `insufficient` answer names
48506
+ * WHY with a typed reason and the catalog defaults, never an invented number.
48507
+ */
48508
+ var RunningProposalTierSchema = _enum(["raw", "5m"]);
48509
+ var RunningProposalConfidenceSchema = _enum([
48510
+ "high",
48511
+ "medium",
48512
+ "low"
48513
+ ]);
48514
+ var RunningProposalInsufficientReasonSchema = _enum([
48515
+ "no-history",
48516
+ "span-too-short",
48517
+ "truncated",
48518
+ "no-idle-floor",
48519
+ "no-runs",
48520
+ "no-separation"
48521
+ ]);
48522
+ var RunningProposalReplaySchema = object({
48523
+ /** Intervals the real dwell expression held true over the window. */
48524
+ intervals: number().int().nonnegative(),
48525
+ /** Intervals outside every run, or a second interval inside one. */
48526
+ extra: number().int().nonnegative(),
48527
+ /** Runs without an interval of their own (none, or merged into a neighbour). */
48528
+ missed: number().int().nonnegative()
48529
+ });
48530
+ var RunningProposalEvidenceSchema = object({
48531
+ tier: RunningProposalTierSchema,
48532
+ spanMs: number().nonnegative(),
48533
+ from: number(),
48534
+ to: number(),
48535
+ points: number().int().nonnegative(),
48536
+ runsFound: number().int().nonnegative(),
48537
+ pausesFound: number().int().nonnegative(),
48538
+ longestPauseMs: number().nonnegative(),
48539
+ idleFloorW: number(),
48540
+ noiseCeilingW: number(),
48541
+ plateauW: number(),
48542
+ replay: RunningProposalReplaySchema
48543
+ });
48544
+ var RunningProposalInsufficientEvidenceSchema = object({
48545
+ spanMs: number().nonnegative(),
48546
+ points: number().int().nonnegative(),
48547
+ runsFound: number().int().nonnegative()
48548
+ });
48549
+ var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
48550
+ state: literal("proposal"),
48551
+ transform: ThresholdTransformDraftSchema,
48552
+ evidence: RunningProposalEvidenceSchema,
48553
+ confidence: RunningProposalConfidenceSchema,
48554
+ /** Why the confidence is not higher; empty when nothing held it back. */
48555
+ notes: array(string())
48556
+ }), object({
48557
+ state: literal("insufficient"),
48558
+ reason: RunningProposalInsufficientReasonSchema,
48559
+ evidence: RunningProposalInsufficientEvidenceSchema,
48560
+ /** The catalog defaults, offered as what stands when nothing better is known. */
48561
+ fallback: ThresholdTransformDraftSchema
48562
+ })]);
48563
+ /**
48119
48564
  * The report of a one-shot "move this owner's plaintext secrets into the
48120
48565
  * keychain" run (D878). COUNTS only - never a value, never a ref.
48121
48566
  *
@@ -48405,6 +48850,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
48405
48850
  kind: "mutation",
48406
48851
  auth: "admin",
48407
48852
  access: "view"
48853
+ }), method(object({
48854
+ deviceId: number().int(),
48855
+ cap: string().min(1),
48856
+ fieldPath: string().min(1),
48857
+ deviceType: _enum(DeviceType).optional()
48858
+ }), RunningThresholdProposalSchema, {
48859
+ auth: "admin",
48860
+ access: "view"
48408
48861
  }), method(object({
48409
48862
  blockId: string().min(1),
48410
48863
  trace: AutomationRunTraceSchema.optional(),
@@ -49213,7 +49666,53 @@ method(object({
49213
49666
  * exposes only the COMMON surface: link state, supported device
49214
49667
  * kinds (so the UI can filter the device picker), and per-device
49215
49668
  * expose/unexpose.
49669
+ *
49670
+ * INSTANCES. One export addon can serve several independent targets (a
49671
+ * HomeKit bridge, a Home Assistant broker). `listInstances` names them.
49672
+ * `instanceId` on a READ is optional: absent = the whole addon (linked if any
49673
+ * enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
49674
+ * default instance's); present = that instance; an id the provider does not
49675
+ * serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
49676
+ * never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
49677
+ * change always names the target it changes. A single-instance provider
49678
+ * accepts an absent id on a read or its own id, and refuses any other.
49679
+ */
49680
+ /** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
49681
+ var InstanceIdSchema$1 = string().min(1);
49682
+ var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
49683
+ /** One independent export target of an addon. */
49684
+ var ExportInstanceSchema = object({
49685
+ instanceId: InstanceIdSchema$1,
49686
+ name: string(),
49687
+ enabled: boolean(),
49688
+ kind: string().optional()
49689
+ });
49690
+ var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
49691
+ /** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
49692
+ var ExportInstanceUnknownError = class extends Error {
49693
+ code = EXPORT_INSTANCE_UNKNOWN;
49694
+ instanceId;
49695
+ constructor(addon, instanceId) {
49696
+ super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
49697
+ this.name = "ExportInstanceUnknownError";
49698
+ this.instanceId = instanceId;
49699
+ }
49700
+ };
49701
+ /**
49702
+ * The instance a `getStatus` call names. The cap's `status` block injects a per-device
49703
+ * `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
49704
+ * both shapes; only the second names an instance (a per-device status read is addon-wide).
49216
49705
  */
49706
+ function statusInstanceOf(input) {
49707
+ return "instanceId" in input ? input.instanceId : void 0;
49708
+ }
49709
+ /**
49710
+ * A single-instance provider's check: an absent id or its own passes, any other throws
49711
+ * `ExportInstanceUnknownError`.
49712
+ */
49713
+ function assertOwnExportInstance(addon, own, instanceId) {
49714
+ if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
49715
+ }
49217
49716
  var LinkStateSchema = _enum([
49218
49717
  "unlinked",
49219
49718
  "linked",
@@ -49264,10 +49763,14 @@ var ExposedDeviceSchema = object({
49264
49763
  capabilities: array(string()).optional()
49265
49764
  });
49266
49765
  var ExposeInputSchema = object({
49766
+ instanceId: InstanceIdSchema$1,
49267
49767
  deviceId: string(),
49268
49768
  capabilities: array(string()).optional()
49269
49769
  });
49270
- var UnexposeInputSchema = object({ deviceId: string() });
49770
+ var UnexposeInputSchema = object({
49771
+ instanceId: InstanceIdSchema$1,
49772
+ deviceId: string()
49773
+ });
49271
49774
  /**
49272
49775
  * What an exporter may expose besides devices (D968). An action and a
49273
49776
  * notification target are LIST ENTRIES, never devices (D954): they enter an
@@ -49296,8 +49799,14 @@ var ExposedEntitySchema = object({
49296
49799
  entity: ExportEntityRefSchema,
49297
49800
  exposedAs: string().optional()
49298
49801
  });
49299
- var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
49300
- var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
49802
+ var ExposeEntityInputSchema = object({
49803
+ instanceId: InstanceIdSchema$1,
49804
+ entity: ExportEntityRefSchema
49805
+ });
49806
+ var UnexposeEntityInputSchema = object({
49807
+ instanceId: InstanceIdSchema$1,
49808
+ entity: ExportEntityRefSchema
49809
+ });
49301
49810
  var deviceExportCapability = {
49302
49811
  name: "device-export",
49303
49812
  scope: "system",
@@ -49317,9 +49826,10 @@ var deviceExportCapability = {
49317
49826
  */
49318
49827
  exposesDeviceSettings: true,
49319
49828
  methods: {
49320
- getStatus: method(_void(), DeviceExportStatusSchema),
49321
- listSupportedDeviceKinds: method(_void(), array(DeviceKindSchema)),
49322
- listExposedDevices: method(_void(), array(ExposedDeviceSchema)),
49829
+ getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
49830
+ listInstances: method(_void(), array(ExportInstanceSchema)),
49831
+ listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
49832
+ listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
49323
49833
  exposeDevice: method(ExposeInputSchema, _void(), {
49324
49834
  kind: "mutation",
49325
49835
  auth: "admin"
@@ -49329,7 +49839,7 @@ var deviceExportCapability = {
49329
49839
  auth: "admin"
49330
49840
  }),
49331
49841
  listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
49332
- listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
49842
+ listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
49333
49843
  exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
49334
49844
  kind: "mutation",
49335
49845
  auth: "admin"
@@ -51213,7 +51723,7 @@ object({
51213
51723
  /** Ms epoch of the last value received from the appliance; 0 = never. */
51214
51724
  lastFetchedAt: number()
51215
51725
  });
51216
- var DeviceIdSchema$1 = number().int().nonnegative();
51726
+ var DeviceIdSchema$2 = number().int().nonnegative();
51217
51727
  /** A value a program option or setting can take. */
51218
51728
  var DishwasherValueSchema = union([
51219
51729
  boolean(),
@@ -51277,77 +51787,77 @@ var DishwasherOptionsSchema = object({
51277
51787
  options: array(DishwasherOptionDescriptorSchema)
51278
51788
  });
51279
51789
  DeviceType.Dishwasher, method(object({
51280
- deviceId: DeviceIdSchema$1,
51790
+ deviceId: DeviceIdSchema$2,
51281
51791
  program: string().min(1).optional(),
51282
51792
  options: record(string(), DishwasherValueSchema).optional()
51283
51793
  }), _void(), {
51284
51794
  kind: "mutation",
51285
51795
  auth: "protected"
51286
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51796
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51287
51797
  kind: "mutation",
51288
51798
  auth: "protected"
51289
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51799
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51290
51800
  kind: "mutation",
51291
51801
  auth: "protected"
51292
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51802
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51293
51803
  kind: "mutation",
51294
51804
  auth: "protected"
51295
51805
  }), method(object({
51296
- deviceId: DeviceIdSchema$1,
51806
+ deviceId: DeviceIdSchema$2,
51297
51807
  program: string().min(1)
51298
51808
  }), _void(), {
51299
51809
  kind: "mutation",
51300
51810
  auth: "protected"
51301
51811
  }), method(object({
51302
- deviceId: DeviceIdSchema$1,
51812
+ deviceId: DeviceIdSchema$2,
51303
51813
  on: boolean()
51304
51814
  }), _void(), {
51305
51815
  kind: "mutation",
51306
51816
  auth: "protected"
51307
51817
  }), method(object({
51308
- deviceId: DeviceIdSchema$1,
51818
+ deviceId: DeviceIdSchema$2,
51309
51819
  on: boolean()
51310
51820
  }), _void(), {
51311
51821
  kind: "mutation",
51312
51822
  auth: "protected"
51313
51823
  }), method(object({
51314
- deviceId: DeviceIdSchema$1,
51824
+ deviceId: DeviceIdSchema$2,
51315
51825
  on: boolean()
51316
51826
  }), _void(), {
51317
51827
  kind: "mutation",
51318
51828
  auth: "protected"
51319
51829
  }), method(object({
51320
- deviceId: DeviceIdSchema$1,
51830
+ deviceId: DeviceIdSchema$2,
51321
51831
  on: boolean()
51322
51832
  }), _void(), {
51323
51833
  kind: "mutation",
51324
51834
  auth: "protected"
51325
51835
  }), method(object({
51326
- deviceId: DeviceIdSchema$1,
51836
+ deviceId: DeviceIdSchema$2,
51327
51837
  on: boolean()
51328
51838
  }), _void(), {
51329
51839
  kind: "mutation",
51330
51840
  auth: "protected"
51331
51841
  }), method(object({
51332
- deviceId: DeviceIdSchema$1,
51842
+ deviceId: DeviceIdSchema$2,
51333
51843
  on: boolean()
51334
51844
  }), _void(), {
51335
51845
  kind: "mutation",
51336
51846
  auth: "protected"
51337
51847
  }), method(object({
51338
- deviceId: DeviceIdSchema$1,
51848
+ deviceId: DeviceIdSchema$2,
51339
51849
  on: boolean()
51340
51850
  }), _void(), {
51341
51851
  kind: "mutation",
51342
51852
  auth: "protected"
51343
51853
  }), method(object({
51344
- deviceId: DeviceIdSchema$1,
51854
+ deviceId: DeviceIdSchema$2,
51345
51855
  key: string().min(1),
51346
51856
  value: DishwasherValueSchema
51347
51857
  }), _void(), {
51348
51858
  kind: "mutation",
51349
51859
  auth: "protected"
51350
- }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
51860
+ }), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
51351
51861
  /**
51352
51862
  * Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
51353
51863
  * not entries. `heatmapScrub` is a mark, not an event kind.
@@ -52534,15 +53044,15 @@ var FanPresetCaptureResultSchema = object({
52534
53044
  items: array(FanCaptureItemSchema),
52535
53045
  omitted: array(FanCaptureOmissionSchema)
52536
53046
  });
52537
- var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
53047
+ var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
52538
53048
  DeviceType.Fan;
52539
- method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53049
+ method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
52540
53050
  kind: "mutation",
52541
53051
  auth: "admin"
52542
- }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53052
+ }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
52543
53053
  kind: "mutation",
52544
53054
  auth: "protected"
52545
- }), method(deviceInput$1.extend({
53055
+ }), method(deviceInput$2.extend({
52546
53056
  fields: array(FanCaptureFieldSchema).optional(),
52547
53057
  steps: array(ActionStepSchema).max(20).default([])
52548
53058
  }), FanPresetCaptureResultSchema, { auth: "protected" });
@@ -52931,15 +53441,9 @@ var AvailableIntegrationTypeSchema = object({
52931
53441
  * branch on CAP — never on addon name. `device-adoption` integrations
52932
53442
  * (Home Assistant, …) route through the broker step (Approach A);
52933
53443
  * `device-provider` integrations (Reolink/ONVIF) keep the
52934
- * legacy config → discovery flow. `connection` is an addon that only holds a
52935
- * connection as typed records (`integration-instances`, D985): no devices,
52936
- * no discovery.
53444
+ * legacy config → discovery flow.
52937
53445
  */
52938
- kind: _enum([
52939
- "device-adoption",
52940
- "device-provider",
52941
- "connection"
52942
- ]),
53446
+ kind: _enum(["device-adoption", "device-provider"]),
52943
53447
  /**
52944
53448
  * For `device-adoption` addons: the broker kind to create/link
52945
53449
  * (e.g. `home-assistant`), declared in the addon manifest. `null` for
@@ -53053,18 +53557,17 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53053
53557
  });
53054
53558
  /**
53055
53559
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53056
- * (an account, a relay, a destination) as typed records, shown on the
53057
- * Integrations page like every other integration (D985, D986).
53560
+ * (an account, a relay, a destination) as typed records (D985, D986). The addon's
53561
+ * own function page reads and writes them (Logging for Loki); the Integrations
53562
+ * page lists only the integrations that bring devices (D996).
53058
53563
  *
53059
- * A collection of providers: each addon that holds connections registers one
53060
- * and the hub aggregator (`integrations.*`) reaches a provider with the pinned
53061
- * `addonId`. It is internal and has no route: the operator-facing surface is
53062
- * the `integrations` cap, which keeps ONE list.
53564
+ * A collection of providers: each addon that holds connections registers one and a
53565
+ * caller reaches a provider with the pinned `addonId`.
53063
53566
  *
53064
- * Identity: the instance id IS the `integrations` registry id (`int_NNNN`,
53065
- * immutable, already in the `/integrations/<id>` URL). A second operator-chosen
53066
- * slug would be a second authority over one identity (D224). `name` is the
53067
- * editable label.
53567
+ * Identity: the instance id is immutable and opaque to the caller. A record the
53568
+ * Loki migration made keeps the `integrations` registry id it was created under
53569
+ * (`int_NNNN`); a single instance made by its function page takes the addon id.
53570
+ * `name` is the editable label.
53068
53571
  *
53069
53572
  * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53070
53573
  * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
@@ -53073,13 +53576,50 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53073
53576
  */
53074
53577
  var ConfigSchemaPassthrough$3 = custom();
53075
53578
  var IntegrationInstanceIdSchema = string().min(1);
53579
+ var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
53580
+ /**
53581
+ * One kind of instance a provider can create (an adapter, an account type). The sign-in and
53582
+ * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
53583
+ * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
53584
+ * interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
53585
+ * instance id.
53586
+ */
53587
+ var IntegrationInstanceKindSchema = object({
53588
+ /** Stable id of the kind, sent back as `createInstance.kind`. */
53589
+ id: string().min(1),
53590
+ label: string().min(1),
53591
+ /** The kind signs in through a server-held interactive session. */
53592
+ signIn: object({
53593
+ basePath: string().min(1),
53594
+ methods: array(_enum(["device-code", "proxy"])).optional()
53595
+ }).optional(),
53596
+ /** Relative hub path to start an interactive account link of an instance of this kind. */
53597
+ connectPath: string().min(1).optional(),
53598
+ /** Relative hub path to disconnect that account. */
53599
+ disconnectPath: string().min(1).optional()
53600
+ });
53076
53601
  var IntegrationInstanceDescriptionSchema = object({
53077
53602
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53078
- instanceMode: _enum(["single", "multiple"]),
53603
+ instanceMode: IntegrationInstanceModeSchema,
53079
53604
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53080
53605
  kind: string(),
53081
53606
  /** True when `testInstance` really probes the remote. */
53082
- canTest: boolean()
53607
+ canTest: boolean(),
53608
+ /**
53609
+ * The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
53610
+ * Add flow asks which first and sends it as `createInstance.kind`.
53611
+ */
53612
+ kinds: array(IntegrationInstanceKindSchema).optional(),
53613
+ /**
53614
+ * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
53615
+ * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
53616
+ */
53617
+ allowRestoreId: boolean().optional(),
53618
+ /**
53619
+ * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
53620
+ * send an id (the UI then mints an opaque one).
53621
+ */
53622
+ mintsId: boolean().optional()
53083
53623
  });
53084
53624
  var IntegrationInstanceStatusSchema = object({
53085
53625
  state: _enum([
@@ -53088,16 +53628,27 @@ var IntegrationInstanceStatusSchema = object({
53088
53628
  "error",
53089
53629
  "unknown"
53090
53630
  ]),
53091
- detail: string().optional()
53631
+ detail: string().optional(),
53632
+ /** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
53633
+ label: string().optional()
53092
53634
  });
53093
53635
  var IntegrationInstanceSchema = object({
53094
53636
  id: IntegrationInstanceIdSchema,
53095
53637
  name: string(),
53096
53638
  /** The addon's own rule (an URL is present, a client id is present...). */
53097
53639
  configured: boolean(),
53640
+ /**
53641
+ * The instance's own on/off switch (D996): always present, derived from the record body
53642
+ * (`enabled !== false`, so a row written before the field existed is on).
53643
+ */
53644
+ enabled: boolean(),
53645
+ /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
53646
+ kind: string().optional(),
53098
53647
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53099
53648
  formValues: record(string(), unknown()),
53100
- status: IntegrationInstanceStatusSchema.optional()
53649
+ status: IntegrationInstanceStatusSchema.optional(),
53650
+ /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
53651
+ lastCheckedAt: number().optional()
53101
53652
  });
53102
53653
  var IntegrationInstancePatchSchema = object({
53103
53654
  id: IntegrationInstanceIdSchema,
@@ -53105,13 +53656,32 @@ var IntegrationInstancePatchSchema = object({
53105
53656
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53106
53657
  values: record(string(), unknown())
53107
53658
  });
53108
- method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
53659
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
53660
+ id: IntegrationInstanceIdSchema.optional(),
53661
+ name: string().min(1),
53662
+ kind: string().min(1).optional()
53663
+ }), object({ id: string() }), {
53664
+ kind: "mutation",
53665
+ auth: "admin"
53666
+ }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
53667
+ kind: "mutation",
53668
+ auth: "admin"
53669
+ }), method(object({
53109
53670
  id: IntegrationInstanceIdSchema,
53110
- name: string().min(1)
53111
- }), object({ id: string() }), { kind: "mutation" }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), { kind: "mutation" }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), { kind: "mutation" }), optionalMethod(object({
53671
+ enabled: boolean()
53672
+ }), object({ ok: literal(true) }), {
53673
+ kind: "mutation",
53674
+ auth: "admin"
53675
+ }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
53676
+ kind: "mutation",
53677
+ auth: "admin"
53678
+ }), optionalMethod(object({
53112
53679
  id: IntegrationInstanceIdSchema.nullable(),
53113
53680
  values: record(string(), unknown())
53114
- }), TestConnectionResultSchema$1, { kind: "mutation" });
53681
+ }), TestConnectionResultSchema$1, {
53682
+ kind: "mutation",
53683
+ auth: "admin"
53684
+ });
53115
53685
  /**
53116
53686
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
53117
53687
  * session (server-initiated offer pattern, identical to the main
@@ -54910,6 +55480,11 @@ var LogEntrySchema = object({
54910
55480
  * flight, and not asking for the next slice ends the scan.
54911
55481
  */
54912
55482
  var LogReadQuerySchema = object({
55483
+ /**
55484
+ * Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
55485
+ * the provider's first readable one, so a caller written before instances existed is unchanged.
55486
+ */
55487
+ instanceId: string().min(1).max(200).optional(),
54913
55488
  /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
54914
55489
  requestId: string().min(1).max(64).optional(),
54915
55490
  /** The device the line is about (`tags.deviceId`, numeric). */
@@ -54972,6 +55547,8 @@ var LogReadResultSchema = object({
54972
55547
  /** True when `cancelRead` ended this slice early. */
54973
55548
  cancelled: boolean().optional()
54974
55549
  });
55550
+ /** Names one destination instance; absent ⇒ the provider's first readable one. */
55551
+ var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
54975
55552
  var LogReadCapabilitiesSchema = object({
54976
55553
  /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
54977
55554
  readable: boolean(),
@@ -54990,7 +55567,7 @@ var LogReadCapabilitiesSchema = object({
54990
55567
  /** How far back the store reaches, when the provider knows (days). */
54991
55568
  retentionDays: number().nullable()
54992
55569
  });
54993
- method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(_void(), LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
55570
+ method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
54994
55571
  kind: "mutation",
54995
55572
  auth: "admin"
54996
55573
  });
@@ -55094,164 +55671,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
55094
55671
  ]);
55095
55672
  method(_void(), array(LoginMethodContributionSchema).readonly());
55096
55673
  /**
55097
- * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
55098
- * Apple TV, Spotify, Roku, generic OTT receivers, …) on
55099
- * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
55100
- * surface — those use `DeviceType.Camera` + the broker pipeline.
55101
- *
55102
- * The cap declares a wide method surface; not every backend supports
55103
- * every method. Drivers signal sub-capability via the
55104
- * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
55105
- * corresponding method) so the UI gates buttons without a slice
55106
- * fetch — same pattern as `PanTiltZoom` for cameras.
55107
- */
55108
- var MediaPlayerStateSchema = _enum([
55109
- "off",
55110
- "on",
55111
- "idle",
55112
- "playing",
55113
- "paused",
55114
- "buffering",
55115
- "standby"
55116
- ]);
55117
- var MediaPlayerRepeatSchema = _enum([
55118
- "off",
55119
- "all",
55120
- "one"
55121
- ]);
55122
- var MediaInfoSchema = object({
55123
- /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
55124
- * `podcast`, …). */
55125
- type: string(),
55126
- /** Human-readable title. */
55127
- title: string(),
55128
- /** Optional artist / channel / station label. */
55129
- artist: string().optional(),
55130
- /** Optional album / season / show name. */
55131
- album: string().optional(),
55132
- /** Optional cover-art / thumbnail URL. */
55133
- imageUrl: string().optional()
55134
- });
55135
- /**
55136
- * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
55137
- * the device said so. `assumed`: the driver has no feedback (infrared) and
55138
- * tracks what it last SENT; it moves only after a send was accepted, and a
55139
- * human at the real remote makes it wrong. A UI shows an assumed value as a
55140
- * guess, never as a reading.
55141
- */
55142
- var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
55143
- /** The fields of a media-player status a driver can only guess. */
55144
- var MediaPlayerAssumedFieldSchema = _enum([
55145
- "state",
55146
- "volumeLevel",
55147
- "isMuted",
55148
- "source"
55149
- ]);
55150
- object({
55151
- /** Playback lifecycle state. */
55152
- state: MediaPlayerStateSchema,
55153
- /**
55154
- * Whether the state fields are readings or the driver's own bookkeeping.
55155
- * A slice written before this field existed parses as `reported`.
55156
- */
55157
- stateSource: MediaPlayerStateSourceSchema.default("reported"),
55158
- /**
55159
- * Which fields are the driver's own guess. `stateSource` is `assumed` when
55160
- * this is not empty; a field not listed here is a reading even then (power
55161
- * from a running-state source, mute guessed from the last send).
55162
- */
55163
- assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
55164
- /** Volume as 0..100 inclusive. Null when the device has no volume
55165
- * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
55166
- volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
55167
- /** Mute toggle distinct from volume=0. Null when no mute surface.
55168
- * Pair with `DeviceFeature.MediaPlayerMute`. */
55169
- isMuted: boolean().nullable(),
55170
- /** Active source / input. Empty when no source surface. */
55171
- source: string(),
55172
- /** Selectable sources. Empty when no source surface.
55173
- * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
55174
- availableSources: array(string()),
55175
- /** Currently-playing media info. Null when nothing is playing. */
55176
- currentMedia: MediaInfoSchema.nullable(),
55177
- /** Current playback position in ms. Null when not seekable or
55178
- * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
55179
- position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
55180
- /** Total duration of the current media in ms. Null when unknown
55181
- * (live stream) or nothing is playing. */
55182
- duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
55183
- /** Shuffle toggle. Null when no shuffle surface.
55184
- * Pair with `DeviceFeature.MediaPlayerShuffle`. */
55185
- shuffle: boolean().nullable(),
55186
- /** Repeat mode. Null when no repeat surface.
55187
- * Pair with `DeviceFeature.MediaPlayerRepeat`. */
55188
- repeat: MediaPlayerRepeatSchema.nullable(),
55189
- /** Ms epoch when the slice was last updated. */
55190
- lastChangedAt: number()
55191
- });
55192
- DeviceType.MediaPlayer, method(object({ deviceId: number().int().nonnegative() }), _void(), {
55193
- kind: "mutation",
55194
- auth: "protected"
55195
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55196
- kind: "mutation",
55197
- auth: "protected"
55198
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55199
- kind: "mutation",
55200
- auth: "protected"
55201
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55202
- kind: "mutation",
55203
- auth: "protected"
55204
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55205
- kind: "mutation",
55206
- auth: "protected"
55207
- }), method(object({
55208
- deviceId: number().int().nonnegative(),
55209
- position: number().int().nonnegative()
55210
- }), _void(), {
55211
- kind: "mutation",
55212
- auth: "protected"
55213
- }), method(object({
55214
- deviceId: number().int().nonnegative(),
55215
- volumeLevel: number().min(0).max(100)
55216
- }), _void(), {
55217
- kind: "mutation",
55218
- auth: "protected"
55219
- }), method(object({
55220
- deviceId: number().int().nonnegative(),
55221
- muted: boolean()
55222
- }), _void(), {
55223
- kind: "mutation",
55224
- auth: "protected"
55225
- }), method(object({
55226
- deviceId: number().int().nonnegative(),
55227
- shuffle: boolean()
55228
- }), _void(), {
55229
- kind: "mutation",
55230
- auth: "protected"
55231
- }), method(object({
55232
- deviceId: number().int().nonnegative(),
55233
- repeat: MediaPlayerRepeatSchema
55234
- }), _void(), {
55235
- kind: "mutation",
55236
- auth: "protected"
55237
- }), method(object({
55238
- deviceId: number().int().nonnegative(),
55239
- source: string().min(1)
55240
- }), _void(), {
55241
- kind: "mutation",
55242
- auth: "protected"
55243
- }), method(object({
55244
- deviceId: number().int().nonnegative(),
55245
- /** Media identifier / URL. */
55246
- mediaId: string().min(1),
55247
- /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
55248
- * passes it through to the upstream service. */
55249
- mediaType: string().min(1)
55250
- }), _void(), {
55251
- kind: "mutation",
55252
- auth: "protected"
55253
- });
55254
- /**
55255
55674
  * mesh-network — collection cap for mesh-VPN providers.
55256
55675
  *
55257
55676
  * Different shape from `network-access` (public tunnels):
@@ -63145,7 +63564,14 @@ var NcMediaPolicySchema = object({
63145
63564
  */
63146
63565
  profile: CamProfileSchema.optional(),
63147
63566
  /** See {@link NcLinkedCameraModeSchema}. */
63148
- linkedCameras: NcLinkedCameraModeSchema.optional()
63567
+ linkedCameras: NcLinkedCameraModeSchema.optional(),
63568
+ /**
63569
+ * Sensor rules only: may this rule wake a SLEEPING battery camera to take
63570
+ * the linked still it attaches (D998)? Absent means yes, an explicit `false`
63571
+ * opts out. Deliberately not a Zod default: a rule that never chose keeps
63572
+ * following the hub's. One bounded wake per event; nothing is attached later.
63573
+ */
63574
+ wakeSleepingCamera: boolean().optional()
63149
63575
  });
63150
63576
  /**
63151
63577
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -63537,6 +63963,21 @@ var NcTemplateVarKindSchema = _enum([
63537
63963
  "sound",
63538
63964
  "system"
63539
63965
  ]);
63966
+ /**
63967
+ * The default title/body a rule of one SITUATION is delivered with when the
63968
+ * operator wrote no template — served so an editor can pre-fill it (and the
63969
+ * operator can rebuild it from placeholders) instead of starting from a blank
63970
+ * box that, once saved, silently replaces it. `id` names the situation inside
63971
+ * a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
63972
+ * appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
63973
+ * the hub's current language and with its overrides applied.
63974
+ */
63975
+ var NcTemplateDefaultSchema = object({
63976
+ id: _enum(["appliance-cycle"]),
63977
+ kind: NcRuleKindSchema,
63978
+ title: string(),
63979
+ body: string()
63980
+ });
63540
63981
  /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
63541
63982
  var NcTemplateFamilySchema = _enum([
63542
63983
  "rule",
@@ -64392,7 +64833,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
64392
64833
  }), method(object({}), object({
64393
64834
  catalog: array(NcConditionDescriptorSchema),
64394
64835
  taxonomy: NcTaxonomySchema.optional()
64395
- })), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
64836
+ })), method(object({}), object({
64837
+ vars: array(NcTemplateVarDescriptorSchema),
64838
+ /** Per-situation default texts; absent on a hub that predates them. */
64839
+ defaults: array(NcTemplateDefaultSchema)
64840
+ })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
64396
64841
  kind: "mutation",
64397
64842
  access: "view"
64398
64843
  }), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
@@ -65156,52 +65601,27 @@ object({
65156
65601
  empty: boolean().nullable(),
65157
65602
  /** True while the pump is running. Null while unknown. */
65158
65603
  pumpRunning: boolean().nullable(),
65159
- /** True when the pump works on an on/off duty cycle rather than continuously. */
65160
- pumpIntervalEnabled: boolean().nullable(),
65161
- /** How long the pump runs per cycle, in seconds. */
65162
- pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
65163
- /** How long the pump rests per cycle, in seconds. */
65164
- pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
65165
65604
  /** Water drunk in the last drink, in litres. */
65166
65605
  lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
65167
65606
  /** Water drunk in the current hour, in litres. */
65168
65607
  currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
65169
65608
  /** Water drunk over the last 24 hours (rolling), in litres. */
65170
65609
  last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
65171
- /** Water drunk since local midnight, in litres. */
65610
+ /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
65172
65611
  todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
65173
65612
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
65174
65613
  error: string().nullable(),
65175
65614
  /** Ms epoch when the slice was last refreshed. */
65176
65615
  lastFetchedAt: number()
65177
65616
  });
65178
- var DeviceIdSchema = number().int().nonnegative();
65179
- var MinutesSchema = number().int().min(0);
65617
+ var DeviceIdSchema$1 = number().int().nonnegative();
65180
65618
  DeviceType.PetFountain, method(object({
65181
- deviceId: DeviceIdSchema,
65182
- on: boolean()
65183
- }), _void(), {
65184
- kind: "mutation",
65185
- auth: "protected"
65186
- }), method(object({
65187
- deviceId: DeviceIdSchema,
65619
+ deviceId: DeviceIdSchema$1,
65188
65620
  on: boolean()
65189
65621
  }), _void(), {
65190
65622
  kind: "mutation",
65191
65623
  auth: "protected"
65192
- }), method(object({
65193
- deviceId: DeviceIdSchema,
65194
- minutes: MinutesSchema
65195
- }), _void(), {
65196
- kind: "mutation",
65197
- auth: "protected"
65198
- }), method(object({
65199
- deviceId: DeviceIdSchema,
65200
- minutes: MinutesSchema
65201
- }), _void(), {
65202
- kind: "mutation",
65203
- auth: "protected"
65204
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
65624
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
65205
65625
  kind: "mutation",
65206
65626
  auth: "protected"
65207
65627
  });
@@ -66735,6 +67155,49 @@ object({
66735
67155
  DeviceType.PetFeeder,
66736
67156
  DeviceType.Heater
66737
67157
  ].filter((type) => type !== DeviceType.Sensor);
67158
+ var PowerSourceRefusalReasonSchema = _enum([
67159
+ "no-power-source",
67160
+ "switch-missing",
67161
+ "switch-offline",
67162
+ "switch-unknown",
67163
+ "restart-in-progress",
67164
+ "switch-call-failed"
67165
+ ]);
67166
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67167
+ accepted: literal(false),
67168
+ reason: PowerSourceRefusalReasonSchema,
67169
+ /** One line for the operator, naming the switch. */
67170
+ message: string()
67171
+ })]);
67172
+ var PowerSourceInfoSchema = object({
67173
+ /** False when the device has no power source linked; the rest is then empty. */
67174
+ linked: boolean(),
67175
+ switchDeviceId: number().nullable(),
67176
+ switchName: string().nullable(),
67177
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67178
+ switchOn: boolean().nullable(),
67179
+ switchOnline: boolean().nullable(),
67180
+ restartInProgress: boolean(),
67181
+ offSeconds: number().int()
67182
+ });
67183
+ object({
67184
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67185
+ switchOn: boolean().nullable(),
67186
+ offSeconds: number().int(),
67187
+ lastFetchedAt: number()
67188
+ });
67189
+ DeviceType.Gateway, DeviceType.Hub, 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;
67190
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
67191
+ systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67192
+ kind: "mutation",
67193
+ auth: "admin"
67194
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67195
+ kind: "mutation",
67196
+ auth: "admin"
67197
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67198
+ kind: "mutation",
67199
+ auth: "admin"
67200
+ });
66738
67201
  /**
66739
67202
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
66740
67203
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -67161,6 +67624,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
67161
67624
  deviceId: number(),
67162
67625
  status: PtzAutotrackStatusSchema
67163
67626
  });
67627
+ object({
67628
+ /** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
67629
+ enabled: boolean().nullable(),
67630
+ /** How long the pump runs per cycle, in seconds. Null while unknown. */
67631
+ onTime: number().min(0).nullable().meta(readingMeta("duration")),
67632
+ /** How long the pump rests per cycle, in seconds. Null while unknown. */
67633
+ offTime: number().min(0).nullable().meta(readingMeta("duration")),
67634
+ /** Ms epoch when the slice was last refreshed. */
67635
+ lastFetchedAt: number()
67636
+ });
67637
+ var DeviceIdSchema = number().int().nonnegative();
67638
+ var MinutesSchema = number().int().min(0);
67639
+ DeviceType.PetFountain, method(object({
67640
+ deviceId: DeviceIdSchema,
67641
+ on: boolean()
67642
+ }), _void(), {
67643
+ kind: "mutation",
67644
+ auth: "protected"
67645
+ }), method(object({
67646
+ deviceId: DeviceIdSchema,
67647
+ minutes: MinutesSchema
67648
+ }), _void(), {
67649
+ kind: "mutation",
67650
+ auth: "protected"
67651
+ }), method(object({
67652
+ deviceId: DeviceIdSchema,
67653
+ minutes: MinutesSchema
67654
+ }), _void(), {
67655
+ kind: "mutation",
67656
+ auth: "protected"
67657
+ });
67164
67658
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
67165
67659
  kind: "mutation",
67166
67660
  auth: "admin"
@@ -69874,7 +70368,13 @@ var RemoteMediaCommandSchema = _enum([
69874
70368
  "next",
69875
70369
  "previous",
69876
70370
  "setMute",
69877
- "selectSource"
70371
+ "selectSource",
70372
+ "turnOn",
70373
+ "turnOff",
70374
+ "volumeUp",
70375
+ "volumeDown",
70376
+ "channelUp",
70377
+ "channelDown"
69878
70378
  ]);
69879
70379
  /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
69880
70380
  var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
@@ -69895,7 +70395,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
69895
70395
  }), RemoteSendResultSchema, {
69896
70396
  kind: "mutation",
69897
70397
  auth: "protected"
69898
- }), method(deviceInput.extend({
70398
+ }), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
69899
70399
  command: RemoteMediaCommandSchema,
69900
70400
  muted: boolean().optional(),
69901
70401
  source: string().optional(),
@@ -70829,7 +71329,16 @@ DeviceType.Sensor;
70829
71329
  * future fields without breaking the existing call sites.
70830
71330
  */
70831
71331
  var EmailAddressSchema = email();
71332
+ /**
71333
+ * Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
71334
+ * relay, so a caller written before relays existed keeps working unchanged. A provider with one
71335
+ * fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
71336
+ * collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
71337
+ */
71338
+ var InstanceIdSchema = string().min(1).optional();
71339
+ var RelayPinSchema = object({ instanceId: InstanceIdSchema });
70832
71340
  var SendEmailInputSchema = object({
71341
+ instanceId: InstanceIdSchema,
70833
71342
  to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
70834
71343
  cc: array(EmailAddressSchema).optional(),
70835
71344
  bcc: array(EmailAddressSchema).optional(),
@@ -70865,11 +71374,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
70865
71374
  kind: "mutation",
70866
71375
  auth: "admin",
70867
71376
  access: "create"
70868
- }), method(_void(), SmtpStatusSchema, {
71377
+ }), method(RelayPinSchema, SmtpStatusSchema, {
70869
71378
  kind: "mutation",
70870
71379
  auth: "admin",
70871
71380
  access: "view"
70872
- }), method(_void(), SmtpStatusSchema, { auth: "admin" });
71381
+ }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
70873
71382
  /**
70874
71383
  * A single device snapshot returned as base64 JPEG/PNG.
70875
71384
  *
@@ -70901,10 +71410,12 @@ DeviceType.Camera, method(object({
70901
71410
  * even when the cache is well within the device's
70902
71411
  * `snapshotMaxAgeS` window.
70903
71412
  *
70904
- * **`force` is an OPERATOR signal, not a freshness preference.** On a
71413
+ * **`force` is a demand with a named principal, not a freshness
71414
+ * preference** — an operator button, the scheduled refresh (D847), or a
71415
+ * notification rule that left the camera's wake allowed (D998). On a
70905
71416
  * battery camera it is the one thing that walks past the wrapper's
70906
- * sleep gate and wakes the camera, so a background caller — a poller,
70907
- * an event handler, a thumbnail — must NEVER set it. Every such caller
71417
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
71418
+ * prestream must NEVER set it. Every such caller
70908
71419
  * gets the cached frame, which on a sleeping battery camera is the
70909
71420
  * correct answer: stale but honest beats woken.
70910
71421
  */
@@ -71719,7 +72230,11 @@ Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly())
71719
72230
  * `getSettingsUISchema()` surface.
71720
72231
  */
71721
72232
  var SwitchStatusSchema = object({
71722
- on: boolean().meta({ label: "On" }),
72233
+ /**
72234
+ * `null` = the device has never reported its state (a measurement that
72235
+ * has not happened is unknown, never `false`).
72236
+ */
72237
+ on: boolean().nullable().meta({ label: "On" }),
71723
72238
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
71724
72239
  lastChangedAt: number()
71725
72240
  });
@@ -71731,7 +72246,7 @@ DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceTyp
71731
72246
  auth: "protected"
71732
72247
  }), object({
71733
72248
  deviceId: number(),
71734
- on: boolean(),
72249
+ on: boolean().nullable(),
71735
72250
  lastChangedAt: number()
71736
72251
  });
71737
72252
  /** C0 controls, DEL and the C1 range: none of them belongs in a name. */
@@ -74743,6 +75258,26 @@ function buildDescriptor(capName, kind) {
74743
75258
  * contributes one entry per bound cap present in this map.
74744
75259
  */
74745
75260
  var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
75261
+ /**
75262
+ * What a remote key is CALLED and what it LOOKS like, for every role (D963),
75263
+ * shared by the admin UI and the viewer. A role is data on the wire; each
75264
+ * client resolves its name from `label` (English and Italian side by side) and
75265
+ * its glyph from `icon`, a lucide id from the shared icon catalogue — the
75266
+ * server sends an id, a client maps it to its own icon set.
75267
+ *
75268
+ * `legend` is text printed on the key INSTEAD of a glyph (a digit has no
75269
+ * pictogram): a client that can draw text shows it, one that cannot falls back
75270
+ * to `icon`.
75271
+ */
75272
+ function digit(n) {
75273
+ return {
75274
+ label: t(n, n),
75275
+ icon: "hash",
75276
+ legend: n
75277
+ };
75278
+ }
75279
+ digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
75280
+ DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
74746
75281
  var btn = (idSuffix, row, col, init) => ({
74747
75282
  idSuffix,
74748
75283
  row,
@@ -74869,7 +75404,35 @@ discriminatedUnion("kind", [object({
74869
75404
  kind: literal("pronto"),
74870
75405
  code: string()
74871
75406
  })]);
74872
- DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
75407
+ /**
75408
+ * Propose a running threshold from a device's own power history (planning#405).
75409
+ *
75410
+ * Pure and deterministic: the same series gives the same answer. The series is
75411
+ * a HELD-VALUE step series — a point's value stands until the next point — which
75412
+ * is how device-history stores a gauge, so "time at a level" is exact, not a
75413
+ * count of samples.
75414
+ *
75415
+ * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
75416
+ * near F. A device that is not near one level most of the time has no floor.
75417
+ * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
75418
+ * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
75419
+ * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
75420
+ * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
75421
+ * grid a person would type; stop dwell covers the longest pause; start dwell
75422
+ * covers the longest standby blip above T.
75423
+ * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
75424
+ * run must hold exactly one true interval and nothing may flap outside.
75425
+ */
75426
+ var SECOND_MS = 1e3;
75427
+ var MINUTE_MS$1 = 60 * SECOND_MS;
75428
+ 24 * (60 * MINUTE_MS$1);
75429
+ 10 * MINUTE_MS$1;
75430
+ 30 * SECOND_MS;
75431
+ 60 * SECOND_MS;
75432
+ 20 * MINUTE_MS$1;
75433
+ 10 * SECOND_MS;
75434
+ 10 * SECOND_MS;
75435
+ DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
74873
75436
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
74874
75437
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
74875
75438
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
@@ -75850,6 +76413,27 @@ Object.freeze({
75850
76413
  access: "view",
75851
76414
  role: "viewer"
75852
76415
  },
76416
+ "boardKeySource.getBoardKey": {
76417
+ capName: "board-key-source",
76418
+ capScope: "system",
76419
+ addonId: null,
76420
+ access: "view",
76421
+ role: "admin"
76422
+ },
76423
+ "boardKeySource.listBoards": {
76424
+ capName: "board-key-source",
76425
+ capScope: "system",
76426
+ addonId: null,
76427
+ access: "view",
76428
+ role: "admin"
76429
+ },
76430
+ "boardKeySource.listSources": {
76431
+ capName: "board-key-source",
76432
+ capScope: "system",
76433
+ addonId: null,
76434
+ access: "view",
76435
+ role: "admin"
76436
+ },
75853
76437
  "brightness.getStatus": {
75854
76438
  capName: "brightness",
75855
76439
  capScope: "device",
@@ -76389,6 +76973,13 @@ Object.freeze({
76389
76973
  access: "create",
76390
76974
  role: "admin"
76391
76975
  },
76976
+ "coreBlocks.proposeRunningThreshold": {
76977
+ capName: "core-blocks",
76978
+ capScope: "system",
76979
+ addonId: null,
76980
+ access: "view",
76981
+ role: "admin"
76982
+ },
76392
76983
  "coreBlocks.reportAutomationRun": {
76393
76984
  capName: "core-blocks",
76394
76985
  capScope: "system",
@@ -76900,6 +77491,13 @@ Object.freeze({
76900
77491
  access: "view",
76901
77492
  role: "admin"
76902
77493
  },
77494
+ "deviceExport.listInstances": {
77495
+ capName: "device-export",
77496
+ capScope: "system",
77497
+ addonId: null,
77498
+ access: "view",
77499
+ role: "admin"
77500
+ },
76903
77501
  "deviceExport.listSupportedDeviceKinds": {
76904
77502
  capName: "device-export",
76905
77503
  capScope: "system",
@@ -78531,6 +79129,13 @@ Object.freeze({
78531
79129
  access: "view",
78532
79130
  role: "admin"
78533
79131
  },
79132
+ "integrationInstances.setInstanceEnabled": {
79133
+ capName: "integration-instances",
79134
+ capScope: "system",
79135
+ addonId: null,
79136
+ access: "create",
79137
+ role: "admin"
79138
+ },
78534
79139
  "integrationInstances.testInstance": {
78535
79140
  capName: "integration-instances",
78536
79141
  capScope: "system",
@@ -79329,6 +79934,20 @@ Object.freeze({
79329
79934
  access: "view",
79330
79935
  role: "admin"
79331
79936
  },
79937
+ "mediaPlayer.channelDown": {
79938
+ capName: "media-player",
79939
+ capScope: "device",
79940
+ addonId: null,
79941
+ access: "create",
79942
+ role: "viewer"
79943
+ },
79944
+ "mediaPlayer.channelUp": {
79945
+ capName: "media-player",
79946
+ capScope: "device",
79947
+ addonId: null,
79948
+ access: "create",
79949
+ role: "viewer"
79950
+ },
79332
79951
  "mediaPlayer.getStatus": {
79333
79952
  capName: "media-player",
79334
79953
  capScope: "device",
@@ -79420,6 +80039,34 @@ Object.freeze({
79420
80039
  access: "create",
79421
80040
  role: "viewer"
79422
80041
  },
80042
+ "mediaPlayer.turnOff": {
80043
+ capName: "media-player",
80044
+ capScope: "device",
80045
+ addonId: null,
80046
+ access: "create",
80047
+ role: "viewer"
80048
+ },
80049
+ "mediaPlayer.turnOn": {
80050
+ capName: "media-player",
80051
+ capScope: "device",
80052
+ addonId: null,
80053
+ access: "create",
80054
+ role: "viewer"
80055
+ },
80056
+ "mediaPlayer.volumeDown": {
80057
+ capName: "media-player",
80058
+ capScope: "device",
80059
+ addonId: null,
80060
+ access: "create",
80061
+ role: "viewer"
80062
+ },
80063
+ "mediaPlayer.volumeUp": {
80064
+ capName: "media-player",
80065
+ capScope: "device",
80066
+ addonId: null,
80067
+ access: "create",
80068
+ role: "viewer"
80069
+ },
79423
80070
  "meshNetwork.getStatus": {
79424
80071
  capName: "mesh-network",
79425
80072
  capScope: "system",
@@ -80666,27 +81313,6 @@ Object.freeze({
80666
81313
  access: "create",
80667
81314
  role: "viewer"
80668
81315
  },
80669
- "petFountain.setPumpInterval": {
80670
- capName: "pet-fountain",
80671
- capScope: "device",
80672
- addonId: null,
80673
- access: "create",
80674
- role: "viewer"
80675
- },
80676
- "petFountain.setPumpOffMinutes": {
80677
- capName: "pet-fountain",
80678
- capScope: "device",
80679
- addonId: null,
80680
- access: "create",
80681
- role: "viewer"
80682
- },
80683
- "petFountain.setPumpOnMinutes": {
80684
- capName: "pet-fountain",
80685
- capScope: "device",
80686
- addonId: null,
80687
- access: "create",
80688
- role: "viewer"
80689
- },
80690
81316
  "pipelineAnalytics.addRetrainFrameFromRecording": {
80691
81317
  capName: "pipeline-analytics",
80692
81318
  capScope: "device",
@@ -82465,6 +83091,34 @@ Object.freeze({
82465
83091
  access: "create",
82466
83092
  role: "admin"
82467
83093
  },
83094
+ "pumpCycle.getStatus": {
83095
+ capName: "pump-cycle",
83096
+ capScope: "device",
83097
+ addonId: null,
83098
+ access: "view",
83099
+ role: "viewer"
83100
+ },
83101
+ "pumpCycle.setEnabled": {
83102
+ capName: "pump-cycle",
83103
+ capScope: "device",
83104
+ addonId: null,
83105
+ access: "create",
83106
+ role: "viewer"
83107
+ },
83108
+ "pumpCycle.setOffMinutes": {
83109
+ capName: "pump-cycle",
83110
+ capScope: "device",
83111
+ addonId: null,
83112
+ access: "create",
83113
+ role: "viewer"
83114
+ },
83115
+ "pumpCycle.setOnMinutes": {
83116
+ capName: "pump-cycle",
83117
+ capScope: "device",
83118
+ addonId: null,
83119
+ access: "create",
83120
+ role: "viewer"
83121
+ },
82468
83122
  "reboot.reboot": {
82469
83123
  capName: "reboot",
82470
83124
  capScope: "device",
@@ -82969,6 +83623,13 @@ Object.freeze({
82969
83623
  access: "create",
82970
83624
  role: "admin"
82971
83625
  },
83626
+ "remote.getAssumedStatus": {
83627
+ capName: "remote",
83628
+ capScope: "system",
83629
+ addonId: null,
83630
+ access: "view",
83631
+ role: "admin"
83632
+ },
82972
83633
  "remote.getConfig": {
82973
83634
  capName: "remote",
82974
83635
  capScope: "system",
@@ -85809,6 +86470,11 @@ Object.freeze({
85809
86470
  form: "single",
85810
86471
  optional: false
85811
86472
  }],
86473
+ "coreBlocks.proposeRunningThreshold": [{
86474
+ name: "deviceId",
86475
+ form: "single",
86476
+ optional: false
86477
+ }],
85812
86478
  "cover.close": [{
85813
86479
  name: "deviceId",
85814
86480
  form: "single",
@@ -86660,6 +87326,16 @@ Object.freeze({
86660
87326
  form: "single",
86661
87327
  optional: true
86662
87328
  }],
87329
+ "mediaPlayer.channelDown": [{
87330
+ name: "deviceId",
87331
+ form: "single",
87332
+ optional: false
87333
+ }],
87334
+ "mediaPlayer.channelUp": [{
87335
+ name: "deviceId",
87336
+ form: "single",
87337
+ optional: false
87338
+ }],
86663
87339
  "mediaPlayer.getStatus": [{
86664
87340
  name: "deviceId",
86665
87341
  form: "single",
@@ -86725,6 +87401,26 @@ Object.freeze({
86725
87401
  form: "single",
86726
87402
  optional: false
86727
87403
  }],
87404
+ "mediaPlayer.turnOff": [{
87405
+ name: "deviceId",
87406
+ form: "single",
87407
+ optional: false
87408
+ }],
87409
+ "mediaPlayer.turnOn": [{
87410
+ name: "deviceId",
87411
+ form: "single",
87412
+ optional: false
87413
+ }],
87414
+ "mediaPlayer.volumeDown": [{
87415
+ name: "deviceId",
87416
+ form: "single",
87417
+ optional: false
87418
+ }],
87419
+ "mediaPlayer.volumeUp": [{
87420
+ name: "deviceId",
87421
+ form: "single",
87422
+ optional: false
87423
+ }],
86728
87424
  "meter.getStatus": [{
86729
87425
  name: "deviceId",
86730
87426
  form: "single",
@@ -87034,21 +87730,6 @@ Object.freeze({
87034
87730
  form: "single",
87035
87731
  optional: false
87036
87732
  }],
87037
- "petFountain.setPumpInterval": [{
87038
- name: "deviceId",
87039
- form: "single",
87040
- optional: false
87041
- }],
87042
- "petFountain.setPumpOffMinutes": [{
87043
- name: "deviceId",
87044
- form: "single",
87045
- optional: false
87046
- }],
87047
- "petFountain.setPumpOnMinutes": [{
87048
- name: "deviceId",
87049
- form: "single",
87050
- optional: false
87051
- }],
87052
87733
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
87053
87734
  name: "deviceId",
87054
87735
  form: "single",
@@ -87684,6 +88365,26 @@ Object.freeze({
87684
88365
  form: "single",
87685
88366
  optional: false
87686
88367
  }],
88368
+ "pumpCycle.getStatus": [{
88369
+ name: "deviceId",
88370
+ form: "single",
88371
+ optional: false
88372
+ }],
88373
+ "pumpCycle.setEnabled": [{
88374
+ name: "deviceId",
88375
+ form: "single",
88376
+ optional: false
88377
+ }],
88378
+ "pumpCycle.setOffMinutes": [{
88379
+ name: "deviceId",
88380
+ form: "single",
88381
+ optional: false
88382
+ }],
88383
+ "pumpCycle.setOnMinutes": [{
88384
+ name: "deviceId",
88385
+ form: "single",
88386
+ optional: false
88387
+ }],
87687
88388
  "reboot.reboot": [{
87688
88389
  name: "deviceId",
87689
88390
  form: "single",
@@ -87885,6 +88586,11 @@ Object.freeze({
87885
88586
  form: "single",
87886
88587
  optional: true
87887
88588
  }],
88589
+ "remote.getAssumedStatus": [{
88590
+ name: "deviceId",
88591
+ form: "single",
88592
+ optional: false
88593
+ }],
87888
88594
  "remote.getConfig": [{
87889
88595
  name: "deviceId",
87890
88596
  form: "single",
@@ -88432,99 +89138,6 @@ Object.freeze({
88432
89138
  "network-access": "ingress",
88433
89139
  "smtp-provider": "email"
88434
89140
  });
88435
- /**
88436
- * A saved Customize assignment (D936). The schema is the type: callers use
88437
- * `z.infer`, they do not restate the shape.
88438
- */
88439
- var OverrideSourceSchema = object({
88440
- addonId: string().min(1),
88441
- stableId: string().min(1),
88442
- cap: string().min(1),
88443
- fieldPath: string().min(1)
88444
- });
88445
- var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
88446
- object({ kind: literal("identity") }),
88447
- object({ kind: literal("invert") }),
88448
- object({
88449
- kind: literal("threshold"),
88450
- comparison: _enum(["gte", "lte"]),
88451
- threshold: number(),
88452
- startDwellMs: number().nonnegative(),
88453
- stopDwellMs: number().nonnegative()
88454
- }),
88455
- object({
88456
- kind: literal("linear"),
88457
- scale: number(),
88458
- offset: number(),
88459
- clampMin: number().optional(),
88460
- clampMax: number().optional()
88461
- }),
88462
- object({
88463
- kind: literal("enum-map"),
88464
- mapping: record(string(), string().nullable())
88465
- }),
88466
- object({ kind: literal("number") })
88467
- ]);
88468
- var ScalarOverrideDraftSchema = object({
88469
- kind: literal("scalar"),
88470
- cap: string().min(1),
88471
- targetId: string().min(1),
88472
- source: OverrideSourceSchema,
88473
- transform: CustomizeTransformDraftSchema
88474
- });
88475
- var KeyedArrayOverrideDraftSchema = object({
88476
- kind: literal("keyedArray"),
88477
- cap: string().min(1),
88478
- targetId: string().min(1),
88479
- key: string().min(1),
88480
- label: string().min(1),
88481
- fieldPath: string().min(1),
88482
- source: OverrideSourceSchema,
88483
- transform: CustomizeTransformDraftSchema
88484
- });
88485
- var PulseOverrideDraftSchema = object({
88486
- kind: literal("pulse"),
88487
- cap: string().min(1),
88488
- targetId: string().min(1),
88489
- enabled: boolean(),
88490
- debounceMs: number().nonnegative(),
88491
- edges: array(_enum([
88492
- "rising",
88493
- "button",
88494
- "native-event"
88495
- ])).min(1).optional(),
88496
- sources: array(OverrideSourceSchema).min(1)
88497
- });
88498
- var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
88499
- "in-addition",
88500
- "confirm",
88501
- "replace"
88502
- ]).optional() });
88503
- discriminatedUnion("kind", [
88504
- ScalarOverrideDraftSchema,
88505
- KeyedArrayOverrideDraftSchema,
88506
- PulseOverrideDraftSchema,
88507
- object({
88508
- kind: literal("span"),
88509
- cap: string().min(1),
88510
- targetId: string().min(1),
88511
- timeoutMs: number().nonnegative(),
88512
- cooldownMs: number().nonnegative().optional(),
88513
- sources: array(SpanSourceDraftSchema)
88514
- })
88515
- ]);
88516
- object({
88517
- targetId: string().min(1),
88518
- configured: boolean(),
88519
- source: _enum(["native", "assigned"]),
88520
- state: _enum([
88521
- "active",
88522
- "stale",
88523
- "released",
88524
- "unavailable"
88525
- ]),
88526
- reason: string().nullable()
88527
- });
88528
89141
  var G711_SCALE_CORRECTION_DB = {
88529
89142
  PCMU: 20 * Math.log10(4),
88530
89143
  PCMA: 20 * Math.log10(8)
@@ -89140,6 +89753,7 @@ var STATE_SUMMARY_VARS = [
89140
89753
  [...RULE_TEXT],
89141
89754
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
89142
89755
  ([...RULE_TEXT], [...COMBINED_ALARM]),
89756
+ ([...RULE_TEXT], [...COMBINED_ALARM]),
89143
89757
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
89144
89758
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
89145
89759
  ([...RULE_TEXT], [...CONSUMABLE]),
@@ -91032,30 +91646,55 @@ var ExportGoogleAddon = class extends BaseAddon {
91032
91646
  actionScenes.reconcile().catch((err) => {
91033
91647
  this.ctx.logger.warn("export-google: action scene reconcile at boot failed", { meta: { error: errMsg$1(err) } });
91034
91648
  });
91649
+ const ownInstance = (instanceId) => assertOwnExportInstance("export-google", ADDON_ID, instanceId);
91035
91650
  const deviceExportProvider = {
91036
- getStatus: async () => ({
91037
- linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
91038
- exposedDeviceCount: this.config.exposed.length,
91039
- setup: await this.buildSetupBlock()
91040
- }),
91041
- listSupportedDeviceKinds: async () => [...SUPPORTED_DEVICE_KINDS],
91042
- listExposedDevices: async () => this.config.exposed.map((entry) => ({ deviceId: String(entry.deviceId) })),
91043
- exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
91044
- unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
91651
+ getStatus: async (input) => {
91652
+ ownInstance(statusInstanceOf(input));
91653
+ return {
91654
+ linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
91655
+ exposedDeviceCount: this.config.exposed.length,
91656
+ setup: await this.buildSetupBlock()
91657
+ };
91658
+ },
91659
+ listInstances: async () => [{
91660
+ instanceId: ADDON_ID,
91661
+ name: "Google Home",
91662
+ enabled: true,
91663
+ kind: "google-home"
91664
+ }],
91665
+ listSupportedDeviceKinds: async ({ instanceId }) => {
91666
+ ownInstance(instanceId);
91667
+ return [...SUPPORTED_DEVICE_KINDS];
91668
+ },
91669
+ listExposedDevices: async ({ instanceId }) => {
91670
+ ownInstance(instanceId);
91671
+ return this.config.exposed.map((entry) => ({ deviceId: String(entry.deviceId) }));
91672
+ },
91673
+ exposeDevice: async ({ instanceId, deviceId }) => {
91674
+ ownInstance(instanceId);
91675
+ return this.exposeDevice(deviceId);
91676
+ },
91677
+ unexposeDevice: async ({ instanceId, deviceId }) => {
91678
+ ownInstance(instanceId);
91679
+ return this.unexposeDevice(deviceId);
91680
+ },
91045
91681
  listSupportedEntityKinds: async () => ["device", "action"],
91046
- listExposedEntities: async () => {
91682
+ listExposedEntities: async ({ instanceId }) => {
91683
+ ownInstance(instanceId);
91047
91684
  await actionScenes.reconcile();
91048
91685
  return [...this.config.exposed.map((entry) => ({ entity: {
91049
91686
  kind: "device",
91050
91687
  deviceId: String(entry.deviceId)
91051
91688
  } })), ...actionScenes.list()];
91052
91689
  },
91053
- exposeEntity: async ({ entity }) => {
91690
+ exposeEntity: async ({ instanceId, entity }) => {
91691
+ ownInstance(instanceId);
91054
91692
  if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
91055
91693
  if (entity.kind === "action") return actionScenes.expose(entity.actionId);
91056
91694
  throw new Error("export-google: a notification target cannot be exported to Google Home");
91057
91695
  },
91058
- unexposeEntity: async ({ entity }) => {
91696
+ unexposeEntity: async ({ instanceId, entity }) => {
91697
+ ownInstance(instanceId);
91059
91698
  if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
91060
91699
  if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
91061
91700
  throw new Error("export-google: a notification target cannot be exported to Google Home");