@camstack/addon-provider-homeassistant 1.2.638 → 1.2.640

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-C_XoeULr.js");
2
+ const require_ha_broker_source = require("./ha-broker-source-0HGmZj7D.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_zlib = require("node:zlib");
5
5
  //#region src/ha-admin-link.ts
@@ -72,21 +72,21 @@ function registerHaAdminLink(ctx, deviceId, brokerId, subject) {
72
72
  });
73
73
  return null;
74
74
  };
75
- ctx.registerNativeCap(require_dist.deviceAdminLinkCapability, { getAdminLink: async (input) => {
75
+ ctx.registerNativeCap(require_ha_broker_source.deviceAdminLinkCapability, { getAdminLink: async (input) => {
76
76
  if (input.deviceId !== deviceId) throw new Error(`HaAdminLink: deviceId mismatch, expected ${deviceId}, got ${input.deviceId}`);
77
77
  if (cachedBaseUrl === null) {
78
78
  const raw = (await ctx.api.broker.getBrokerConfig.query({ id: brokerId }))?.["baseUrl"];
79
79
  if (typeof raw !== "string" || raw.length === 0) return refuse("no-base-url");
80
80
  cachedBaseUrl = raw;
81
81
  }
82
- const base = require_dist.parseAdminBase(cachedBaseUrl);
82
+ const base = require_ha_broker_source.parseAdminBase(cachedBaseUrl);
83
83
  if (!base.ok) {
84
84
  cachedBaseUrl = null;
85
85
  return refuse("base-unusable", { baseReason: base.reason });
86
86
  }
87
87
  const page = pageFor(subject, base.basePath);
88
88
  if (page === null) return refuse("empty-subject");
89
- const built = require_dist.buildDeviceAdminUrl({
89
+ const built = require_ha_broker_source.buildDeviceAdminUrl({
90
90
  host: base.host,
91
91
  port: base.port,
92
92
  scheme: base.scheme,
@@ -114,25 +114,25 @@ function registerHaAdminLink(ctx, deviceId, brokerId, subject) {
114
114
  * `readHaSource` (returns null) — do NOT use `z.object(haSourceSchemaFields).parse`.
115
115
  */
116
116
  var haSourceSchemaFields = {
117
- system: require_dist.literal("homeassistant").optional(),
118
- brokerId: require_dist.string(),
119
- haDeviceId: require_dist.string().optional(),
120
- entityId: require_dist.string().optional(),
121
- referenceEntityId: require_dist.string().nullable().optional(),
122
- capabilities: require_dist.array(require_dist.string()).default([]),
123
- role: require_dist.string().optional(),
124
- childDeviceIds: require_dist.array(require_dist.number()).default([]),
125
- unitOfMeasurement: require_dist.string().optional(),
126
- deviceClass: require_dist.string().optional(),
127
- integrationId: require_dist.string().optional(),
128
- options: require_dist.array(require_dist.string()).optional(),
129
- features: require_dist.array(require_dist.string()).optional(),
117
+ system: require_ha_broker_source.literal("homeassistant").optional(),
118
+ brokerId: require_ha_broker_source.string(),
119
+ haDeviceId: require_ha_broker_source.string().optional(),
120
+ entityId: require_ha_broker_source.string().optional(),
121
+ referenceEntityId: require_ha_broker_source.string().nullable().optional(),
122
+ capabilities: require_ha_broker_source.array(require_ha_broker_source.string()).default([]),
123
+ role: require_ha_broker_source.string().optional(),
124
+ childDeviceIds: require_ha_broker_source.array(require_ha_broker_source.number()).default([]),
125
+ unitOfMeasurement: require_ha_broker_source.string().optional(),
126
+ deviceClass: require_ha_broker_source.string().optional(),
127
+ integrationId: require_ha_broker_source.string().optional(),
128
+ options: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
129
+ features: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
130
130
  /** Sibling meter sensors whose readings this entity carries as `power-meter` (D951). */
131
- meterEntities: require_dist.object({
132
- power: require_dist.string().optional(),
133
- energy: require_dist.string().optional(),
134
- voltage: require_dist.string().optional(),
135
- current: require_dist.string().optional()
131
+ meterEntities: require_ha_broker_source.object({
132
+ power: require_ha_broker_source.string().optional(),
133
+ energy: require_ha_broker_source.string().optional(),
134
+ voltage: require_ha_broker_source.string().optional(),
135
+ current: require_ha_broker_source.string().optional()
136
136
  }).optional()
137
137
  };
138
138
  /** Project a persisted config blob into a typed source, or null when the
@@ -176,7 +176,7 @@ function readHaSource(config) {
176
176
  function attachAccessoriesCap(ctx, deviceId, opts) {
177
177
  let childIds = [];
178
178
  const hidden = new Set(opts.initialHidden);
179
- ctx.registerNativeCap(require_dist.accessoriesCapability, {
179
+ ctx.registerNativeCap(require_ha_broker_source.accessoriesCapability, {
180
180
  getStatus: async () => ({
181
181
  childDeviceIds: childIds,
182
182
  hiddenChildIds: [...hidden]
@@ -193,7 +193,7 @@ function attachAccessoriesCap(ctx, deviceId, opts) {
193
193
  type: "device",
194
194
  id: deviceId
195
195
  },
196
- category: require_dist.EventCategory.AccessoriesChildVisibilityChanged,
196
+ category: require_ha_broker_source.EventCategory.AccessoriesChildVisibilityChanged,
197
197
  data: {
198
198
  deviceId,
199
199
  childDeviceId,
@@ -211,7 +211,7 @@ function attachAccessoriesCap(ctx, deviceId, opts) {
211
211
  type: "device",
212
212
  id: deviceId
213
213
  },
214
- category: require_dist.EventCategory.AccessoriesChanged,
214
+ category: require_ha_broker_source.EventCategory.AccessoriesChanged,
215
215
  data: {
216
216
  deviceId,
217
217
  childDeviceIds: childIds,
@@ -232,23 +232,23 @@ function attachAccessoriesCap(ctx, deviceId, opts) {
232
232
  * in the materialisation factory (Phase E) where each domain becomes
233
233
  * its own DeviceType + cap set.
234
234
  */
235
- var HaEntityStateSchema = require_dist.object({
236
- entity_id: require_dist.string().min(1),
235
+ var HaEntityStateSchema = require_ha_broker_source.object({
236
+ entity_id: require_ha_broker_source.string().min(1),
237
237
  /** Domain-specific state value (`on`/`off`/`open`/temperature
238
238
  * number-as-string/etc.). Always a string in HA. */
239
- state: require_dist.string(),
239
+ state: require_ha_broker_source.string(),
240
240
  /** Free-form attribute map. Domain-specific. */
241
- attributes: require_dist.record(require_dist.string(), require_dist.unknown()),
241
+ attributes: require_ha_broker_source.record(require_ha_broker_source.string(), require_ha_broker_source.unknown()),
242
242
  /** Optional context envelope (user/parent id) the HA server attaches. */
243
- context: require_dist.object({
244
- id: require_dist.string(),
245
- parent_id: require_dist.string().nullable(),
246
- user_id: require_dist.string().nullable()
243
+ context: require_ha_broker_source.object({
244
+ id: require_ha_broker_source.string(),
245
+ parent_id: require_ha_broker_source.string().nullable(),
246
+ user_id: require_ha_broker_source.string().nullable()
247
247
  }).optional(),
248
248
  /** ISO 8601 timestamp of the last state change. */
249
- last_changed: require_dist.string(),
249
+ last_changed: require_ha_broker_source.string(),
250
250
  /** ISO 8601 timestamp of the last update (state OR attributes). */
251
- last_updated: require_dist.string()
251
+ last_updated: require_ha_broker_source.string()
252
252
  });
253
253
  /**
254
254
  * Auth strategy. Two mutually-exclusive options:
@@ -259,16 +259,16 @@ var HaEntityStateSchema = require_dist.object({
259
259
  * the addon config; the WS URL points at their HA instance
260
260
  * (`ws://ha.example:8123/api/websocket` style).
261
261
  */
262
- var HaAuthConfigSchema = require_dist.discriminatedUnion("kind", [require_dist.object({
263
- kind: require_dist.literal("supervisor"),
262
+ var HaAuthConfigSchema = require_ha_broker_source.discriminatedUnion("kind", [require_ha_broker_source.object({
263
+ kind: require_ha_broker_source.literal("supervisor"),
264
264
  /** Token injected by the Supervisor at runtime via env. */
265
- supervisorToken: require_dist.string().min(1).meta({ secret: true })
266
- }), require_dist.object({
267
- kind: require_dist.literal("long-lived"),
265
+ supervisorToken: require_ha_broker_source.string().min(1).meta({ secret: true })
266
+ }), require_ha_broker_source.object({
267
+ kind: require_ha_broker_source.literal("long-lived"),
268
268
  /** Origin URL of the HA instance (e.g. `https://ha.example:8123`). */
269
- baseUrl: require_dist.url(),
269
+ baseUrl: require_ha_broker_source.url(),
270
270
  /** Long-lived access token issued by the user in their HA profile. */
271
- accessToken: require_dist.string().min(1).meta({ secret: true })
271
+ accessToken: require_ha_broker_source.string().min(1).meta({ secret: true })
272
272
  })]);
273
273
  /** HA's standard domain enum — supported subset; future domains added
274
274
  * as integration coverage grows. */
@@ -306,7 +306,7 @@ var HaDomain = /* @__PURE__ */ function(HaDomain) {
306
306
  * an unknown unit is never guessed (D393, D944).
307
307
  */
308
308
  function takeReading(logger, deviceId, value, rawUnit, quantity) {
309
- const result = require_dist.ingestReading({
309
+ const result = require_ha_broker_source.ingestReading({
310
310
  value,
311
311
  rawUnit,
312
312
  quantity
@@ -367,7 +367,7 @@ function applyMeterReading(prev, field, value, lastFetchedAt) {
367
367
  lastFetchedAt
368
368
  };
369
369
  }
370
- var LOAD_TYPES = new Set(require_dist.powerMeterCapability.deviceTypes.filter((type) => type !== require_dist.DeviceType.Sensor));
370
+ var LOAD_TYPES = new Set(require_ha_broker_source.powerMeterCapability.deviceTypes.filter((type) => type !== require_ha_broker_source.DeviceType.Sensor));
371
371
  function isLoad(entity) {
372
372
  return LOAD_TYPES.has(entity.deviceType) && entity.entityCategory === void 0 && !entity.capabilities.includes("power-meter");
373
373
  }
@@ -428,7 +428,7 @@ var HaMeterCarrier = class {
428
428
  const entityId = meters[field];
429
429
  return entityId === void 0 ? [] : [[entityId, field]];
430
430
  }));
431
- this.ctx.registerNativeCap(require_dist.powerMeterCapability, { getStatus: async () => this.runtimeState.getCapState("power-meter") ?? COLD_START$20 });
431
+ this.ctx.registerNativeCap(require_ha_broker_source.powerMeterCapability, { getStatus: async () => this.runtimeState.getCapState("power-meter") ?? COLD_START$20 });
432
432
  this.runtimeState.setCapState("power-meter", {
433
433
  ...COLD_START$20,
434
434
  ...this.runtimeState.getCapState("power-meter")
@@ -469,7 +469,7 @@ var HaMeterCarrier = class {
469
469
  * and carries `childDeviceIds` so parent-mode devices can host the
470
470
  * accessories cap for their entity-children.
471
471
  */
472
- var haChildDeviceSchema = require_dist.object({ ...haSourceSchemaFields });
472
+ var haChildDeviceSchema = require_ha_broker_source.object({ ...haSourceSchemaFields });
473
473
  /**
474
474
  * Abstract base for every HA-entity-backed CamStack accessory device.
475
475
  *
@@ -490,14 +490,14 @@ var haChildDeviceSchema = require_dist.object({ ...haSourceSchemaFields });
490
490
  * own (beyond BaseDevice's auto-registered `device-status` /
491
491
  * `feature-probe`).
492
492
  */
493
- var DEVICE_FEATURE_VALUES = new Set(Object.values(require_dist.DeviceFeature));
493
+ var DEVICE_FEATURE_VALUES = new Set(Object.values(require_ha_broker_source.DeviceFeature));
494
494
  /** Keep only strings that are valid DeviceFeature enum values (the persisted
495
495
  * config stores them as plain strings). */
496
496
  function parseDeviceFeatures(raw) {
497
497
  if (!Array.isArray(raw)) return [];
498
498
  return raw.filter((f) => typeof f === "string" && DEVICE_FEATURE_VALUES.has(f));
499
499
  }
500
- var HaBaseChildDevice = class HaBaseChildDevice extends require_dist.BaseDevice {
500
+ var HaBaseChildDevice = class HaBaseChildDevice extends require_ha_broker_source.BaseDevice {
501
501
  /** Mapping-derived feature flags (e.g. `lock-open`), read from the persisted
502
502
  * config at construction. Surfaced on `device.features` (and re-published to
503
503
  * the device meta in `onActivate` via `refreshFeatures`) so the UI gates
@@ -639,7 +639,7 @@ var HaBaseChildDevice = class HaBaseChildDevice extends require_dist.BaseDevice
639
639
  this.deviceLogger.warn("ha-child getRawState failed to read cached state", { meta: {
640
640
  brokerId: this.brokerId,
641
641
  entityId: this.entityId,
642
- error: require_dist.errMsg(err)
642
+ error: require_ha_broker_source.errMsg(err)
643
643
  } });
644
644
  return null;
645
645
  }
@@ -689,7 +689,7 @@ var HaBaseChildDevice = class HaBaseChildDevice extends require_dist.BaseDevice
689
689
  entityId: this.entityId,
690
690
  domain,
691
691
  service,
692
- error: require_dist.errMsg(err)
692
+ error: require_ha_broker_source.errMsg(err)
693
693
  } });
694
694
  throw err;
695
695
  }
@@ -716,7 +716,7 @@ var HaBaseChildDevice = class HaBaseChildDevice extends require_dist.BaseDevice
716
716
  this.deviceLogger.warn("ha-child failed to register broker subscription", { meta: {
717
717
  entityId: this.entityId,
718
718
  brokerId: this.brokerId,
719
- error: require_dist.errMsg(err)
719
+ error: require_ha_broker_source.errMsg(err)
720
720
  } });
721
721
  return false;
722
722
  }
@@ -757,7 +757,7 @@ var HaBaseChildDevice = class HaBaseChildDevice extends require_dist.BaseDevice
757
757
  } catch (err) {
758
758
  this.deviceLogger.warn("ha-child state-push handler error", { meta: {
759
759
  entityId: this.entityId,
760
- error: require_dist.errMsg(err)
760
+ error: require_ha_broker_source.errMsg(err)
761
761
  } });
762
762
  }
763
763
  };
@@ -786,7 +786,7 @@ var HaButtonDevice = class extends HaBaseChildDevice {
786
786
  this.registerButtonCap();
787
787
  }
788
788
  registerButtonCap() {
789
- this.ctx.registerNativeCap(require_dist.buttonCapability, { press: async () => {
789
+ this.ctx.registerNativeCap(require_ha_broker_source.buttonCapability, { press: async () => {
790
790
  const domain = this.entityId.split(".")[0] ?? "button";
791
791
  if (domain === "scene") {
792
792
  await this.callHaService("scene", "turn_on");
@@ -844,7 +844,7 @@ var HaUpdateDevice = class extends HaBaseChildDevice {
844
844
  });
845
845
  }
846
846
  registerUpdateCap() {
847
- this.ctx.registerNativeCap(require_dist.updateCapability, {
847
+ this.ctx.registerNativeCap(require_ha_broker_source.updateCapability, {
848
848
  getStatus: async () => {
849
849
  return this.runtimeState.getCapState(UPDATE_CAP) ?? COLD_START$19;
850
850
  },
@@ -928,7 +928,7 @@ var HaSwitchDevice = class extends HaBaseChildDevice {
928
928
  });
929
929
  }
930
930
  registerSwitchCap() {
931
- this.ctx.registerNativeCap(require_dist.switchCapability, {
931
+ this.ctx.registerNativeCap(require_ha_broker_source.switchCapability, {
932
932
  getStatus: async () => {
933
933
  return this.runtimeState.getCapState("switch") ?? {
934
934
  on: false,
@@ -1045,7 +1045,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1045
1045
  const stored = this.sourceInfo.quantity;
1046
1046
  if (stored !== void 0 && stored !== "device") return stored;
1047
1047
  if (unitRaw === void 0) return "none";
1048
- const learned = require_dist.quantityFromUnit(unitRaw);
1048
+ const learned = require_ha_broker_source.quantityFromUnit(unitRaw);
1049
1049
  if (learned === void 0 || learned === "device") {
1050
1050
  this.deviceLogger.warn("numeric reading refused", {
1051
1051
  tags: { deviceId: this.id },
@@ -1071,7 +1071,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1071
1071
  value: "",
1072
1072
  lastFetchedAt: 0
1073
1073
  };
1074
- this.ctx.registerNativeCap(require_dist.enumSensorCapability, { getStatus: async () => {
1074
+ this.ctx.registerNativeCap(require_ha_broker_source.enumSensorCapability, { getStatus: async () => {
1075
1075
  return this.runtimeState.getCapState("enum-sensor") ?? COLD_START;
1076
1076
  } });
1077
1077
  this.runtimeState.setCapState("enum-sensor", COLD_START);
@@ -1083,7 +1083,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1083
1083
  temperature: 0,
1084
1084
  lastFetchedAt: 0
1085
1085
  };
1086
- this.ctx.registerNativeCap(require_dist.temperatureSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1086
+ this.ctx.registerNativeCap(require_ha_broker_source.temperatureSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1087
1087
  return;
1088
1088
  }
1089
1089
  case "humidity-sensor": {
@@ -1091,7 +1091,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1091
1091
  humidity: 0,
1092
1092
  lastFetchedAt: 0
1093
1093
  };
1094
- this.ctx.registerNativeCap(require_dist.humiditySensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1094
+ this.ctx.registerNativeCap(require_ha_broker_source.humiditySensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1095
1095
  return;
1096
1096
  }
1097
1097
  case "ambient-light-sensor": {
@@ -1099,7 +1099,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1099
1099
  illuminance: 0,
1100
1100
  lastFetchedAt: 0
1101
1101
  };
1102
- this.ctx.registerNativeCap(require_dist.ambientLightSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1102
+ this.ctx.registerNativeCap(require_ha_broker_source.ambientLightSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1103
1103
  return;
1104
1104
  }
1105
1105
  case "pressure-sensor": {
@@ -1107,7 +1107,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1107
1107
  pressure: 0,
1108
1108
  lastFetchedAt: 0
1109
1109
  };
1110
- this.ctx.registerNativeCap(require_dist.pressureSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1110
+ this.ctx.registerNativeCap(require_ha_broker_source.pressureSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1111
1111
  return;
1112
1112
  }
1113
1113
  case "numeric-sensor": {
@@ -1115,7 +1115,7 @@ var HaNumericSensorDevice = class extends HaBaseChildDevice {
1115
1115
  value: 0,
1116
1116
  lastFetchedAt: 0
1117
1117
  };
1118
- this.ctx.registerNativeCap(require_dist.numericSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1118
+ this.ctx.registerNativeCap(require_ha_broker_source.numericSensorCapability, { getStatus: async () => this.readSlice(COLD_START) });
1119
1119
  return;
1120
1120
  }
1121
1121
  }
@@ -1207,61 +1207,61 @@ var HaBinarySensorDevice = class extends HaBaseChildDevice {
1207
1207
  registerCap(name) {
1208
1208
  switch (name) {
1209
1209
  case "contact":
1210
- this.ctx.registerNativeCap(require_dist.contactCapability, { getStatus: async () => this.readSlice({
1210
+ this.ctx.registerNativeCap(require_ha_broker_source.contactCapability, { getStatus: async () => this.readSlice({
1211
1211
  entryOpen: false,
1212
1212
  lastChangedAt: 0
1213
1213
  }) });
1214
1214
  return;
1215
1215
  case "flood":
1216
- this.ctx.registerNativeCap(require_dist.floodCapability, { getStatus: async () => this.readSlice({
1216
+ this.ctx.registerNativeCap(require_ha_broker_source.floodCapability, { getStatus: async () => this.readSlice({
1217
1217
  flooded: false,
1218
1218
  lastChangedAt: 0
1219
1219
  }) });
1220
1220
  return;
1221
1221
  case "smoke":
1222
- this.ctx.registerNativeCap(require_dist.smokeCapability, { getStatus: async () => this.readSlice({
1222
+ this.ctx.registerNativeCap(require_ha_broker_source.smokeCapability, { getStatus: async () => this.readSlice({
1223
1223
  detected: false,
1224
1224
  lastChangedAt: 0
1225
1225
  }) });
1226
1226
  return;
1227
1227
  case "carbon-monoxide":
1228
- this.ctx.registerNativeCap(require_dist.carbonMonoxideCapability, { getStatus: async () => this.readSlice({
1228
+ this.ctx.registerNativeCap(require_ha_broker_source.carbonMonoxideCapability, { getStatus: async () => this.readSlice({
1229
1229
  detected: false,
1230
1230
  lastChangedAt: 0
1231
1231
  }) });
1232
1232
  return;
1233
1233
  case "gas":
1234
- this.ctx.registerNativeCap(require_dist.gasCapability, { getStatus: async () => this.readSlice({
1234
+ this.ctx.registerNativeCap(require_ha_broker_source.gasCapability, { getStatus: async () => this.readSlice({
1235
1235
  detected: false,
1236
1236
  lastChangedAt: 0
1237
1237
  }) });
1238
1238
  return;
1239
1239
  case "tamper":
1240
- this.ctx.registerNativeCap(require_dist.tamperCapability, { getStatus: async () => this.readSlice({
1240
+ this.ctx.registerNativeCap(require_ha_broker_source.tamperCapability, { getStatus: async () => this.readSlice({
1241
1241
  tampered: false,
1242
1242
  lastChangedAt: 0
1243
1243
  }) });
1244
1244
  return;
1245
1245
  case "vibration":
1246
- this.ctx.registerNativeCap(require_dist.vibrationCapability, { getStatus: async () => this.readSlice({
1246
+ this.ctx.registerNativeCap(require_ha_broker_source.vibrationCapability, { getStatus: async () => this.readSlice({
1247
1247
  detected: false,
1248
1248
  lastChangedAt: 0
1249
1249
  }) });
1250
1250
  return;
1251
1251
  case "connectivity":
1252
- this.ctx.registerNativeCap(require_dist.connectivityCapability, { getStatus: async () => this.readSlice({
1252
+ this.ctx.registerNativeCap(require_ha_broker_source.connectivityCapability, { getStatus: async () => this.readSlice({
1253
1253
  connected: false,
1254
1254
  lastChangedAt: 0
1255
1255
  }) });
1256
1256
  return;
1257
1257
  case "binary":
1258
- this.ctx.registerNativeCap(require_dist.binaryCapability, { getStatus: async () => this.readSlice({
1258
+ this.ctx.registerNativeCap(require_ha_broker_source.binaryCapability, { getStatus: async () => this.readSlice({
1259
1259
  on: false,
1260
1260
  lastChangedAt: 0
1261
1261
  }) });
1262
1262
  return;
1263
1263
  case "motion":
1264
- this.ctx.registerNativeCap(require_dist.motionCapability, {
1264
+ this.ctx.registerNativeCap(require_ha_broker_source.motionCapability, {
1265
1265
  getStatus: async () => this.readSlice({
1266
1266
  detected: false,
1267
1267
  lastDetectedAt: null,
@@ -1434,7 +1434,7 @@ var HaLightDevice = class extends HaBaseChildDevice {
1434
1434
  }
1435
1435
  }
1436
1436
  registerSwitchCap() {
1437
- this.ctx.registerNativeCap(require_dist.switchCapability, {
1437
+ this.ctx.registerNativeCap(require_ha_broker_source.switchCapability, {
1438
1438
  getStatus: async () => {
1439
1439
  return this.runtimeState.getCapState("switch") ?? {
1440
1440
  on: false,
@@ -1447,7 +1447,7 @@ var HaLightDevice = class extends HaBaseChildDevice {
1447
1447
  });
1448
1448
  }
1449
1449
  registerBrightnessCap() {
1450
- this.ctx.registerNativeCap(require_dist.brightnessCapability, {
1450
+ this.ctx.registerNativeCap(require_ha_broker_source.brightnessCapability, {
1451
1451
  getStatus: async () => {
1452
1452
  return this.runtimeState.getCapState("brightness") ?? {
1453
1453
  level: 0,
@@ -1460,7 +1460,7 @@ var HaLightDevice = class extends HaBaseChildDevice {
1460
1460
  });
1461
1461
  }
1462
1462
  registerColorCap() {
1463
- this.ctx.registerNativeCap(require_dist.colorCapability, {
1463
+ this.ctx.registerNativeCap(require_ha_broker_source.colorCapability, {
1464
1464
  getStatus: async () => {
1465
1465
  return this.runtimeState.getCapState("color") ?? {
1466
1466
  mode: "rgb",
@@ -1590,7 +1590,7 @@ var HaCoverDevice = class extends HaBaseChildDevice {
1590
1590
  });
1591
1591
  }
1592
1592
  registerCoverCap() {
1593
- this.ctx.registerNativeCap(require_dist.coverCapability, {
1593
+ this.ctx.registerNativeCap(require_ha_broker_source.coverCapability, {
1594
1594
  getStatus: async () => {
1595
1595
  return this.runtimeState.getCapState("cover") ?? COLD_START$18;
1596
1596
  },
@@ -1661,7 +1661,7 @@ var HaValveDevice = class extends HaBaseChildDevice {
1661
1661
  });
1662
1662
  }
1663
1663
  registerValveCap() {
1664
- this.ctx.registerNativeCap(require_dist.valveCapability, {
1664
+ this.ctx.registerNativeCap(require_ha_broker_source.valveCapability, {
1665
1665
  getStatus: async () => {
1666
1666
  return this.runtimeState.getCapState("valve") ?? COLD_START$17;
1667
1667
  },
@@ -1735,7 +1735,7 @@ var HaLockDevice = class extends HaBaseChildDevice {
1735
1735
  });
1736
1736
  }
1737
1737
  registerLockCap() {
1738
- this.ctx.registerNativeCap(require_dist.lockControlCapability, {
1738
+ this.ctx.registerNativeCap(require_ha_broker_source.lockControlCapability, {
1739
1739
  getStatus: async () => {
1740
1740
  return this.runtimeState.getCapState("lock-control") ?? COLD_START$16;
1741
1741
  },
@@ -1819,7 +1819,7 @@ var HaClimateDevice = class extends HaBaseChildDevice {
1819
1819
  this.swingHorizontalModes = readStringArray$4(state.attributes, "swing_horizontal_modes");
1820
1820
  const unit = readStringAttr$6(state.attributes, "temperature_unit");
1821
1821
  if (unit !== null) {
1822
- const probe = require_dist.ingestReading({
1822
+ const probe = require_ha_broker_source.ingestReading({
1823
1823
  value: 0,
1824
1824
  rawUnit: unit,
1825
1825
  quantity: "temperature"
@@ -1836,7 +1836,7 @@ var HaClimateDevice = class extends HaBaseChildDevice {
1836
1836
  this.runtimeState.setCapState("climate-control", climateSliceFromState(state));
1837
1837
  }
1838
1838
  registerClimateCap() {
1839
- this.ctx.registerNativeCap(require_dist.climateControlCapability, {
1839
+ this.ctx.registerNativeCap(require_ha_broker_source.climateControlCapability, {
1840
1840
  getStatus: async () => {
1841
1841
  return this.runtimeState.getCapState("climate-control") ?? COLD_START$15;
1842
1842
  },
@@ -1894,7 +1894,7 @@ function climateSliceFromState(state) {
1894
1894
  const tempUnit = readStringAttr$6(attrs, "temperature_unit") ?? void 0;
1895
1895
  const celsius = (raw) => {
1896
1896
  if (raw === null) return null;
1897
- const result = require_dist.ingestReading({
1897
+ const result = require_ha_broker_source.ingestReading({
1898
1898
  value: raw,
1899
1899
  rawUnit: tempUnit,
1900
1900
  quantity: "temperature"
@@ -2043,7 +2043,7 @@ var HaHumidifierDevice = class extends HaBaseChildDevice {
2043
2043
  });
2044
2044
  }
2045
2045
  registerHumidifierCap() {
2046
- this.ctx.registerNativeCap(require_dist.humidifierCapability, {
2046
+ this.ctx.registerNativeCap(require_ha_broker_source.humidifierCapability, {
2047
2047
  getStatus: async () => {
2048
2048
  return this.runtimeState.getCapState("humidifier") ?? COLD_START$14;
2049
2049
  },
@@ -2123,7 +2123,7 @@ var HaWaterHeaterDevice = class extends HaBaseChildDevice {
2123
2123
  });
2124
2124
  }
2125
2125
  registerWaterHeaterCap() {
2126
- this.ctx.registerNativeCap(require_dist.waterHeaterCapability, {
2126
+ this.ctx.registerNativeCap(require_ha_broker_source.waterHeaterCapability, {
2127
2127
  getStatus: async () => {
2128
2128
  return this.runtimeState.getCapState("water-heater") ?? COLD_START$13;
2129
2129
  },
@@ -2206,7 +2206,7 @@ var HaFanDevice = class extends HaBaseChildDevice {
2206
2206
  this.runtimeState.setCapState("fan-control", slice);
2207
2207
  }
2208
2208
  registerSwitchCap() {
2209
- this.ctx.registerNativeCap(require_dist.switchCapability, {
2209
+ this.ctx.registerNativeCap(require_ha_broker_source.switchCapability, {
2210
2210
  getStatus: async () => {
2211
2211
  return this.runtimeState.getCapState("switch") ?? {
2212
2212
  on: false,
@@ -2219,7 +2219,7 @@ var HaFanDevice = class extends HaBaseChildDevice {
2219
2219
  });
2220
2220
  }
2221
2221
  registerFanCap() {
2222
- this.ctx.registerNativeCap(require_dist.fanControlCapability, {
2222
+ this.ctx.registerNativeCap(require_ha_broker_source.fanControlCapability, {
2223
2223
  getStatus: async () => {
2224
2224
  return this.runtimeState.getCapState("fan-control") ?? FAN_COLD_START;
2225
2225
  },
@@ -2287,7 +2287,7 @@ var HaVacuumDevice = class extends HaBaseChildDevice {
2287
2287
  this.registerVacuumCap();
2288
2288
  this.registerRunningCap();
2289
2289
  this.runtimeState.setCapState("vacuum-control", COLD_START$12);
2290
- this.runtimeState.setCapState("running-state", require_dist.RUNNING_STATE_COLD);
2290
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.RUNNING_STATE_COLD);
2291
2291
  }
2292
2292
  handleStatePush(state) {
2293
2293
  if (state.state === "unavailable" || state.state === "unknown") return;
@@ -2309,13 +2309,13 @@ var HaVacuumDevice = class extends HaBaseChildDevice {
2309
2309
  });
2310
2310
  const fetchedAt = Date.now();
2311
2311
  const previous = this.runtimeState.getCapState("running-state");
2312
- this.runtimeState.setCapState("running-state", require_dist.runningFromVacuumState(lifecycleState, previous, fetchedAt, lastChangedAt));
2312
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.runningFromVacuumState(lifecycleState, previous, fetchedAt, lastChangedAt));
2313
2313
  }
2314
2314
  registerRunningCap() {
2315
- this.ctx.registerNativeCap(require_dist.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_dist.RUNNING_STATE_COLD });
2315
+ this.ctx.registerNativeCap(require_ha_broker_source.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_ha_broker_source.RUNNING_STATE_COLD });
2316
2316
  }
2317
2317
  registerVacuumCap() {
2318
- this.ctx.registerNativeCap(require_dist.vacuumControlCapability, {
2318
+ this.ctx.registerNativeCap(require_ha_broker_source.vacuumControlCapability, {
2319
2319
  getStatus: async () => {
2320
2320
  return this.runtimeState.getCapState("vacuum-control") ?? COLD_START$12;
2321
2321
  },
@@ -2387,7 +2387,7 @@ var HaLawnMowerDevice = class extends HaBaseChildDevice {
2387
2387
  this.registerLawnMowerCap();
2388
2388
  this.registerRunningCap();
2389
2389
  this.runtimeState.setCapState("lawn-mower-control", COLD_START$11);
2390
- this.runtimeState.setCapState("running-state", require_dist.RUNNING_STATE_COLD);
2390
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.RUNNING_STATE_COLD);
2391
2391
  }
2392
2392
  handleStatePush(state) {
2393
2393
  if (state.state === "unavailable" || state.state === "unknown") return;
@@ -2405,13 +2405,13 @@ var HaLawnMowerDevice = class extends HaBaseChildDevice {
2405
2405
  });
2406
2406
  const fetchedAt = Date.now();
2407
2407
  const previous = this.runtimeState.getCapState("running-state");
2408
- this.runtimeState.setCapState("running-state", require_dist.runningFromLawnMower(activity, previous, fetchedAt, lastChangedAt));
2408
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.runningFromLawnMower(activity, previous, fetchedAt, lastChangedAt));
2409
2409
  }
2410
2410
  registerRunningCap() {
2411
- this.ctx.registerNativeCap(require_dist.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_dist.RUNNING_STATE_COLD });
2411
+ this.ctx.registerNativeCap(require_ha_broker_source.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_ha_broker_source.RUNNING_STATE_COLD });
2412
2412
  }
2413
2413
  registerLawnMowerCap() {
2414
- this.ctx.registerNativeCap(require_dist.lawnMowerControlCapability, {
2414
+ this.ctx.registerNativeCap(require_ha_broker_source.lawnMowerControlCapability, {
2415
2415
  getStatus: async () => {
2416
2416
  return this.runtimeState.getCapState("lawn-mower-control") ?? COLD_START$11;
2417
2417
  },
@@ -2467,7 +2467,7 @@ var HaMediaPlayerDevice = class extends HaBaseChildDevice {
2467
2467
  this.registerMediaPlayerCap();
2468
2468
  this.registerRunningCap();
2469
2469
  this.runtimeState.setCapState("media-player", COLD_START$10);
2470
- this.runtimeState.setCapState("running-state", require_dist.RUNNING_STATE_COLD);
2470
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.RUNNING_STATE_COLD);
2471
2471
  }
2472
2472
  handleStatePush(state) {
2473
2473
  if (state.state === "unavailable" || state.state === "unknown") return;
@@ -2492,13 +2492,13 @@ var HaMediaPlayerDevice = class extends HaBaseChildDevice {
2492
2492
  this.runtimeState.setCapState("media-player", slice);
2493
2493
  const fetchedAt = Date.now();
2494
2494
  const previous = this.runtimeState.getCapState("running-state");
2495
- this.runtimeState.setCapState("running-state", require_dist.runningFromMediaPlayer(playerState, previous, fetchedAt, lastChangedAt));
2495
+ this.runtimeState.setCapState("running-state", require_ha_broker_source.runningFromMediaPlayer(playerState, previous, fetchedAt, lastChangedAt));
2496
2496
  }
2497
2497
  registerRunningCap() {
2498
- this.ctx.registerNativeCap(require_dist.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_dist.RUNNING_STATE_COLD });
2498
+ this.ctx.registerNativeCap(require_ha_broker_source.runningStateCapability, { getStatus: async () => this.runtimeState.getCapState("running-state") ?? require_ha_broker_source.RUNNING_STATE_COLD });
2499
2499
  }
2500
2500
  registerMediaPlayerCap() {
2501
- this.ctx.registerNativeCap(require_dist.mediaPlayerCapability, {
2501
+ this.ctx.registerNativeCap(require_ha_broker_source.mediaPlayerCapability, {
2502
2502
  getStatus: async () => {
2503
2503
  return this.runtimeState.getCapState("media-player") ?? COLD_START$10;
2504
2504
  },
@@ -2630,7 +2630,7 @@ var HaAlarmPanelDevice = class extends HaBaseChildDevice {
2630
2630
  });
2631
2631
  }
2632
2632
  registerAlarmCap() {
2633
- this.ctx.registerNativeCap(require_dist.alarmPanelCapability, {
2633
+ this.ctx.registerNativeCap(require_ha_broker_source.alarmPanelCapability, {
2634
2634
  getStatus: async () => {
2635
2635
  return this.runtimeState.getCapState("alarm-panel") ?? COLD_START$9;
2636
2636
  },
@@ -2745,7 +2745,7 @@ var HaPresenceDevice = class extends HaBaseChildDevice {
2745
2745
  });
2746
2746
  }
2747
2747
  registerBatteryCap() {
2748
- this.ctx.registerNativeCap(require_dist.batteryCapability, {
2748
+ this.ctx.registerNativeCap(require_ha_broker_source.batteryCapability, {
2749
2749
  getStatus: async () => this.runtimeState.getCapState("battery") ?? COLD_BATTERY,
2750
2750
  wakeForStream: async () => ({
2751
2751
  awoke: true,
@@ -2754,7 +2754,7 @@ var HaPresenceDevice = class extends HaBaseChildDevice {
2754
2754
  });
2755
2755
  }
2756
2756
  registerPresenceCap() {
2757
- this.ctx.registerNativeCap(require_dist.presenceCapability, { getStatus: async () => {
2757
+ this.ctx.registerNativeCap(require_ha_broker_source.presenceCapability, { getStatus: async () => {
2758
2758
  return this.runtimeState.getCapState("presence") ?? COLD_START$8;
2759
2759
  } });
2760
2760
  }
@@ -2822,7 +2822,7 @@ var HaControlDevice = class extends HaBaseChildDevice {
2822
2822
  if (slice !== null) this.runtimeState.setCapState("control", slice);
2823
2823
  }
2824
2824
  registerControlCap() {
2825
- this.ctx.registerNativeCap(require_dist.controlCapability, {
2825
+ this.ctx.registerNativeCap(require_ha_broker_source.controlCapability, {
2826
2826
  getStatus: async () => {
2827
2827
  return this.runtimeState.getCapState("control") ?? {
2828
2828
  kind: this.kind,
@@ -2861,10 +2861,10 @@ var HaControlDevice = class extends HaBaseChildDevice {
2861
2861
  /** Base-unit value → the unit the upstream entity still speaks. */
2862
2862
  toUpstream(value) {
2863
2863
  const quantity = this.sourceInfo.quantity;
2864
- const base = quantity === void 0 ? void 0 : require_dist.baseUnitOf(quantity);
2864
+ const base = quantity === void 0 ? void 0 : require_ha_broker_source.baseUnitOf(quantity);
2865
2865
  const upstream = this.upstreamUnit;
2866
2866
  if (base === void 0 || upstream === void 0 || upstream === base) return value;
2867
- const converted = require_dist.tryConvertUnit(value, base, upstream);
2867
+ const converted = require_ha_broker_source.tryConvertUnit(value, base, upstream);
2868
2868
  if (converted !== void 0) return converted;
2869
2869
  this.deviceLogger.warn("numeric reading refused", {
2870
2870
  tags: { deviceId: this.id },
@@ -2965,7 +2965,7 @@ function decodeNumeric(state, lastChangedAt, decode) {
2965
2965
  if (!Number.isFinite(v)) return null;
2966
2966
  const rawUnit = state.attributes["unit_of_measurement"];
2967
2967
  const unit = typeof rawUnit === "string" && rawUnit.length > 0 ? rawUnit : void 0;
2968
- const incoming = unit === void 0 ? void 0 : require_dist.quantityFromUnit(unit);
2968
+ const incoming = unit === void 0 ? void 0 : require_ha_broker_source.quantityFromUnit(unit);
2969
2969
  if (unit !== void 0 && (incoming === void 0 || incoming === "device")) {
2970
2970
  decode.logger.warn("numeric reading refused", {
2971
2971
  tags: { deviceId: decode.deviceId },
@@ -2992,7 +2992,7 @@ function decodeNumeric(state, lastChangedAt, decode) {
2992
2992
  }
2993
2993
  const value = takeReading(decode.logger, decode.deviceId, v, unit, quantity);
2994
2994
  if (value === null) return null;
2995
- decode.note(quantity, unit === void 0 ? void 0 : require_dist.normalizeUnit(unit));
2995
+ decode.note(quantity, unit === void 0 ? void 0 : require_ha_broker_source.normalizeUnit(unit));
2996
2996
  const rawMin = state.attributes["min"];
2997
2997
  const rawMax = state.attributes["max"];
2998
2998
  const rawStep = state.attributes["step"];
@@ -3012,10 +3012,10 @@ function decodeNumeric(state, lastChangedAt, decode) {
3012
3012
  /** A step is a difference: °F's offset must not move it. */
3013
3013
  function convertStep(step, unit, quantity) {
3014
3014
  if (step === void 0) return void 0;
3015
- const base = require_dist.baseUnitOf(quantity);
3016
- const from = unit === void 0 ? void 0 : require_dist.normalizeUnit(unit);
3015
+ const base = require_ha_broker_source.baseUnitOf(quantity);
3016
+ const from = unit === void 0 ? void 0 : require_ha_broker_source.normalizeUnit(unit);
3017
3017
  if (base === void 0 || from === void 0 || from === base) return step;
3018
- return require_dist.tryConvertDelta(step, from, base);
3018
+ return require_ha_broker_source.tryConvertDelta(step, from, base);
3019
3019
  }
3020
3020
  //#endregion
3021
3021
  //#region src/devices/ha-script-device.ts
@@ -3058,7 +3058,7 @@ var HaScriptDevice = class extends HaBaseChildDevice {
3058
3058
  });
3059
3059
  }
3060
3060
  registerScriptCap() {
3061
- this.ctx.registerNativeCap(require_dist.scriptRunnerCapability, {
3061
+ this.ctx.registerNativeCap(require_ha_broker_source.scriptRunnerCapability, {
3062
3062
  getStatus: async () => {
3063
3063
  return this.runtimeState.getCapState("script-runner") ?? COLD_START$7;
3064
3064
  },
@@ -3117,7 +3117,7 @@ var HaAutomationDevice = class extends HaBaseChildDevice {
3117
3117
  });
3118
3118
  }
3119
3119
  registerAutomationCap() {
3120
- this.ctx.registerNativeCap(require_dist.automationControlCapability, {
3120
+ this.ctx.registerNativeCap(require_ha_broker_source.automationControlCapability, {
3121
3121
  getStatus: async () => {
3122
3122
  return this.runtimeState.getCapState("automation-control") ?? COLD_START$6;
3123
3123
  },
@@ -3176,7 +3176,7 @@ var HaNotifierDevice = class extends HaBaseChildDevice {
3176
3176
  handleStatePush(_state) {}
3177
3177
  registerNotifierCap() {
3178
3178
  const serviceName = this.entityId.split(".")[1] ?? "";
3179
- this.ctx.registerNativeCap(require_dist.notifierCapability, {
3179
+ this.ctx.registerNativeCap(require_ha_broker_source.notifierCapability, {
3180
3180
  getStatus: async () => {
3181
3181
  return this.runtimeState.getCapState("notifier") ?? COLD_START$5;
3182
3182
  },
@@ -3272,7 +3272,7 @@ var HaPowerMeterDevice = class extends HaBaseChildDevice {
3272
3272
  if (update !== null) this.runtimeState.setCapState("power-meter", update);
3273
3273
  }
3274
3274
  registerPowerMeterCap() {
3275
- this.ctx.registerNativeCap(require_dist.powerMeterCapability, { getStatus: async () => {
3275
+ this.ctx.registerNativeCap(require_ha_broker_source.powerMeterCapability, { getStatus: async () => {
3276
3276
  return this.runtimeState.getCapState("power-meter") ?? COLD_START$4;
3277
3277
  } });
3278
3278
  }
@@ -3351,7 +3351,7 @@ var HaAirQualityDevice = class extends HaBaseChildDevice {
3351
3351
  if (update !== null) this.runtimeState.setCapState("air-quality-sensor", update);
3352
3352
  }
3353
3353
  registerCap() {
3354
- this.ctx.registerNativeCap(require_dist.airQualitySensorCapability, { getStatus: async () => {
3354
+ this.ctx.registerNativeCap(require_ha_broker_source.airQualitySensorCapability, { getStatus: async () => {
3355
3355
  return this.runtimeState.getCapState("air-quality-sensor") ?? COLD_START$3;
3356
3356
  } });
3357
3357
  }
@@ -3426,7 +3426,7 @@ var HaEnumSensorDevice = class extends HaBaseChildDevice {
3426
3426
  constructor(ctx) {
3427
3427
  const persisted = ctx.persistedConfig ?? {};
3428
3428
  super(ctx, persisted.role !== void 0 ? { role: persisted.role } : {});
3429
- const parsedFormat = require_dist.EnumSensorDateTimeFormatSchema.safeParse(persisted.dateTimeFormat);
3429
+ const parsedFormat = require_ha_broker_source.EnumSensorDateTimeFormatSchema.safeParse(persisted.dateTimeFormat);
3430
3430
  this.dateTimeFormat = parsedFormat.success ? parsedFormat.data : void 0;
3431
3431
  if (this.dateTimeFormat !== void 0) this.updateSourceInfo({ dateTimeShape: this.dateTimeFormat });
3432
3432
  this.registerCap();
@@ -3448,7 +3448,7 @@ var HaEnumSensorDevice = class extends HaBaseChildDevice {
3448
3448
  });
3449
3449
  }
3450
3450
  registerCap() {
3451
- this.ctx.registerNativeCap(require_dist.enumSensorCapability, { getStatus: async () => {
3451
+ this.ctx.registerNativeCap(require_ha_broker_source.enumSensorCapability, { getStatus: async () => {
3452
3452
  return this.runtimeState.getCapState("enum-sensor") ?? this.coldStart();
3453
3453
  } });
3454
3454
  }
@@ -3547,7 +3547,7 @@ var HaEventEmitterDevice = class extends HaBaseChildDevice {
3547
3547
  timestamp: Date.now(),
3548
3548
  seq: ++this.#seq
3549
3549
  };
3550
- this.ctx.eventBus.emit(require_dist.createEvent(require_dist.EventCategory.EventEmitted, {
3550
+ this.ctx.eventBus.emit(require_ha_broker_source.createEvent(require_ha_broker_source.EventCategory.EventEmitted, {
3551
3551
  type: "device",
3552
3552
  id: this.stableId,
3553
3553
  deviceId: this.id,
@@ -3561,7 +3561,7 @@ var HaEventEmitterDevice = class extends HaBaseChildDevice {
3561
3561
  this.runtimeState.setCapState("event-emitter", slice);
3562
3562
  }
3563
3563
  registerEventEmitterCap() {
3564
- this.ctx.registerNativeCap(require_dist.eventEmitterCapability, { getStatus: async () => this.readSlice() });
3564
+ this.ctx.registerNativeCap(require_ha_broker_source.eventEmitterCapability, { getStatus: async () => this.readSlice() });
3565
3565
  }
3566
3566
  readSlice() {
3567
3567
  return this.runtimeState.getCapState("event-emitter") ?? {
@@ -3644,7 +3644,7 @@ var HaWeatherDevice = class extends HaBaseChildDevice {
3644
3644
  this.runtimeState.setCapState("weather", slice);
3645
3645
  }
3646
3646
  registerWeatherCap() {
3647
- this.ctx.registerNativeCap(require_dist.weatherCapability, { getStatus: async () => {
3647
+ this.ctx.registerNativeCap(require_ha_broker_source.weatherCapability, { getStatus: async () => {
3648
3648
  return this.runtimeState.getCapState("weather") ?? COLD_START$1;
3649
3649
  } });
3650
3650
  }
@@ -3742,7 +3742,7 @@ var HaImageDevice = class extends HaBaseChildDevice {
3742
3742
  this.deviceLogger.warn("ha-image: failed to build absolute image url", { meta: {
3743
3743
  entityId: this.entityId,
3744
3744
  brokerId: this.brokerId,
3745
- error: require_dist.errMsg(err)
3745
+ error: require_ha_broker_source.errMsg(err)
3746
3746
  } });
3747
3747
  url = null;
3748
3748
  }
@@ -3774,7 +3774,7 @@ var HaImageDevice = class extends HaBaseChildDevice {
3774
3774
  return typeof raw === "string" && raw.length > 0 ? raw : null;
3775
3775
  }
3776
3776
  registerImageCap() {
3777
- this.ctx.registerNativeCap(require_dist.imageCapability, { getStatus: async () => {
3777
+ this.ctx.registerNativeCap(require_ha_broker_source.imageCapability, { getStatus: async () => {
3778
3778
  return this.runtimeState.getCapState("image") ?? COLD_START;
3779
3779
  } });
3780
3780
  }
@@ -3868,28 +3868,28 @@ function pickHaChildClass(capabilities) {
3868
3868
  //#region src/ha-container-reconcile.ts
3869
3869
  /** Validates a persisted Container `entities[]` blob (mirrors `haEntitySchema`
3870
3870
  * in ha-container-device.ts). Returns `[]` on absent/invalid input. */
3871
- var containerEntitySchema = require_dist.object({
3872
- entityId: require_dist.string(),
3873
- deviceType: require_dist._enum(require_dist.DeviceType),
3874
- capabilities: require_dist.array(require_dist.string()),
3875
- role: require_dist.string().optional(),
3876
- unitOfMeasurement: require_dist.string().optional(),
3877
- deviceClass: require_dist.string().optional(),
3878
- options: require_dist.array(require_dist.string()).optional(),
3879
- features: require_dist.array(require_dist.string()).optional(),
3880
- name: require_dist.string().optional(),
3881
- dateTimeFormat: require_dist.EnumSensorDateTimeFormatSchema.optional(),
3882
- entityCategory: require_dist._enum(["config", "diagnostic"]).optional(),
3883
- meterEntities: require_dist.object({
3884
- power: require_dist.string().optional(),
3885
- energy: require_dist.string().optional(),
3886
- voltage: require_dist.string().optional(),
3887
- current: require_dist.string().optional()
3871
+ var containerEntitySchema = require_ha_broker_source.object({
3872
+ entityId: require_ha_broker_source.string(),
3873
+ deviceType: require_ha_broker_source._enum(require_ha_broker_source.DeviceType),
3874
+ capabilities: require_ha_broker_source.array(require_ha_broker_source.string()),
3875
+ role: require_ha_broker_source.string().optional(),
3876
+ unitOfMeasurement: require_ha_broker_source.string().optional(),
3877
+ deviceClass: require_ha_broker_source.string().optional(),
3878
+ options: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
3879
+ features: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
3880
+ name: require_ha_broker_source.string().optional(),
3881
+ dateTimeFormat: require_ha_broker_source.EnumSensorDateTimeFormatSchema.optional(),
3882
+ entityCategory: require_ha_broker_source._enum(["config", "diagnostic"]).optional(),
3883
+ meterEntities: require_ha_broker_source.object({
3884
+ power: require_ha_broker_source.string().optional(),
3885
+ energy: require_ha_broker_source.string().optional(),
3886
+ voltage: require_ha_broker_source.string().optional(),
3887
+ current: require_ha_broker_source.string().optional()
3888
3888
  }).optional(),
3889
- foldedInto: require_dist.string().optional()
3889
+ foldedInto: require_ha_broker_source.string().optional()
3890
3890
  });
3891
3891
  function parseContainerEntities(raw) {
3892
- const result = require_dist.array(containerEntitySchema).safeParse(raw);
3892
+ const result = require_ha_broker_source.array(containerEntitySchema).safeParse(raw);
3893
3893
  return result.success ? result.data : [];
3894
3894
  }
3895
3895
  /**
@@ -4043,45 +4043,45 @@ function deriveChildLayout(entities) {
4043
4043
  }
4044
4044
  //#endregion
4045
4045
  //#region src/devices/ha-container-device.ts
4046
- var haEntitySchema = require_dist.object({
4047
- entityId: require_dist.string(),
4048
- deviceType: require_dist._enum(require_dist.DeviceType),
4049
- capabilities: require_dist.array(require_dist.string()),
4050
- role: require_dist.string().optional(),
4051
- unitOfMeasurement: require_dist.string().optional(),
4052
- deviceClass: require_dist.string().optional(),
4046
+ var haEntitySchema = require_ha_broker_source.object({
4047
+ entityId: require_ha_broker_source.string(),
4048
+ deviceType: require_ha_broker_source._enum(require_ha_broker_source.DeviceType),
4049
+ capabilities: require_ha_broker_source.array(require_ha_broker_source.string()),
4050
+ role: require_ha_broker_source.string().optional(),
4051
+ unitOfMeasurement: require_ha_broker_source.string().optional(),
4052
+ deviceClass: require_ha_broker_source.string().optional(),
4053
4053
  /** HA `options` attribute — present on select / input_select entities.
4054
4054
  * Persisted at adoption so the control slice is seeded immediately. */
4055
- options: require_dist.array(require_dist.string()).optional(),
4055
+ options: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
4056
4056
  /** Mapping-derived DeviceFeature flags (e.g. `lock-open`) — surfaced on the
4057
4057
  * child's `device.features` so the UI gates feature affordances. */
4058
- features: require_dist.array(require_dist.string()).optional(),
4058
+ features: require_ha_broker_source.array(require_ha_broker_source.string()).optional(),
4059
4059
  /** HA friendly_name — persisted so the child device name survives
4060
4060
  * a reboot without a discovery round-trip. Falls back to entityId. */
4061
- name: require_dist.string().optional(),
4061
+ name: require_ha_broker_source.string().optional(),
4062
4062
  /** Locale-render shape for a `DateTimeSensor`-role enum sensor
4063
4063
  * (`device_class=timestamp` → `'datetime'`, `date` → `'date'`). Seeded into
4064
4064
  * the enum-sensor cap slice by the child so the UI renders the ISO `value`. */
4065
- dateTimeFormat: require_dist.EnumSensorDateTimeFormatSchema.optional(),
4065
+ dateTimeFormat: require_ha_broker_source.EnumSensorDateTimeFormatSchema.optional(),
4066
4066
  /** HA `entity_category` — `config` / `diagnostic` / absent (a normal
4067
4067
  * control). Drives the accordion section the child renders in. */
4068
- entityCategory: require_dist._enum(["config", "diagnostic"]).optional(),
4068
+ entityCategory: require_ha_broker_source._enum(["config", "diagnostic"]).optional(),
4069
4069
  /** Sibling meter sensors this entity reads as its own power-meter (D951). */
4070
- meterEntities: require_dist.object({
4071
- power: require_dist.string().optional(),
4072
- energy: require_dist.string().optional(),
4073
- voltage: require_dist.string().optional(),
4074
- current: require_dist.string().optional()
4070
+ meterEntities: require_ha_broker_source.object({
4071
+ power: require_ha_broker_source.string().optional(),
4072
+ energy: require_ha_broker_source.string().optional(),
4073
+ voltage: require_ha_broker_source.string().optional(),
4074
+ current: require_ha_broker_source.string().optional()
4075
4075
  }).optional(),
4076
4076
  /** Set on a meter sensor folded into another entity: sectioned as Diagnostic. */
4077
- foldedInto: require_dist.string().optional()
4077
+ foldedInto: require_ha_broker_source.string().optional()
4078
4078
  });
4079
- var haContainerSchema = require_dist.object({
4080
- system: require_dist.literal("homeassistant"),
4081
- brokerId: require_dist.string(),
4082
- haDeviceId: require_dist.string(),
4083
- integrationId: require_dist.string().optional(),
4084
- entities: require_dist.array(haEntitySchema).default([])
4079
+ var haContainerSchema = require_ha_broker_source.object({
4080
+ system: require_ha_broker_source.literal("homeassistant"),
4081
+ brokerId: require_ha_broker_source.string(),
4082
+ haDeviceId: require_ha_broker_source.string(),
4083
+ integrationId: require_ha_broker_source.string().optional(),
4084
+ entities: require_ha_broker_source.array(haEntitySchema).default([])
4085
4085
  });
4086
4086
  /**
4087
4087
  * A container entity is a battery source when the HA domain mapping
@@ -4091,7 +4091,7 @@ var haContainerSchema = require_dist.object({
4091
4091
  * device_class is the original HA attribute that drove it.
4092
4092
  */
4093
4093
  function isBatteryEntity(entity) {
4094
- return entity.role === require_dist.DeviceRole.BatterySensor || entity.deviceClass === "battery";
4094
+ return entity.role === require_ha_broker_source.DeviceRole.BatterySensor || entity.deviceClass === "battery";
4095
4095
  }
4096
4096
  /**
4097
4097
  * A battery entity is BINARY when HA exposes it as a `binary_sensor`
@@ -4183,7 +4183,7 @@ function batteryEntityId(entities) {
4183
4183
  * persist initial config, build context, construct via factory, then
4184
4184
  * run the child's own probe + accessory + activate phases.
4185
4185
  */
4186
- var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice {
4186
+ var HaContainerDevice = class HaContainerDevice extends require_ha_broker_source.BaseDevice {
4187
4187
  features;
4188
4188
  brokerId;
4189
4189
  integrationId;
@@ -4204,10 +4204,10 @@ var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice
4204
4204
  constructor(ctx) {
4205
4205
  const cfg = haContainerSchema.parse(ctx.persistedConfig ?? {});
4206
4206
  const batteryEntity = selectBatteryEntity(cfg.entities);
4207
- super(ctx, haContainerSchema, { type: require_dist.DeviceType.Container });
4207
+ super(ctx, haContainerSchema, { type: require_ha_broker_source.DeviceType.Container });
4208
4208
  this.brokerId = cfg.brokerId;
4209
4209
  this.integrationId = cfg.integrationId;
4210
- this.features = batteryEntity !== null ? [require_dist.DeviceFeature.Resyncable, require_dist.DeviceFeature.BatteryOperated] : [require_dist.DeviceFeature.Resyncable];
4210
+ this.features = batteryEntity !== null ? [require_ha_broker_source.DeviceFeature.Resyncable, require_ha_broker_source.DeviceFeature.BatteryOperated] : [require_ha_broker_source.DeviceFeature.Resyncable];
4211
4211
  this.entityIds = new Set(cfg.entities.map((e) => e.entityId));
4212
4212
  this.online = false;
4213
4213
  this.batteryEntityId = batteryEntityId(cfg.entities);
@@ -4218,7 +4218,7 @@ var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice
4218
4218
  sleeping: false,
4219
4219
  lastUpdated: 0
4220
4220
  };
4221
- this.ctx.registerNativeCap(require_dist.batteryCapability, {
4221
+ this.ctx.registerNativeCap(require_ha_broker_source.batteryCapability, {
4222
4222
  getStatus: async () => this.runtimeState.getCapState("battery") ?? COLD,
4223
4223
  wakeForStream: async () => ({
4224
4224
  awoke: true,
@@ -4293,7 +4293,7 @@ var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice
4293
4293
  } catch (err) {
4294
4294
  this.ctx.logger.warn("ha-container failed to subscribe entities for availability", { meta: {
4295
4295
  brokerId: this.brokerId,
4296
- error: require_dist.errMsg(err)
4296
+ error: require_ha_broker_source.errMsg(err)
4297
4297
  } });
4298
4298
  }
4299
4299
  }
@@ -4334,7 +4334,7 @@ var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice
4334
4334
  } catch (err) {
4335
4335
  this.ctx.logger.warn("ha-container failed to persist childLayout", { meta: {
4336
4336
  haDeviceId: this.config.values.haDeviceId,
4337
- error: require_dist.errMsg(err)
4337
+ error: require_ha_broker_source.errMsg(err)
4338
4338
  } });
4339
4339
  }
4340
4340
  }
@@ -4413,10 +4413,10 @@ var HaContainerDevice = class HaContainerDevice extends require_dist.BaseDevice
4413
4413
  * entity-backed (no `entityId`), so it does NOT extend the HA child base
4414
4414
  * device — it is a thin standalone `BaseDevice` subclass.
4415
4415
  */
4416
- var haEventBusDeviceSchema = require_dist.object({
4417
- system: require_dist.literal("homeassistant"),
4418
- brokerId: require_dist.string(),
4419
- kind: require_dist.literal("event-bus")
4416
+ var haEventBusDeviceSchema = require_ha_broker_source.object({
4417
+ system: require_ha_broker_source.literal("homeassistant"),
4418
+ brokerId: require_ha_broker_source.string(),
4419
+ kind: require_ha_broker_source.literal("event-bus")
4420
4420
  });
4421
4421
  /**
4422
4422
  * Case 2 — generic per-broker HA bus-event aggregator.
@@ -4437,7 +4437,7 @@ var haEventBusDeviceSchema = require_dist.object({
4437
4437
  * directly via {@link handleBusEvent} (the integration manager subscribes
4438
4438
  * to the curated bus event types and threads each fire through the addon).
4439
4439
  */
4440
- var HaEventBusDevice = class extends require_dist.BaseDevice {
4440
+ var HaEventBusDevice = class extends require_ha_broker_source.BaseDevice {
4441
4441
  features = [];
4442
4442
  /** Monotonic sequence — two identical events still produce distinct slice
4443
4443
  * writes / bus emissions. */
@@ -4476,7 +4476,7 @@ var HaEventBusDevice = class extends require_dist.BaseDevice {
4476
4476
  timestamp: Date.now(),
4477
4477
  seq: ++this.#seq
4478
4478
  };
4479
- this.ctx.eventBus.emit(require_dist.createEvent(require_dist.EventCategory.EventEmitted, {
4479
+ this.ctx.eventBus.emit(require_ha_broker_source.createEvent(require_ha_broker_source.EventCategory.EventEmitted, {
4480
4480
  type: "device",
4481
4481
  id: this.stableId,
4482
4482
  deviceId: this.id,
@@ -4490,7 +4490,7 @@ var HaEventBusDevice = class extends require_dist.BaseDevice {
4490
4490
  this.runtimeState.setCapState("event-emitter", slice);
4491
4491
  }
4492
4492
  registerEventEmitterCap() {
4493
- this.ctx.registerNativeCap(require_dist.eventEmitterCapability, { getStatus: async () => this.readSlice() });
4493
+ this.ctx.registerNativeCap(require_ha_broker_source.eventEmitterCapability, { getStatus: async () => this.readSlice() });
4494
4494
  }
4495
4495
  readSlice() {
4496
4496
  return this.runtimeState.getCapState("event-emitter") ?? {
@@ -4525,7 +4525,7 @@ async function cascadeRemoveDevicesForBroker(input) {
4525
4525
  tags: { deviceId: d.id },
4526
4526
  meta: {
4527
4527
  brokerId,
4528
- error: require_dist.errMsg(err)
4528
+ error: require_ha_broker_source.errMsg(err)
4529
4529
  }
4530
4530
  });
4531
4531
  }
@@ -5354,8 +5354,10 @@ function subscribeEntities(opts) {
5354
5354
  * the same HA broker for overlapping entity sets. We keep ONE
5355
5355
  * upstream `subscribe_entities` to HA with the UNION of every
5356
5356
  * active subscription's entity ids, and fan inbound state changes
5357
- * out via `EventCategory.BrokerMessage` once per matching
5358
- * subscription.
5357
+ * out via `EventCategory.BrokerMessage` ONCE per change when at
5358
+ * least one subscription matches (the bus is shared and consumers
5359
+ * filter by `key`). A new subscriber's cache replay is the one
5360
+ * targeted emission: it carries that subscription's id.
5359
5361
  * - When the active union changes (subscribe / unsubscribe call),
5360
5362
  * we re-issue the upstream subscribe with the new set. HA accepts
5361
5363
  * this efficiently (server-side filter).
@@ -5367,6 +5369,10 @@ function subscribeEntities(opts) {
5367
5369
  * subscribe's initial `a` (add) frames.
5368
5370
  */
5369
5371
  var HA_KIND$1 = "home-assistant";
5372
+ /** `subscriptionId` of a `broker.message` that is not addressed to one
5373
+ * subscription (a live state change fanned out once). The payload type
5374
+ * requires the field; the empty string is the repo convention for "none". */
5375
+ var FANOUT_SUBSCRIPTION_ID = "";
5370
5376
  /**
5371
5377
  * Curated device-event allowlist for the per-broker bus-event aggregator
5372
5378
  * (Case 2). Home Assistant fires arbitrary events on its bus; subscribing
@@ -5425,7 +5431,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5425
5431
  } catch (err) {
5426
5432
  this.opts.logger.warn("ha-broker onConnected handler threw", { meta: {
5427
5433
  brokerId: this.opts.id,
5428
- error: require_dist.errMsg(err)
5434
+ error: require_ha_broker_source.errMsg(err)
5429
5435
  } });
5430
5436
  }
5431
5437
  },
@@ -5440,12 +5446,12 @@ var HaIntegrationManager = class HaIntegrationManager {
5440
5446
  } catch (err) {
5441
5447
  this.opts.logger.warn("ha-broker onDisconnected handler threw", { meta: {
5442
5448
  brokerId: this.opts.id,
5443
- error: require_dist.errMsg(err)
5449
+ error: require_ha_broker_source.errMsg(err)
5444
5450
  } });
5445
5451
  }
5446
5452
  },
5447
5453
  onReconnectError: (err, nextDelayMs) => {
5448
- this.lastError = require_dist.errMsg(err);
5454
+ this.lastError = require_ha_broker_source.errMsg(err);
5449
5455
  this.opts.logger.warn("ha-broker reconnect attempt failed", { meta: {
5450
5456
  brokerId: this.opts.id,
5451
5457
  error: this.lastError,
@@ -5622,7 +5628,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5622
5628
  this.opts.logger.warn("ha-broker bus-event subscribe failed", { meta: {
5623
5629
  brokerId: this.opts.id,
5624
5630
  eventType,
5625
- error: require_dist.errMsg(err)
5631
+ error: require_ha_broker_source.errMsg(err)
5626
5632
  } });
5627
5633
  }
5628
5634
  }
@@ -5645,7 +5651,10 @@ var HaIntegrationManager = class HaIntegrationManager {
5645
5651
  for (const entityId of changed) {
5646
5652
  const state = next[entityId] ?? null;
5647
5653
  if (state === null) continue;
5648
- for (const sub of this.subscriptions.values()) if (this.subscriptionMatches(sub, entityId)) this.emitBrokerMessage(sub.id, entityId, state);
5654
+ for (const sub of this.subscriptions.values()) if (this.subscriptionMatches(sub, entityId)) {
5655
+ this.emitBrokerMessage(FANOUT_SUBSCRIPTION_ID, entityId, state);
5656
+ break;
5657
+ }
5649
5658
  }
5650
5659
  }
5651
5660
  subscriptionMatches(sub, entityId) {
@@ -5655,7 +5664,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5655
5664
  return false;
5656
5665
  }
5657
5666
  emitBrokerMessage(subscriptionId, entityId, state) {
5658
- this.opts.eventBus.emit(require_dist.createEvent("broker.message", {
5667
+ this.opts.eventBus.emit(require_ha_broker_source.createEvent("broker.message", {
5659
5668
  type: "addon",
5660
5669
  id: this.opts.id
5661
5670
  }, {
@@ -5677,7 +5686,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5677
5686
  } catch (err) {
5678
5687
  this.opts.logger.debug("ha get_config probe failed", { meta: {
5679
5688
  brokerId: this.opts.id,
5680
- error: require_dist.errMsg(err)
5689
+ error: require_ha_broker_source.errMsg(err)
5681
5690
  } });
5682
5691
  }
5683
5692
  }
@@ -5685,7 +5694,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5685
5694
  if (this.status === next) return;
5686
5695
  this.status = next;
5687
5696
  this.lastCheckedAt = Date.now();
5688
- this.opts.eventBus.emit(require_dist.createEvent("broker.status-changed", {
5697
+ this.opts.eventBus.emit(require_ha_broker_source.createEvent("broker.status-changed", {
5689
5698
  type: "addon",
5690
5699
  id: this.opts.id
5691
5700
  }, {
@@ -5706,7 +5715,7 @@ var HaIntegrationManager = class HaIntegrationManager {
5706
5715
  this.lastError = "Home Assistant host / URL is required";
5707
5716
  this.setStatus("unreachable");
5708
5717
  } else {
5709
- this.lastError = require_dist.errMsg(err);
5718
+ this.lastError = require_ha_broker_source.errMsg(err);
5710
5719
  this.setStatus("error");
5711
5720
  }
5712
5721
  }
@@ -5727,17 +5736,17 @@ var TEST_HANDSHAKE_TIMEOUT_MS = 8e3;
5727
5736
  * `dataDir` being protected by filesystem permissions. (MQTT broker
5728
5737
  * encrypts at rest; HA broker does not yet — TODO for hardening.)
5729
5738
  */
5730
- var HaBrokerEntrySchema = require_dist.object({
5731
- id: require_dist.string(),
5732
- name: require_dist.string(),
5739
+ var HaBrokerEntrySchema = require_ha_broker_source.object({
5740
+ id: require_ha_broker_source.string(),
5741
+ name: require_ha_broker_source.string(),
5733
5742
  /** Either Supervisor (token from env) or long-lived (persisted). */
5734
- auth: require_dist.discriminatedUnion("kind", [require_dist.object({
5735
- kind: require_dist.literal("supervisor"),
5736
- supervisorToken: require_dist.string().meta({ secret: true })
5737
- }), require_dist.object({
5738
- kind: require_dist.literal("long-lived"),
5739
- baseUrl: require_dist.string(),
5740
- accessToken: require_dist.string().meta({ secret: true })
5743
+ auth: require_ha_broker_source.discriminatedUnion("kind", [require_ha_broker_source.object({
5744
+ kind: require_ha_broker_source.literal("supervisor"),
5745
+ supervisorToken: require_ha_broker_source.string().meta({ secret: true })
5746
+ }), require_ha_broker_source.object({
5747
+ kind: require_ha_broker_source.literal("long-lived"),
5748
+ baseUrl: require_ha_broker_source.string(),
5749
+ accessToken: require_ha_broker_source.string().meta({ secret: true })
5741
5750
  })]),
5742
5751
  /** Optional FK to the integration record that spawned this broker.
5743
5752
  * Populated when the wizard's "+ New Integration" flow created the
@@ -5745,7 +5754,7 @@ var HaBrokerEntrySchema = require_dist.object({
5745
5754
  * directly. Used by the integration listener to keep the broker
5746
5755
  * list in sync with the integrations table (cascade-delete on
5747
5756
  * integration removal). */
5748
- integrationId: require_dist.string().optional()
5757
+ integrationId: require_ha_broker_source.string().optional()
5749
5758
  });
5750
5759
  /**
5751
5760
  * Validates a `broker.add` `settings` payload for the HA kind. Accepts:
@@ -5754,10 +5763,10 @@ var HaBrokerEntrySchema = require_dist.object({
5754
5763
  * persisting allows the addon to keep working after the env var
5755
5764
  * rotates out of scope)
5756
5765
  */
5757
- var HaAddSettingsSchema = require_dist.union([require_dist.object({
5758
- baseUrl: require_dist.url(),
5759
- accessToken: require_dist.string().min(1).meta({ secret: true })
5760
- }), require_dist.object({ supervisorToken: require_dist.string().min(1).meta({ secret: true }) })]);
5766
+ var HaAddSettingsSchema = require_ha_broker_source.union([require_ha_broker_source.object({
5767
+ baseUrl: require_ha_broker_source.url(),
5768
+ accessToken: require_ha_broker_source.string().min(1).meta({ secret: true })
5769
+ }), require_ha_broker_source.object({ supervisorToken: require_ha_broker_source.string().min(1).meta({ secret: true }) })]);
5761
5770
  function settingsToAuth(settings) {
5762
5771
  const parsed = HaAddSettingsSchema.parse(settings);
5763
5772
  if ("supervisorToken" in parsed) return {
@@ -5838,7 +5847,7 @@ var HaBrokerRegistry = class {
5838
5847
  } catch (err) {
5839
5848
  this.logger.warn("ha-broker bootstrap failed", { meta: {
5840
5849
  brokerId: entry.id,
5841
- error: require_dist.errMsg(err)
5850
+ error: require_ha_broker_source.errMsg(err)
5842
5851
  } });
5843
5852
  }
5844
5853
  }));
@@ -5932,7 +5941,7 @@ var HaBrokerRegistry = class {
5932
5941
  } catch (err) {
5933
5942
  return {
5934
5943
  ok: false,
5935
- error: require_dist.errMsg(err)
5944
+ error: require_ha_broker_source.errMsg(err)
5936
5945
  };
5937
5946
  }
5938
5947
  const startedAt = Date.now();
@@ -5970,7 +5979,7 @@ var HaBrokerRegistry = class {
5970
5979
  client?.stop();
5971
5980
  resolve({
5972
5981
  ok: false,
5973
- error: require_dist.errMsg(err)
5982
+ error: require_ha_broker_source.errMsg(err)
5974
5983
  });
5975
5984
  }
5976
5985
  }
@@ -5982,7 +5991,7 @@ var HaBrokerRegistry = class {
5982
5991
  client?.stop();
5983
5992
  resolve({
5984
5993
  ok: false,
5985
- error: require_dist.errMsg(err)
5994
+ error: require_ha_broker_source.errMsg(err)
5986
5995
  });
5987
5996
  });
5988
5997
  });
@@ -6177,27 +6186,27 @@ function mapHaEntityToCamStack(input) {
6177
6186
  const { domain, deviceClass, attributes } = input;
6178
6187
  switch (domain) {
6179
6188
  case "switch": return {
6180
- deviceType: require_dist.DeviceType.Switch,
6181
- role: deviceClass === "outlet" ? require_dist.DeviceRole.Outlet : null,
6189
+ deviceType: require_ha_broker_source.DeviceType.Switch,
6190
+ role: deviceClass === "outlet" ? require_ha_broker_source.DeviceRole.Outlet : null,
6182
6191
  capabilities: ["switch"]
6183
6192
  };
6184
6193
  case "input_boolean": return {
6185
- deviceType: require_dist.DeviceType.Switch,
6186
- role: require_dist.DeviceRole.BinaryHelper,
6194
+ deviceType: require_ha_broker_source.DeviceType.Switch,
6195
+ role: require_ha_broker_source.DeviceRole.BinaryHelper,
6187
6196
  capabilities: ["switch"]
6188
6197
  };
6189
6198
  case "remote": return {
6190
- deviceType: require_dist.DeviceType.Switch,
6199
+ deviceType: require_ha_broker_source.DeviceType.Switch,
6191
6200
  role: null,
6192
6201
  capabilities: ["switch"]
6193
6202
  };
6194
6203
  case "siren": return {
6195
- deviceType: require_dist.DeviceType.Siren,
6204
+ deviceType: require_ha_broker_source.DeviceType.Siren,
6196
6205
  role: null,
6197
6206
  capabilities: ["switch"]
6198
6207
  };
6199
6208
  case "update": return {
6200
- deviceType: require_dist.DeviceType.Update,
6209
+ deviceType: require_ha_broker_source.DeviceType.Update,
6201
6210
  role: null,
6202
6211
  capabilities: ["update"]
6203
6212
  };
@@ -6215,7 +6224,7 @@ function mapHaEntityToCamStack(input) {
6215
6224
  case "alarm_control_panel": return mapAlarmPanel(attributes);
6216
6225
  case "person":
6217
6226
  case "device_tracker": return {
6218
- deviceType: require_dist.DeviceType.Presence,
6227
+ deviceType: require_ha_broker_source.DeviceType.Presence,
6219
6228
  role: null,
6220
6229
  capabilities: ["presence"]
6221
6230
  };
@@ -6224,49 +6233,49 @@ function mapHaEntityToCamStack(input) {
6224
6233
  case "camera": return mapImage(attributes);
6225
6234
  case "number":
6226
6235
  case "input_number": return {
6227
- deviceType: require_dist.DeviceType.Control,
6228
- role: require_dist.DeviceRole.NumericControl,
6236
+ deviceType: require_ha_broker_source.DeviceType.Control,
6237
+ role: require_ha_broker_source.DeviceRole.NumericControl,
6229
6238
  capabilities: ["control"]
6230
6239
  };
6231
6240
  case "select":
6232
6241
  case "input_select": return {
6233
- deviceType: require_dist.DeviceType.Control,
6234
- role: require_dist.DeviceRole.SelectControl,
6242
+ deviceType: require_ha_broker_source.DeviceType.Control,
6243
+ role: require_ha_broker_source.DeviceRole.SelectControl,
6235
6244
  capabilities: ["control"]
6236
6245
  };
6237
6246
  case "text":
6238
6247
  case "input_text": return {
6239
- deviceType: require_dist.DeviceType.Control,
6240
- role: require_dist.DeviceRole.TextControl,
6248
+ deviceType: require_ha_broker_source.DeviceType.Control,
6249
+ role: require_ha_broker_source.DeviceRole.TextControl,
6241
6250
  capabilities: ["control"]
6242
6251
  };
6243
6252
  case "input_datetime":
6244
6253
  case "date":
6245
6254
  case "time":
6246
6255
  case "datetime": return {
6247
- deviceType: require_dist.DeviceType.Control,
6248
- role: require_dist.DeviceRole.DateTimeControl,
6256
+ deviceType: require_ha_broker_source.DeviceType.Control,
6257
+ role: require_ha_broker_source.DeviceRole.DateTimeControl,
6249
6258
  capabilities: ["control"]
6250
6259
  };
6251
6260
  case "button":
6252
6261
  case "input_button":
6253
6262
  case "scene": return {
6254
- deviceType: require_dist.DeviceType.Button,
6263
+ deviceType: require_ha_broker_source.DeviceType.Button,
6255
6264
  role: null,
6256
6265
  capabilities: ["button"]
6257
6266
  };
6258
6267
  case "event": return {
6259
- deviceType: require_dist.DeviceType.EventEmitter,
6268
+ deviceType: require_ha_broker_source.DeviceType.EventEmitter,
6260
6269
  role: null,
6261
6270
  capabilities: ["event-emitter"]
6262
6271
  };
6263
6272
  case "script": return {
6264
- deviceType: require_dist.DeviceType.Script,
6273
+ deviceType: require_ha_broker_source.DeviceType.Script,
6265
6274
  role: null,
6266
6275
  capabilities: ["script-runner"]
6267
6276
  };
6268
6277
  case "automation": return {
6269
- deviceType: require_dist.DeviceType.Automation,
6278
+ deviceType: require_ha_broker_source.DeviceType.Automation,
6270
6279
  role: null,
6271
6280
  capabilities: ["automation-control"]
6272
6281
  };
@@ -6292,12 +6301,12 @@ function mapLight(attributes) {
6292
6301
  const hasMired = modes.some((m) => m === "color_temp");
6293
6302
  if (hasRgb || hasMired) {
6294
6303
  capabilities.push("color");
6295
- if (modes.includes("rgb") || modes.includes("rgbw") || modes.includes("rgbww") || modes.includes("xy")) features.push(require_dist.DeviceFeature.LightColorRgb);
6296
- if (modes.includes("hs")) features.push(require_dist.DeviceFeature.LightColorHsv);
6297
- if (hasMired) features.push(require_dist.DeviceFeature.LightColorMired);
6304
+ if (modes.includes("rgb") || modes.includes("rgbw") || modes.includes("rgbww") || modes.includes("xy")) features.push(require_ha_broker_source.DeviceFeature.LightColorRgb);
6305
+ if (modes.includes("hs")) features.push(require_ha_broker_source.DeviceFeature.LightColorHsv);
6306
+ if (hasMired) features.push(require_ha_broker_source.DeviceFeature.LightColorMired);
6298
6307
  }
6299
6308
  return {
6300
- deviceType: require_dist.DeviceType.Light,
6309
+ deviceType: require_ha_broker_source.DeviceType.Light,
6301
6310
  role: null,
6302
6311
  capabilities,
6303
6312
  features
@@ -6305,11 +6314,11 @@ function mapLight(attributes) {
6305
6314
  }
6306
6315
  function mapLock(attributes) {
6307
6316
  const features = [];
6308
- if (attributes["code_format"] !== void 0 && attributes["code_format"] !== null) features.push(require_dist.DeviceFeature.LockPinRequired);
6317
+ if (attributes["code_format"] !== void 0 && attributes["code_format"] !== null) features.push(require_ha_broker_source.DeviceFeature.LockPinRequired);
6309
6318
  const sf = readNumericAttr(attributes, "supported_features");
6310
- if (sf !== null && (sf & 1) !== 0) features.push(require_dist.DeviceFeature.LockOpen);
6319
+ if (sf !== null && (sf & 1) !== 0) features.push(require_ha_broker_source.DeviceFeature.LockOpen);
6311
6320
  return {
6312
- deviceType: require_dist.DeviceType.Lock,
6321
+ deviceType: require_ha_broker_source.DeviceType.Lock,
6313
6322
  role: null,
6314
6323
  capabilities: ["lock-control"],
6315
6324
  features
@@ -6318,10 +6327,10 @@ function mapLock(attributes) {
6318
6327
  function mapCover(attributes, deviceClass) {
6319
6328
  const features = [];
6320
6329
  const sf = readNumericAttr(attributes, "supported_features");
6321
- if (sf !== null && (sf & 4) !== 0) features.push(require_dist.DeviceFeature.CoverPositionable);
6322
- if (sf !== null && (sf & 128) !== 0) features.push(require_dist.DeviceFeature.CoverTilt);
6330
+ if (sf !== null && (sf & 4) !== 0) features.push(require_ha_broker_source.DeviceFeature.CoverPositionable);
6331
+ if (sf !== null && (sf & 128) !== 0) features.push(require_ha_broker_source.DeviceFeature.CoverTilt);
6323
6332
  return {
6324
- deviceType: require_dist.DeviceType.Cover,
6333
+ deviceType: require_ha_broker_source.DeviceType.Cover,
6325
6334
  role: coverRoleFor(deviceClass),
6326
6335
  capabilities: ["cover"],
6327
6336
  features
@@ -6331,23 +6340,23 @@ function mapCover(attributes, deviceClass) {
6331
6340
  function coverRoleFor(deviceClass) {
6332
6341
  switch (deviceClass) {
6333
6342
  case "blind":
6334
- case "shade": return require_dist.DeviceRole.CoverBlind;
6335
- case "shutter": return require_dist.DeviceRole.CoverShutter;
6336
- case "awning": return require_dist.DeviceRole.CoverAwning;
6337
- case "curtain": return require_dist.DeviceRole.CoverCurtain;
6338
- case "garage": return require_dist.DeviceRole.CoverGarage;
6339
- case "gate": return require_dist.DeviceRole.CoverGate;
6340
- case "door": return require_dist.DeviceRole.CoverDoor;
6341
- case "window": return require_dist.DeviceRole.CoverWindow;
6343
+ case "shade": return require_ha_broker_source.DeviceRole.CoverBlind;
6344
+ case "shutter": return require_ha_broker_source.DeviceRole.CoverShutter;
6345
+ case "awning": return require_ha_broker_source.DeviceRole.CoverAwning;
6346
+ case "curtain": return require_ha_broker_source.DeviceRole.CoverCurtain;
6347
+ case "garage": return require_ha_broker_source.DeviceRole.CoverGarage;
6348
+ case "gate": return require_ha_broker_source.DeviceRole.CoverGate;
6349
+ case "door": return require_ha_broker_source.DeviceRole.CoverDoor;
6350
+ case "window": return require_ha_broker_source.DeviceRole.CoverWindow;
6342
6351
  default: return null;
6343
6352
  }
6344
6353
  }
6345
6354
  function mapValve(attributes, _deviceClass) {
6346
6355
  const features = [];
6347
6356
  const sf = readNumericAttr(attributes, "supported_features");
6348
- if (sf !== null && (sf & 4) !== 0) features.push(require_dist.DeviceFeature.ValvePositionable);
6357
+ if (sf !== null && (sf & 4) !== 0) features.push(require_ha_broker_source.DeviceFeature.ValvePositionable);
6349
6358
  return {
6350
- deviceType: require_dist.DeviceType.Valve,
6359
+ deviceType: require_ha_broker_source.DeviceType.Valve,
6351
6360
  role: null,
6352
6361
  capabilities: ["valve"],
6353
6362
  features
@@ -6355,7 +6364,7 @@ function mapValve(attributes, _deviceClass) {
6355
6364
  }
6356
6365
  function mapHumidifier(_attributes, _deviceClass) {
6357
6366
  return {
6358
- deviceType: require_dist.DeviceType.Humidifier,
6367
+ deviceType: require_ha_broker_source.DeviceType.Humidifier,
6359
6368
  role: null,
6360
6369
  capabilities: ["humidifier"],
6361
6370
  features: []
@@ -6363,7 +6372,7 @@ function mapHumidifier(_attributes, _deviceClass) {
6363
6372
  }
6364
6373
  function mapWaterHeater(_attributes, _deviceClass) {
6365
6374
  return {
6366
- deviceType: require_dist.DeviceType.WaterHeater,
6375
+ deviceType: require_ha_broker_source.DeviceType.WaterHeater,
6367
6376
  role: null,
6368
6377
  capabilities: ["water-heater"],
6369
6378
  features: []
@@ -6373,13 +6382,13 @@ function mapFan(attributes) {
6373
6382
  const features = [];
6374
6383
  const sf = readNumericAttr(attributes, "supported_features");
6375
6384
  if (sf !== null) {
6376
- if ((sf & 1) !== 0) features.push(require_dist.DeviceFeature.FanSpeed);
6377
- if ((sf & 2) !== 0) features.push(require_dist.DeviceFeature.FanOscillating);
6378
- if ((sf & 4) !== 0) features.push(require_dist.DeviceFeature.FanDirection);
6379
- if ((sf & 8) !== 0) features.push(require_dist.DeviceFeature.FanPreset);
6385
+ if ((sf & 1) !== 0) features.push(require_ha_broker_source.DeviceFeature.FanSpeed);
6386
+ if ((sf & 2) !== 0) features.push(require_ha_broker_source.DeviceFeature.FanOscillating);
6387
+ if ((sf & 4) !== 0) features.push(require_ha_broker_source.DeviceFeature.FanDirection);
6388
+ if ((sf & 8) !== 0) features.push(require_ha_broker_source.DeviceFeature.FanPreset);
6380
6389
  }
6381
6390
  return {
6382
- deviceType: require_dist.DeviceType.Fan,
6391
+ deviceType: require_ha_broker_source.DeviceType.Fan,
6383
6392
  role: null,
6384
6393
  capabilities: ["switch", "fan-control"],
6385
6394
  features
@@ -6387,7 +6396,7 @@ function mapFan(attributes) {
6387
6396
  }
6388
6397
  function mapVacuum(_attributes) {
6389
6398
  return {
6390
- deviceType: require_dist.DeviceType.Vacuum,
6399
+ deviceType: require_ha_broker_source.DeviceType.Vacuum,
6391
6400
  role: null,
6392
6401
  capabilities: ["vacuum-control"],
6393
6402
  features: []
@@ -6395,7 +6404,7 @@ function mapVacuum(_attributes) {
6395
6404
  }
6396
6405
  function mapLawnMower(_attributes) {
6397
6406
  return {
6398
- deviceType: require_dist.DeviceType.LawnMower,
6407
+ deviceType: require_ha_broker_source.DeviceType.LawnMower,
6399
6408
  role: null,
6400
6409
  capabilities: ["lawn-mower-control"],
6401
6410
  features: []
@@ -6405,13 +6414,13 @@ function mapClimate(attributes) {
6405
6414
  const features = [];
6406
6415
  const sf = readNumericAttr(attributes, "supported_features");
6407
6416
  if (sf !== null) {
6408
- if ((sf & 2) !== 0) features.push(require_dist.DeviceFeature.ClimateDualSetpoint);
6409
- if ((sf & 4) !== 0) features.push(require_dist.DeviceFeature.ClimateHumidity);
6410
- if ((sf & 8) !== 0) features.push(require_dist.DeviceFeature.ClimateFanMode);
6411
- if ((sf & 16) !== 0) features.push(require_dist.DeviceFeature.ClimatePreset);
6417
+ if ((sf & 2) !== 0) features.push(require_ha_broker_source.DeviceFeature.ClimateDualSetpoint);
6418
+ if ((sf & 4) !== 0) features.push(require_ha_broker_source.DeviceFeature.ClimateHumidity);
6419
+ if ((sf & 8) !== 0) features.push(require_ha_broker_source.DeviceFeature.ClimateFanMode);
6420
+ if ((sf & 16) !== 0) features.push(require_ha_broker_source.DeviceFeature.ClimatePreset);
6412
6421
  }
6413
6422
  return {
6414
- deviceType: require_dist.DeviceType.Thermostat,
6423
+ deviceType: require_ha_broker_source.DeviceType.Thermostat,
6415
6424
  role: null,
6416
6425
  capabilities: ["climate-control"],
6417
6426
  features
@@ -6421,19 +6430,19 @@ function mapMediaPlayer(attributes) {
6421
6430
  const features = [];
6422
6431
  const sf = readNumericAttr(attributes, "supported_features");
6423
6432
  if (sf !== null) {
6424
- if ((sf & 2) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerSeek);
6425
- if ((sf & 4) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerVolume);
6426
- if ((sf & 8) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerMute);
6427
- if ((sf & 16) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerPrevious);
6428
- if ((sf & 32) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerNext);
6429
- if ((sf & 512) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerPlayMedia);
6430
- if ((sf & 2048) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerSelectSource);
6431
- if ((sf & 4096) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerStop);
6432
- if ((sf & 32768) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerShuffle);
6433
- if ((sf & 262144) !== 0) features.push(require_dist.DeviceFeature.MediaPlayerRepeat);
6433
+ if ((sf & 2) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerSeek);
6434
+ if ((sf & 4) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerVolume);
6435
+ if ((sf & 8) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerMute);
6436
+ if ((sf & 16) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerPrevious);
6437
+ if ((sf & 32) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerNext);
6438
+ if ((sf & 512) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerPlayMedia);
6439
+ if ((sf & 2048) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerSelectSource);
6440
+ if ((sf & 4096) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerStop);
6441
+ if ((sf & 32768) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerShuffle);
6442
+ if ((sf & 262144) !== 0) features.push(require_ha_broker_source.DeviceFeature.MediaPlayerRepeat);
6434
6443
  }
6435
6444
  return {
6436
- deviceType: require_dist.DeviceType.MediaPlayer,
6445
+ deviceType: require_ha_broker_source.DeviceType.MediaPlayer,
6437
6446
  role: null,
6438
6447
  capabilities: ["media-player"],
6439
6448
  features
@@ -6441,9 +6450,9 @@ function mapMediaPlayer(attributes) {
6441
6450
  }
6442
6451
  function mapAlarmPanel(attributes) {
6443
6452
  const features = [];
6444
- if (attributes["code_format"] !== void 0 && attributes["code_format"] !== null) features.push(require_dist.DeviceFeature.AlarmPinRequired);
6453
+ if (attributes["code_format"] !== void 0 && attributes["code_format"] !== null) features.push(require_ha_broker_source.DeviceFeature.AlarmPinRequired);
6445
6454
  return {
6446
- deviceType: require_dist.DeviceType.AlarmPanel,
6455
+ deviceType: require_ha_broker_source.DeviceType.AlarmPanel,
6447
6456
  role: null,
6448
6457
  capabilities: ["alarm-panel"],
6449
6458
  features
@@ -6451,21 +6460,21 @@ function mapAlarmPanel(attributes) {
6451
6460
  }
6452
6461
  function mapNotifier(_attributes) {
6453
6462
  return {
6454
- deviceType: require_dist.DeviceType.Notifier,
6455
- role: require_dist.DeviceRole.GenericNotifier,
6463
+ deviceType: require_ha_broker_source.DeviceType.Notifier,
6464
+ role: require_ha_broker_source.DeviceRole.GenericNotifier,
6456
6465
  capabilities: ["notifier"]
6457
6466
  };
6458
6467
  }
6459
6468
  function mapWeather(_attributes) {
6460
6469
  return {
6461
- deviceType: require_dist.DeviceType.Weather,
6470
+ deviceType: require_ha_broker_source.DeviceType.Weather,
6462
6471
  role: null,
6463
6472
  capabilities: ["weather"]
6464
6473
  };
6465
6474
  }
6466
6475
  function mapImage(_attributes) {
6467
6476
  return {
6468
- deviceType: require_dist.DeviceType.Image,
6477
+ deviceType: require_ha_broker_source.DeviceType.Image,
6469
6478
  role: null,
6470
6479
  capabilities: ["image"]
6471
6480
  };
@@ -6479,60 +6488,60 @@ function isTemperatureUnit(unit) {
6479
6488
  function mapNumericSensor(deviceClass, _attributes) {
6480
6489
  switch (deviceClass) {
6481
6490
  case "temperature": return {
6482
- deviceType: require_dist.DeviceType.Sensor,
6483
- role: require_dist.DeviceRole.TemperatureSensor,
6491
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6492
+ role: require_ha_broker_source.DeviceRole.TemperatureSensor,
6484
6493
  capabilities: ["temperature-sensor"]
6485
6494
  };
6486
6495
  case "humidity": return {
6487
- deviceType: require_dist.DeviceType.Sensor,
6488
- role: require_dist.DeviceRole.HumiditySensor,
6496
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6497
+ role: require_ha_broker_source.DeviceRole.HumiditySensor,
6489
6498
  capabilities: ["humidity-sensor"]
6490
6499
  };
6491
6500
  case "illuminance": return {
6492
- deviceType: require_dist.DeviceType.Sensor,
6493
- role: require_dist.DeviceRole.AmbientLightSensor,
6501
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6502
+ role: require_ha_broker_source.DeviceRole.AmbientLightSensor,
6494
6503
  capabilities: ["ambient-light-sensor"]
6495
6504
  };
6496
6505
  case "pressure":
6497
6506
  case "atmospheric_pressure": return {
6498
- deviceType: require_dist.DeviceType.Sensor,
6499
- role: require_dist.DeviceRole.PressureSensor,
6507
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6508
+ role: require_ha_broker_source.DeviceRole.PressureSensor,
6500
6509
  capabilities: ["pressure-sensor"]
6501
6510
  };
6502
6511
  case "wind_speed": return {
6503
- deviceType: require_dist.DeviceType.Sensor,
6504
- role: require_dist.DeviceRole.WindSensor,
6512
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6513
+ role: require_ha_broker_source.DeviceRole.WindSensor,
6505
6514
  capabilities: ["numeric-sensor"]
6506
6515
  };
6507
6516
  case "precipitation":
6508
6517
  case "precipitation_intensity": return {
6509
- deviceType: require_dist.DeviceType.Sensor,
6510
- role: require_dist.DeviceRole.RainSensor,
6518
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6519
+ role: require_ha_broker_source.DeviceRole.RainSensor,
6511
6520
  capabilities: ["numeric-sensor"]
6512
6521
  };
6513
6522
  case "irradiance": return {
6514
- deviceType: require_dist.DeviceType.Sensor,
6515
- role: require_dist.DeviceRole.SolarRadiationSensor,
6523
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6524
+ role: require_ha_broker_source.DeviceRole.SolarRadiationSensor,
6516
6525
  capabilities: ["numeric-sensor"]
6517
6526
  };
6518
6527
  case "power": return {
6519
- deviceType: require_dist.DeviceType.Sensor,
6520
- role: require_dist.DeviceRole.PowerSensor,
6528
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6529
+ role: require_ha_broker_source.DeviceRole.PowerSensor,
6521
6530
  capabilities: ["power-meter"]
6522
6531
  };
6523
6532
  case "energy": return {
6524
- deviceType: require_dist.DeviceType.Sensor,
6525
- role: require_dist.DeviceRole.EnergySensor,
6533
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6534
+ role: require_ha_broker_source.DeviceRole.EnergySensor,
6526
6535
  capabilities: ["power-meter"]
6527
6536
  };
6528
6537
  case "voltage": return {
6529
- deviceType: require_dist.DeviceType.Sensor,
6530
- role: require_dist.DeviceRole.VoltageSensor,
6538
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6539
+ role: require_ha_broker_source.DeviceRole.VoltageSensor,
6531
6540
  capabilities: ["power-meter"]
6532
6541
  };
6533
6542
  case "current": return {
6534
- deviceType: require_dist.DeviceType.Sensor,
6535
- role: require_dist.DeviceRole.CurrentSensor,
6543
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6544
+ role: require_ha_broker_source.DeviceRole.CurrentSensor,
6536
6545
  capabilities: ["power-meter"]
6537
6546
  };
6538
6547
  case "pm1":
@@ -6545,46 +6554,46 @@ function mapNumericSensor(deviceClass, _attributes) {
6545
6554
  case "sulphur_dioxide":
6546
6555
  case "volatile_organic_compounds":
6547
6556
  case "aqi": return {
6548
- deviceType: require_dist.DeviceType.Sensor,
6549
- role: require_dist.DeviceRole.AirQualitySensor,
6557
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6558
+ role: require_ha_broker_source.DeviceRole.AirQualitySensor,
6550
6559
  capabilities: ["air-quality-sensor"]
6551
6560
  };
6552
6561
  case "battery": return {
6553
- deviceType: require_dist.DeviceType.Sensor,
6554
- role: require_dist.DeviceRole.BatterySensor,
6562
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6563
+ role: require_ha_broker_source.DeviceRole.BatterySensor,
6555
6564
  capabilities: ["numeric-sensor"]
6556
6565
  };
6557
6566
  case "enum": return {
6558
- deviceType: require_dist.DeviceType.Sensor,
6559
- role: require_dist.DeviceRole.EnumSensor,
6567
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6568
+ role: require_ha_broker_source.DeviceRole.EnumSensor,
6560
6569
  capabilities: ["enum-sensor"]
6561
6570
  };
6562
6571
  case "timestamp": return {
6563
- deviceType: require_dist.DeviceType.Sensor,
6564
- role: require_dist.DeviceRole.DateTimeSensor,
6572
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6573
+ role: require_ha_broker_source.DeviceRole.DateTimeSensor,
6565
6574
  capabilities: ["enum-sensor"],
6566
6575
  dateTimeFormat: "datetime"
6567
6576
  };
6568
6577
  case "date": return {
6569
- deviceType: require_dist.DeviceType.Sensor,
6570
- role: require_dist.DeviceRole.DateTimeSensor,
6578
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6579
+ role: require_ha_broker_source.DeviceRole.DateTimeSensor,
6571
6580
  capabilities: ["enum-sensor"],
6572
6581
  dateTimeFormat: "date"
6573
6582
  };
6574
6583
  case null:
6575
6584
  if (isTemperatureUnit(_attributes["unit_of_measurement"])) return {
6576
- deviceType: require_dist.DeviceType.Sensor,
6577
- role: require_dist.DeviceRole.TemperatureSensor,
6585
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6586
+ role: require_ha_broker_source.DeviceRole.TemperatureSensor,
6578
6587
  capabilities: ["temperature-sensor"]
6579
6588
  };
6580
6589
  return {
6581
- deviceType: require_dist.DeviceType.Sensor,
6582
- role: require_dist.DeviceRole.EnumSensor,
6590
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6591
+ role: require_ha_broker_source.DeviceRole.EnumSensor,
6583
6592
  capabilities: ["enum-sensor"]
6584
6593
  };
6585
6594
  default: return {
6586
- deviceType: require_dist.DeviceType.Sensor,
6587
- role: require_dist.DeviceRole.NumericSensor,
6595
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6596
+ role: require_ha_broker_source.DeviceRole.NumericSensor,
6588
6597
  capabilities: ["numeric-sensor"]
6589
6598
  };
6590
6599
  }
@@ -6595,67 +6604,67 @@ function mapBinarySensor(deviceClass) {
6595
6604
  case "occupancy":
6596
6605
  case "presence":
6597
6606
  case "moving": return {
6598
- deviceType: require_dist.DeviceType.Sensor,
6599
- role: require_dist.DeviceRole.MotionSensor,
6607
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6608
+ role: require_ha_broker_source.DeviceRole.MotionSensor,
6600
6609
  capabilities: ["motion"]
6601
6610
  };
6602
6611
  case "door":
6603
6612
  case "window":
6604
6613
  case "garage_door":
6605
6614
  case "opening": return {
6606
- deviceType: require_dist.DeviceType.Sensor,
6607
- role: require_dist.DeviceRole.ContactSensor,
6615
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6616
+ role: require_ha_broker_source.DeviceRole.ContactSensor,
6608
6617
  capabilities: ["contact"]
6609
6618
  };
6610
6619
  case "moisture": return {
6611
- deviceType: require_dist.DeviceType.Sensor,
6612
- role: require_dist.DeviceRole.LeakSensor,
6620
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6621
+ role: require_ha_broker_source.DeviceRole.LeakSensor,
6613
6622
  capabilities: ["flood"]
6614
6623
  };
6615
6624
  case "smoke": return {
6616
- deviceType: require_dist.DeviceType.Sensor,
6617
- role: require_dist.DeviceRole.SmokeSensor,
6625
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6626
+ role: require_ha_broker_source.DeviceRole.SmokeSensor,
6618
6627
  capabilities: ["smoke"]
6619
6628
  };
6620
6629
  case "carbon_monoxide": return {
6621
- deviceType: require_dist.DeviceType.Sensor,
6622
- role: require_dist.DeviceRole.COSensor,
6630
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6631
+ role: require_ha_broker_source.DeviceRole.COSensor,
6623
6632
  capabilities: ["carbon-monoxide"]
6624
6633
  };
6625
6634
  case "gas": return {
6626
- deviceType: require_dist.DeviceType.Sensor,
6627
- role: require_dist.DeviceRole.GasSensor,
6635
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6636
+ role: require_ha_broker_source.DeviceRole.GasSensor,
6628
6637
  capabilities: ["gas"]
6629
6638
  };
6630
6639
  case "tamper":
6631
6640
  case "safety": return {
6632
- deviceType: require_dist.DeviceType.Sensor,
6633
- role: require_dist.DeviceRole.TamperSensor,
6641
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6642
+ role: require_ha_broker_source.DeviceRole.TamperSensor,
6634
6643
  capabilities: ["tamper"]
6635
6644
  };
6636
6645
  case "vibration": return {
6637
- deviceType: require_dist.DeviceType.Sensor,
6638
- role: require_dist.DeviceRole.VibrationSensor,
6646
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6647
+ role: require_ha_broker_source.DeviceRole.VibrationSensor,
6639
6648
  capabilities: ["vibration"]
6640
6649
  };
6641
6650
  case "connectivity": return {
6642
- deviceType: require_dist.DeviceType.Sensor,
6643
- role: require_dist.DeviceRole.ConnectivitySensor,
6651
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6652
+ role: require_ha_broker_source.DeviceRole.ConnectivitySensor,
6644
6653
  capabilities: ["connectivity"]
6645
6654
  };
6646
6655
  case "sound": return {
6647
- deviceType: require_dist.DeviceType.Sensor,
6648
- role: require_dist.DeviceRole.SoundSensor,
6656
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6657
+ role: require_ha_broker_source.DeviceRole.SoundSensor,
6649
6658
  capabilities: ["binary"]
6650
6659
  };
6651
6660
  case "battery": return {
6652
- deviceType: require_dist.DeviceType.Sensor,
6653
- role: require_dist.DeviceRole.BatterySensor,
6661
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6662
+ role: require_ha_broker_source.DeviceRole.BatterySensor,
6654
6663
  capabilities: ["binary"]
6655
6664
  };
6656
6665
  default: return {
6657
- deviceType: require_dist.DeviceType.Sensor,
6658
- role: require_dist.DeviceRole.BinarySensor,
6666
+ deviceType: require_ha_broker_source.DeviceType.Sensor,
6667
+ role: require_ha_broker_source.DeviceRole.BinarySensor,
6659
6668
  capabilities: ["binary"]
6660
6669
  };
6661
6670
  }
@@ -6678,40 +6687,40 @@ function readNumericAttr(attributes, key) {
6678
6687
  * Sensor; an HA-tracked light with motion sensor becomes Light).
6679
6688
  */
6680
6689
  var PARENT_TYPE_PRIORITY = [
6681
- require_dist.DeviceType.MediaPlayer,
6682
- require_dist.DeviceType.AlarmPanel,
6683
- require_dist.DeviceType.Thermostat,
6684
- require_dist.DeviceType.Climate,
6685
- require_dist.DeviceType.Humidifier,
6686
- require_dist.DeviceType.WaterHeater,
6687
- require_dist.DeviceType.Lock,
6688
- require_dist.DeviceType.Cover,
6689
- require_dist.DeviceType.Valve,
6690
- require_dist.DeviceType.Fan,
6691
- require_dist.DeviceType.Vacuum,
6692
- require_dist.DeviceType.LawnMower,
6693
- require_dist.DeviceType.Washer,
6694
- require_dist.DeviceType.Dryer,
6695
- require_dist.DeviceType.Dishwasher,
6696
- require_dist.DeviceType.Light,
6697
- require_dist.DeviceType.Switch,
6698
- require_dist.DeviceType.Siren,
6699
- require_dist.DeviceType.Button,
6700
- require_dist.DeviceType.Control,
6701
- require_dist.DeviceType.Notifier,
6702
- require_dist.DeviceType.Script,
6703
- require_dist.DeviceType.Automation,
6704
- require_dist.DeviceType.Update,
6705
- require_dist.DeviceType.Presence,
6706
- require_dist.DeviceType.Weather,
6707
- require_dist.DeviceType.Image,
6708
- require_dist.DeviceType.Sensor
6690
+ require_ha_broker_source.DeviceType.MediaPlayer,
6691
+ require_ha_broker_source.DeviceType.AlarmPanel,
6692
+ require_ha_broker_source.DeviceType.Thermostat,
6693
+ require_ha_broker_source.DeviceType.Climate,
6694
+ require_ha_broker_source.DeviceType.Humidifier,
6695
+ require_ha_broker_source.DeviceType.WaterHeater,
6696
+ require_ha_broker_source.DeviceType.Lock,
6697
+ require_ha_broker_source.DeviceType.Cover,
6698
+ require_ha_broker_source.DeviceType.Valve,
6699
+ require_ha_broker_source.DeviceType.Fan,
6700
+ require_ha_broker_source.DeviceType.Vacuum,
6701
+ require_ha_broker_source.DeviceType.LawnMower,
6702
+ require_ha_broker_source.DeviceType.Washer,
6703
+ require_ha_broker_source.DeviceType.Dryer,
6704
+ require_ha_broker_source.DeviceType.Dishwasher,
6705
+ require_ha_broker_source.DeviceType.Light,
6706
+ require_ha_broker_source.DeviceType.Switch,
6707
+ require_ha_broker_source.DeviceType.Siren,
6708
+ require_ha_broker_source.DeviceType.Button,
6709
+ require_ha_broker_source.DeviceType.Control,
6710
+ require_ha_broker_source.DeviceType.Notifier,
6711
+ require_ha_broker_source.DeviceType.Script,
6712
+ require_ha_broker_source.DeviceType.Automation,
6713
+ require_ha_broker_source.DeviceType.Update,
6714
+ require_ha_broker_source.DeviceType.Presence,
6715
+ require_ha_broker_source.DeviceType.Weather,
6716
+ require_ha_broker_source.DeviceType.Image,
6717
+ require_ha_broker_source.DeviceType.Sensor
6709
6718
  ];
6710
6719
  function inferParentDeviceType(mappings) {
6711
6720
  const set = /* @__PURE__ */ new Set();
6712
6721
  for (const m of mappings) if (m) set.add(m.deviceType);
6713
6722
  for (const dt of PARENT_TYPE_PRIORITY) if (set.has(dt)) return dt;
6714
- return require_dist.DeviceType.Generic;
6723
+ return require_ha_broker_source.DeviceType.Generic;
6715
6724
  }
6716
6725
  //#endregion
6717
6726
  //#region src/ha-candidate-mapper.ts
@@ -6733,7 +6742,7 @@ function haDeviceToCandidate(dev) {
6733
6742
  return {
6734
6743
  childNativeId: e.entityId,
6735
6744
  name: e.name,
6736
- type: e.mappedTo?.deviceType ?? require_dist.DeviceType.Generic,
6745
+ type: e.mappedTo?.deviceType ?? require_ha_broker_source.DeviceType.Generic,
6737
6746
  status: entityStatus$1(e.state),
6738
6747
  metadata: e.area !== null ? { externalLocation: e.area } : {},
6739
6748
  alreadyAdopted: e.alreadyAdopted,
@@ -6880,7 +6889,7 @@ function buildDiscoveryCandidates(input) {
6880
6889
  };
6881
6890
  candidates.push({
6882
6891
  stableId,
6883
- type: require_dist.DeviceType.Container,
6892
+ type: require_ha_broker_source.DeviceType.Container,
6884
6893
  suggestedName,
6885
6894
  prefilledConfig,
6886
6895
  sourceInfo
@@ -6908,52 +6917,52 @@ function buildDiscoveryCandidates(input) {
6908
6917
  * shown as a Devices-tab candidate.
6909
6918
  */
6910
6919
  var HA_ORPHAN_ENTITIES_DEVICE_ID = "__ha_orphan_entities__";
6911
- var HaEntityMappingSchema = require_dist.object({
6920
+ var HaEntityMappingSchema = require_ha_broker_source.object({
6912
6921
  /** CamStack DeviceType for the accessory child. */
6913
- deviceType: require_dist._enum(require_dist.DeviceType),
6922
+ deviceType: require_ha_broker_source._enum(require_ha_broker_source.DeviceType),
6914
6923
  /** Optional CamStack DeviceRole sub-role (e.g. `ContactSensor` for
6915
6924
  * a binary_sensor with `device_class: door`). */
6916
- role: require_dist._enum(require_dist.DeviceRole).nullable(),
6925
+ role: require_ha_broker_source._enum(require_ha_broker_source.DeviceRole).nullable(),
6917
6926
  /** Capability names the accessory child will register
6918
6927
  * (`switch` / `temperature-sensor` / …). UI may render the cap
6919
6928
  * badges to help the operator decide what to hide. */
6920
- capabilities: require_dist.array(require_dist.string()).readonly(),
6929
+ capabilities: require_ha_broker_source.array(require_ha_broker_source.string()).readonly(),
6921
6930
  /** Mapping-derived DeviceFeature flags (e.g. `lock-open`). Persisted onto
6922
6931
  * the child's `device.features` so the UI gates feature affordances. */
6923
- features: require_dist.array(require_dist.string()).readonly().optional(),
6932
+ features: require_ha_broker_source.array(require_ha_broker_source.string()).readonly().optional(),
6924
6933
  /** Locale-render shape for a `DateTimeSensor`-role enum sensor
6925
6934
  * (`device_class=timestamp` → `'datetime'`, `date` → `'date'`). Threaded
6926
6935
  * onto the child config so the enum-sensor device seeds it into the cap
6927
6936
  * slice. Absent for every non-DateTimeSensor mapping. */
6928
- dateTimeFormat: require_dist.EnumSensorDateTimeFormatSchema.optional()
6937
+ dateTimeFormat: require_ha_broker_source.EnumSensorDateTimeFormatSchema.optional()
6929
6938
  }).nullable();
6930
- var HaDiscoveredEntitySchema = require_dist.object({
6939
+ var HaDiscoveredEntitySchema = require_ha_broker_source.object({
6931
6940
  /** Fully-qualified HA entity id (`switch.kitchen`). */
6932
- entityId: require_dist.string(),
6941
+ entityId: require_ha_broker_source.string(),
6933
6942
  /** HA domain — first segment of entity_id (`switch` / `light` /
6934
6943
  * `sensor` / `binary_sensor` / `cover` / …). */
6935
- domain: require_dist.string(),
6944
+ domain: require_ha_broker_source.string(),
6936
6945
  /** Operator-visible friendly name (HA `friendly_name` attribute or
6937
6946
  * the entity_id when missing). */
6938
- name: require_dist.string(),
6947
+ name: require_ha_broker_source.string(),
6939
6948
  /** Current state value (e.g. `'on'`, `'21.5'`, `'open'`). */
6940
- state: require_dist.string(),
6949
+ state: require_ha_broker_source.string(),
6941
6950
  /** HA `device_class` attribute when present — drives the role +
6942
6951
  * cap mapping for sensors / binary_sensors / covers. */
6943
- deviceClass: require_dist.string().nullable(),
6952
+ deviceClass: require_ha_broker_source.string().nullable(),
6944
6953
  /** HA `unit_of_measurement` attribute when present. */
6945
- unitOfMeasurement: require_dist.string().nullable(),
6954
+ unitOfMeasurement: require_ha_broker_source.string().nullable(),
6946
6955
  /** Area name for this entity — the entity's own HA area if set, else its
6947
6956
  * parent device's area. Null when neither is assigned. */
6948
- area: require_dist.string().nullable().default(null),
6957
+ area: require_ha_broker_source.string().nullable().default(null),
6949
6958
  /** HA `options` attribute — present on `select` / `input_select` entities.
6950
6959
  * Captured at discovery so the adopt handler can persist them alongside
6951
6960
  * other entity config fields. Absent on non-select entities. */
6952
- options: require_dist.array(require_dist.string()).nullable().default(null),
6961
+ options: require_ha_broker_source.array(require_ha_broker_source.string()).nullable().default(null),
6953
6962
  /** HA `entity_category` — `config` / `diagnostic` / null (a normal control).
6954
6963
  * Drives the accordion section the adopted child renders in. Null/absent for
6955
6964
  * the common control case. */
6956
- entityCategory: require_dist._enum(["config", "diagnostic"]).nullable().default(null),
6965
+ entityCategory: require_ha_broker_source._enum(["config", "diagnostic"]).nullable().default(null),
6957
6966
  /** Pre-computed CamStack mapping. `null` when the entity's domain
6958
6967
  * has no supported mapping (the operator may still adopt the
6959
6968
  * parent — the entity will be skipped or surfaced as a fallback). */
@@ -6961,48 +6970,48 @@ var HaDiscoveredEntitySchema = require_dist.object({
6961
6970
  /** When `true`, the entity was already materialised as a CamStack
6962
6971
  * accessory child under a prior adoption — surfaced so the UI can
6963
6972
  * highlight existing wiring. */
6964
- alreadyAdopted: require_dist.boolean(),
6973
+ alreadyAdopted: require_ha_broker_source.boolean(),
6965
6974
  /** When `alreadyAdopted === true`, the kernel-assigned accessory
6966
6975
  * child id. */
6967
- adoptedCamDeviceId: require_dist.number().int().nonnegative().nullable()
6976
+ adoptedCamDeviceId: require_ha_broker_source.number().int().nonnegative().nullable()
6968
6977
  });
6969
- require_dist.object({
6978
+ require_ha_broker_source.object({
6970
6979
  /** Stable HA `device_registry` id — survives renames + restarts. */
6971
- haDeviceId: require_dist.string(),
6980
+ haDeviceId: require_ha_broker_source.string(),
6972
6981
  /** Operator-visible name (HA device `name` or first entity's
6973
6982
  * friendly_name when device has none). */
6974
- name: require_dist.string(),
6983
+ name: require_ha_broker_source.string(),
6975
6984
  /** Area name from HA `area_registry` join. Null when unassigned. */
6976
- area: require_dist.string().nullable(),
6977
- manufacturer: require_dist.string().nullable(),
6978
- model: require_dist.string().nullable(),
6979
- swVersion: require_dist.string().nullable(),
6985
+ area: require_ha_broker_source.string().nullable(),
6986
+ manufacturer: require_ha_broker_source.string().nullable(),
6987
+ model: require_ha_broker_source.string().nullable(),
6988
+ swVersion: require_ha_broker_source.string().nullable(),
6980
6989
  /** Dominant integration / platform domain for this device, derived from its
6981
6990
  * entities' HA `entity_registry.platform` (e.g. `dreame_vacuum`). Generic /
6982
6991
  * helper platforms (`unifi` / `hacs` / `hassio`) are excluded when a real
6983
6992
  * platform is available. Null when the device has no entities. */
6984
- integration: require_dist.string().nullable().default(null),
6993
+ integration: require_ha_broker_source.string().nullable().default(null),
6985
6994
  /** Convenience field — count of `entities[]`. */
6986
- entityCount: require_dist.number().int().nonnegative(),
6995
+ entityCount: require_ha_broker_source.number().int().nonnegative(),
6987
6996
  /** Every entity HA's `entity_registry` links to this device. The
6988
6997
  * list survives row collapse — full devices are returned so
6989
6998
  * accordion expansion is a no-roundtrip render. */
6990
- entities: require_dist.array(HaDiscoveredEntitySchema).readonly(),
6999
+ entities: require_ha_broker_source.array(HaDiscoveredEntitySchema).readonly(),
6991
7000
  /** Whether this HA device has an active CamStack adoption. */
6992
- alreadyAdopted: require_dist.boolean(),
7001
+ alreadyAdopted: require_ha_broker_source.boolean(),
6993
7002
  /** When `alreadyAdopted === true`, the kernel-assigned parent id. */
6994
- adoptedCamDeviceId: require_dist.number().int().nonnegative().nullable()
7003
+ adoptedCamDeviceId: require_ha_broker_source.number().int().nonnegative().nullable()
6995
7004
  });
6996
- require_dist.object({
7005
+ require_ha_broker_source.object({
6997
7006
  /** Last refresh timestamp (ms epoch) — null when never refreshed. */
6998
- lastDiscoveryAt: require_dist.number().int().nonnegative().nullable(),
7007
+ lastDiscoveryAt: require_ha_broker_source.number().int().nonnegative().nullable(),
6999
7008
  /** Count of HA devices in the discovery cache (across all brokers). */
7000
- deviceCount: require_dist.number().int().nonnegative(),
7009
+ deviceCount: require_ha_broker_source.number().int().nonnegative(),
7001
7010
  /** Count of HA devices currently materialised as CamStack parent
7002
7011
  * devices. */
7003
- adoptedCount: require_dist.number().int().nonnegative(),
7012
+ adoptedCount: require_ha_broker_source.number().int().nonnegative(),
7004
7013
  /** Last error message from a refresh attempt. */
7005
- lastError: require_dist.string().nullable()
7014
+ lastError: require_ha_broker_source.string().nullable()
7006
7015
  });
7007
7016
  //#endregion
7008
7017
  //#region src/ha-integration-domain.ts
@@ -7141,7 +7150,7 @@ function negotiateEncoding(acceptEncoding) {
7141
7150
  }
7142
7151
  /** Build the `addon-routes` provider that serves the bundled Home Assistant icon. */
7143
7152
  function createHaIconRouteProvider() {
7144
- return require_dist.buildAddonRouteProvider(HA_ROUTE_ID, [{
7153
+ return require_ha_broker_source.buildAddonRouteProvider(HA_ROUTE_ID, [{
7145
7154
  method: "GET",
7146
7155
  path: `/icons/${HA_ICON_KIND}`,
7147
7156
  access: "public",
@@ -7160,11 +7169,11 @@ function createHaIconRouteProvider() {
7160
7169
  * Broker entry kind (B2): credentials live in records; integrations keep brokerId.
7161
7170
  */
7162
7171
  var HA_BROKERS_KIND = "brokers";
7163
- var HaBrokerBodySchema = require_dist.entryBody({
7172
+ var HaBrokerBodySchema = require_ha_broker_source.entryBody({
7164
7173
  auth: HaBrokerEntrySchema.shape.auth,
7165
- integrationId: require_dist.string().optional()
7174
+ integrationId: require_ha_broker_source.string().optional()
7166
7175
  });
7167
- var haBrokersEntryKind = require_dist.defineEntryKind(HA_BROKERS_KIND, {
7176
+ var haBrokersEntryKind = require_ha_broker_source.defineEntryKind(HA_BROKERS_KIND, {
7168
7177
  title: "Home Assistant brokers",
7169
7178
  schema: HaBrokerBodySchema,
7170
7179
  writeTrigger: "an operator adds, edits or removes a Home Assistant broker connection"
@@ -7178,8 +7187,8 @@ var haBrokersEntryKind = require_dist.defineEntryKind(HA_BROKERS_KIND, {
7178
7187
  * credential — delivery reuses the broker WebSocket connection (the token
7179
7188
  * lives in the broker config, not in the target).
7180
7189
  */
7181
- var HaTargetBodySchema = require_dist.TargetSchema.omit({ id: true });
7182
- var haRecordKinds = require_dist.defineRecordKinds({
7190
+ var HaTargetBodySchema = require_ha_broker_source.TargetSchema.omit({ id: true });
7191
+ var haRecordKinds = require_ha_broker_source.defineRecordKinds({
7183
7192
  /**
7184
7193
  * One row per configured Home Assistant push target. Operator-managed via the
7185
7194
  * notification-output cap CRUD; no TTL.
@@ -7239,21 +7248,27 @@ function haConfigSchema() {
7239
7248
  title: "Home Assistant notify",
7240
7249
  titleKey: "provider-homeassistant:haConfig.s_connection.title",
7241
7250
  fields: [{
7242
- type: "text",
7251
+ type: "broker-select",
7252
+ key: "brokerId",
7253
+ label: "Broker",
7254
+ labelKey: "provider-homeassistant:haConfig.s_connection.brokerId.label",
7255
+ description: "The Home Assistant connection the notification goes through.",
7256
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.brokerId.description",
7257
+ brokerKind: require_ha_broker_source.HA_BROKER_KIND
7258
+ }, {
7259
+ type: "select",
7243
7260
  key: "service",
7244
7261
  label: "Notify service",
7245
7262
  labelKey: "provider-homeassistant:haConfig.s_connection.service.label",
7246
7263
  required: true,
7264
+ options: [],
7247
7265
  placeholder: "mobile_app_pixel_7",
7248
- description: "The part after `notify.` (e.g. `mobile_app_pixel_7`); use Discover to list them.",
7249
- descriptionKey: "provider-homeassistant:haConfig.s_connection.service.description"
7250
- }, {
7251
- type: "text",
7252
- key: "brokerId",
7253
- label: "Broker",
7254
- labelKey: "provider-homeassistant:haConfig.s_connection.brokerId.label",
7255
- description: "Optional; blank uses the only configured broker.",
7256
- descriptionKey: "provider-homeassistant:haConfig.s_connection.brokerId.description"
7266
+ description: "Loaded from the broker once it is picked. If the list does not load, type the part after `notify.`.",
7267
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.service.description",
7268
+ discoverOptions: {
7269
+ kind: HA_NOTIFICATION_KIND,
7270
+ dependsOn: ["brokerId"]
7271
+ }
7257
7272
  }]
7258
7273
  }] };
7259
7274
  }
@@ -7394,24 +7409,70 @@ function buildNotifyServiceData(prepared) {
7394
7409
  * `get_services` returns `{ [domain]: { [service]: {...} } }`; we read the
7395
7410
  * `notify` domain. mobile_app_* services (rich push features) sort first.
7396
7411
  */
7397
- function parseNotifyServices(result, brokerId) {
7412
+ function parseNotifyServices(result, brokerId, deviceNames) {
7398
7413
  if (typeof result !== "object" || result === null) return [];
7399
7414
  const notify = result["notify"];
7400
7415
  if (typeof notify !== "object" || notify === null) return [];
7401
- return [...Object.keys(notify)].sort((a, b) => {
7416
+ return [...Object.entries(notify)].sort(([a], [b]) => {
7402
7417
  const am = a.startsWith("mobile_app_") ? 0 : 1;
7403
7418
  const bm = b.startsWith("mobile_app_") ? 0 : 1;
7404
7419
  if (am !== bm) return am - bm;
7405
7420
  return a.localeCompare(b);
7406
- }).map((service) => ({
7421
+ }).map(([service, definition]) => ({
7407
7422
  kind: HA_NOTIFICATION_KIND,
7408
- suggestedName: `notify.${service}`,
7423
+ suggestedName: friendlyServiceName(service, definition, deviceNames),
7409
7424
  config: {
7410
7425
  service,
7411
7426
  ...brokerId !== void 0 ? { brokerId } : {}
7412
7427
  }
7413
7428
  }));
7414
7429
  }
7430
+ function nonEmptyText(value) {
7431
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
7432
+ }
7433
+ /** `alexa_media_echo` -> `Alexa Media Echo`. */
7434
+ function prettifyServiceId(service) {
7435
+ return service.split("_").filter((word) => word.length > 0).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
7436
+ }
7437
+ /**
7438
+ * The name an operator recognises: the device name for a mobile app, else the
7439
+ * service's own `name`, else its `description`, else the prettified id.
7440
+ */
7441
+ function friendlyServiceName(service, definition, deviceNames) {
7442
+ const device = deviceNames?.get(service);
7443
+ if (device !== void 0) return device;
7444
+ if (typeof definition === "object" && definition !== null) {
7445
+ const fields = { ...definition };
7446
+ const name = nonEmptyText(fields["name"]);
7447
+ if (name !== void 0) return name;
7448
+ const description = nonEmptyText(fields["description"]);
7449
+ if (description !== void 0) return description;
7450
+ }
7451
+ return prettifyServiceId(service);
7452
+ }
7453
+ /** HA's slug of a device name, as it appears in `mobile_app_<slug>`. */
7454
+ function slugifyDeviceName(name) {
7455
+ return name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
7456
+ }
7457
+ /**
7458
+ * `mobile_app_<slug>` -> device name, read from a `config/device_registry/list`
7459
+ * reply. Only devices of the mobile_app integration count; the name the user
7460
+ * gave wins over the one the app reported.
7461
+ */
7462
+ function mobileAppDeviceNames(registry) {
7463
+ const names = /* @__PURE__ */ new Map();
7464
+ if (!Array.isArray(registry)) return names;
7465
+ for (const entry of registry) {
7466
+ if (typeof entry !== "object" || entry === null) continue;
7467
+ const device = { ...entry };
7468
+ const identifiers = device["identifiers"];
7469
+ if (!(Array.isArray(identifiers) && identifiers.some((pair) => Array.isArray(pair) && pair[0] === "mobile_app"))) continue;
7470
+ const name = nonEmptyText(device["name_by_user"]) ?? nonEmptyText(device["name"]);
7471
+ if (name === void 0) continue;
7472
+ names.set(`mobile_app_${slugifyDeviceName(name)}`, name);
7473
+ }
7474
+ return names;
7475
+ }
7415
7476
  /**
7416
7477
  * CRUD over the `ha-notification-targets` record kind.
7417
7478
  *
@@ -7433,7 +7494,7 @@ var HaTargetStore = class HaTargetStore {
7433
7494
  const page = await this.kind.query({ limit: 1e3 });
7434
7495
  const out = [];
7435
7496
  for (const record of page.records) {
7436
- const parsed = require_dist.TargetSchema.safeParse({
7497
+ const parsed = require_ha_broker_source.TargetSchema.safeParse({
7437
7498
  id: record.id,
7438
7499
  ...record.data
7439
7500
  });
@@ -7444,7 +7505,7 @@ var HaTargetStore = class HaTargetStore {
7444
7505
  async getById(id) {
7445
7506
  const row = await this.kind.get(id);
7446
7507
  if (row === null) return null;
7447
- const parsed = require_dist.TargetSchema.safeParse({
7508
+ const parsed = require_ha_broker_source.TargetSchema.safeParse({
7448
7509
  id: row.id,
7449
7510
  ...row.data
7450
7511
  });
@@ -7505,7 +7566,7 @@ function createHaNotificationOutputProvider(deps) {
7505
7566
  }
7506
7567
  /** Degrade → build → publish. NEVER throws through the cap. */
7507
7568
  async function dispatch(target, notification) {
7508
- const prepared = require_dist.prepareNotification(descriptor.caps, notification);
7569
+ const prepared = require_ha_broker_source.prepareNotification(descriptor.caps, notification);
7509
7570
  const service = readService(target.config);
7510
7571
  if (!service) return {
7511
7572
  success: false,
@@ -7529,11 +7590,11 @@ function createHaNotificationOutputProvider(deps) {
7529
7590
  logger?.warn("ha notify publish failed", { meta: {
7530
7591
  brokerId,
7531
7592
  service,
7532
- error: require_dist.errMsg(err)
7593
+ error: require_ha_broker_source.errMsg(err)
7533
7594
  } });
7534
7595
  return {
7535
7596
  success: false,
7536
- error: require_dist.errMsg(err),
7597
+ error: require_ha_broker_source.errMsg(err),
7537
7598
  renderedAs: prepared.renderedAs
7538
7599
  };
7539
7600
  }
@@ -7565,16 +7626,28 @@ function createHaNotificationOutputProvider(deps) {
7565
7626
  },
7566
7627
  discoverTargets: async ({ kind, config }) => {
7567
7628
  if (kind !== "homeassistant") return [];
7629
+ const deviceNamesOf = async (brokerId) => {
7630
+ if (deps.listDevices === void 0) return /* @__PURE__ */ new Map();
7631
+ try {
7632
+ return mobileAppDeviceNames(await deps.listDevices(brokerId));
7633
+ } catch (err) {
7634
+ logger?.warn("ha device registry read failed; naming services from their ids", { meta: {
7635
+ brokerId,
7636
+ error: require_ha_broker_source.errMsg(err)
7637
+ } });
7638
+ return /* @__PURE__ */ new Map();
7639
+ }
7640
+ };
7568
7641
  const explicit = config ? readBrokerId(config) : void 0;
7569
7642
  const brokerIds = explicit ? [explicit] : [...deps.listBrokerIds()];
7570
7643
  const out = [];
7571
7644
  for (const brokerId of brokerIds) try {
7572
7645
  const result = await deps.getServices(brokerId);
7573
- out.push(...parseNotifyServices(result, brokerId));
7646
+ out.push(...parseNotifyServices(result, brokerId, await deviceNamesOf(brokerId)));
7574
7647
  } catch (err) {
7575
7648
  logger?.warn("ha get_services discovery failed", { meta: {
7576
7649
  brokerId,
7577
- error: require_dist.errMsg(err)
7650
+ error: require_ha_broker_source.errMsg(err)
7578
7651
  } });
7579
7652
  }
7580
7653
  return out;
@@ -7652,7 +7725,7 @@ var HaBrokerStore = class HaBrokerStore {
7652
7725
  const resolved = await this.kind.getResolved(record.id);
7653
7726
  if (resolved !== null) data = resolved.data;
7654
7727
  } catch (err) {
7655
- if (!(err instanceof require_dist.RecordSecretUnavailableError)) throw err;
7728
+ if (!(err instanceof require_ha_broker_source.RecordSecretUnavailableError)) throw err;
7656
7729
  }
7657
7730
  const entry = rowToEntry(record.id, data);
7658
7731
  if (entry !== null) out.push(entry);
@@ -7665,7 +7738,7 @@ var HaBrokerStore = class HaBrokerStore {
7665
7738
  if (row === null) return null;
7666
7739
  return rowToEntry(row.id, row.data);
7667
7740
  } catch (err) {
7668
- if (err instanceof require_dist.RecordSecretUnavailableError) return null;
7741
+ if (err instanceof require_ha_broker_source.RecordSecretUnavailableError) return null;
7669
7742
  throw err;
7670
7743
  }
7671
7744
  }
@@ -8027,7 +8100,7 @@ function entityToStandaloneCandidate(entity, alreadyAdopted) {
8027
8100
  return {
8028
8101
  childNativeId: entity.entityId,
8029
8102
  name: entity.name,
8030
- type: entity.mappedTo?.deviceType ?? require_dist.DeviceType.Generic,
8103
+ type: entity.mappedTo?.deviceType ?? require_ha_broker_source.DeviceType.Generic,
8031
8104
  status: entityStatus(entity.state),
8032
8105
  metadata: entity.area !== null ? { externalLocation: entity.area } : {},
8033
8106
  alreadyAdopted,
@@ -8162,7 +8235,7 @@ function readPersistedStandaloneSpec(device) {
8162
8235
  * adoption-proof source field), so it is projected directly here, mirroring the
8163
8236
  * Container's `EnumSensorDateTimeFormatSchema.safeParse` guard. */
8164
8237
  function readDateTimeFormat(config) {
8165
- const parsed = require_dist.EnumSensorDateTimeFormatSchema.safeParse(config["dateTimeFormat"]);
8238
+ const parsed = require_ha_broker_source.EnumSensorDateTimeFormatSchema.safeParse(config["dateTimeFormat"]);
8166
8239
  return parsed.success ? parsed.data : void 0;
8167
8240
  }
8168
8241
  /** Flatten a live device's config into a plain blob for `readHaSource`. */
@@ -8329,12 +8402,12 @@ var DEFAULT_CONFIG = {
8329
8402
  * …) and route HA state pushes into runtime-state slices + cap
8330
8403
  * mutations into HA call_service.
8331
8404
  */
8332
- var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvider {
8405
+ var HaProviderAddon = class HaProviderAddon extends require_ha_broker_source.BaseDeviceProvider {
8333
8406
  addonId = "provider-homeassistant";
8334
8407
  providerName = "Home Assistant";
8335
8408
  deviceClasses = {
8336
- [require_dist.DeviceType.Container]: HaContainerDevice,
8337
- [require_dist.DeviceType.EventEmitter]: HaEventBusDevice
8409
+ [require_ha_broker_source.DeviceType.Container]: HaContainerDevice,
8410
+ [require_ha_broker_source.DeviceType.EventEmitter]: HaEventBusDevice
8338
8411
  };
8339
8412
  async onGetCreationSchema(_type) {
8340
8413
  return null;
@@ -8394,23 +8467,23 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8394
8467
  this.subscribeIntegrationLifecycle();
8395
8468
  return [
8396
8469
  {
8397
- capability: require_dist.brokerCapability,
8470
+ capability: require_ha_broker_source.brokerCapability,
8398
8471
  provider: this.buildBrokerProvider()
8399
8472
  },
8400
8473
  {
8401
- capability: require_dist.deviceAdoptionCapability,
8474
+ capability: require_ha_broker_source.deviceAdoptionCapability,
8402
8475
  provider: this.buildAdoptionProvider()
8403
8476
  },
8404
8477
  {
8405
- capability: require_dist.notificationOutputCapability,
8478
+ capability: require_ha_broker_source.notificationOutputCapability,
8406
8479
  provider: await this.buildNotificationOutputProvider()
8407
8480
  },
8408
8481
  {
8409
- capability: require_dist.addonRoutesCapability,
8482
+ capability: require_ha_broker_source.addonRoutesCapability,
8410
8483
  provider: createHaIconRouteProvider()
8411
8484
  },
8412
8485
  {
8413
- capability: require_dist.calendarSourceCapability,
8486
+ capability: require_ha_broker_source.calendarSourceCapability,
8414
8487
  provider: createHaCalendarSource({
8415
8488
  brokers: this.requireRegistry(),
8416
8489
  logger: this.ctx.logger.child("calendar-source"),
@@ -8439,6 +8512,11 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8439
8512
  if (!manager) throw new Error(`ha-broker '${brokerId}' not found`);
8440
8513
  return manager.sendMessage({ type: "get_services" });
8441
8514
  },
8515
+ listDevices: async (brokerId) => {
8516
+ const manager = this.requireRegistry().getManager(brokerId);
8517
+ if (!manager) throw new Error(`ha-broker '${brokerId}' not found`);
8518
+ return manager.sendMessage({ type: "config/device_registry/list" });
8519
+ },
8442
8520
  listBrokerIds: () => this.activeBrokers.map((b) => b.id),
8443
8521
  logger: this.ctx.logger.child("notification-output")
8444
8522
  });
@@ -8526,7 +8604,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8526
8604
  integrationCount: haIntegrations.length
8527
8605
  } });
8528
8606
  } catch (err) {
8529
- this.ctx.logger.warn("integration→broker reconcile failed", { meta: { error: require_dist.errMsg(err) } });
8607
+ this.ctx.logger.warn("integration→broker reconcile failed", { meta: { error: require_ha_broker_source.errMsg(err) } });
8530
8608
  }
8531
8609
  }
8532
8610
  subscribeIntegrationLifecycle() {
@@ -8587,7 +8665,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8587
8665
  try {
8588
8666
  await this.registry?.shutdown();
8589
8667
  } catch (err) {
8590
- this.ctx.logger.warn("ha provider shutdown error", { meta: { error: require_dist.errMsg(err) } });
8668
+ this.ctx.logger.warn("ha provider shutdown error", { meta: { error: require_ha_broker_source.errMsg(err) } });
8591
8669
  }
8592
8670
  this.registry = null;
8593
8671
  await super.onShutdown();
@@ -8619,7 +8697,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8619
8697
  } catch (err) {
8620
8698
  this.ctx.logger.warn("ha onConfigChanged: removeEntry failed", { meta: {
8621
8699
  brokerId: liveId,
8622
- error: require_dist.errMsg(err)
8700
+ error: require_ha_broker_source.errMsg(err)
8623
8701
  } });
8624
8702
  }
8625
8703
  for (const entry of persisted) {
@@ -8633,7 +8711,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8633
8711
  } catch (err) {
8634
8712
  this.ctx.logger.warn("ha onConfigChanged: updateEntry failed", { meta: {
8635
8713
  brokerId: entry.id,
8636
- error: require_dist.errMsg(err)
8714
+ error: require_ha_broker_source.errMsg(err)
8637
8715
  } });
8638
8716
  }
8639
8717
  continue;
@@ -8654,7 +8732,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8654
8732
  } catch (err) {
8655
8733
  this.ctx.logger.warn("ha onConfigChanged: failed to start new broker", { meta: {
8656
8734
  brokerName: entry.name,
8657
- error: require_dist.errMsg(err)
8735
+ error: require_ha_broker_source.errMsg(err)
8658
8736
  } });
8659
8737
  }
8660
8738
  }
@@ -8804,7 +8882,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8804
8882
  const refreshedAt = Date.now();
8805
8883
  if (lastDiscoveryAt === null || refreshedAt > lastDiscoveryAt) lastDiscoveryAt = refreshedAt;
8806
8884
  } catch (err) {
8807
- lastError = require_dist.errMsg(err);
8885
+ lastError = require_ha_broker_source.errMsg(err);
8808
8886
  }
8809
8887
  const adoptedCount = (await this.ctx.kernel.devices.getAll()).filter((d) => d.parentDeviceId === null && String(d.config.get("system") ?? "") === "homeassistant").length;
8810
8888
  return {
@@ -8950,7 +9028,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8950
9028
  name: deviceName
8951
9029
  };
8952
9030
  const summary = await this.createDevice({
8953
- type: require_dist.DeviceType.Container,
9031
+ type: require_ha_broker_source.DeviceType.Container,
8954
9032
  config: containerConfig
8955
9033
  });
8956
9034
  const accessoryDeviceIds = (await this.ctx.kernel.devices.getChildren(summary.id)).map((c) => c.id);
@@ -8980,7 +9058,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8980
9058
  meta: {
8981
9059
  brokerId,
8982
9060
  haDeviceId,
8983
- error: require_dist.errMsg(err)
9061
+ error: require_ha_broker_source.errMsg(err)
8984
9062
  }
8985
9063
  });
8986
9064
  }
@@ -9127,7 +9205,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9127
9205
  meta: {
9128
9206
  brokerId,
9129
9207
  entityId,
9130
- error: require_dist.errMsg(err)
9208
+ error: require_ha_broker_source.errMsg(err)
9131
9209
  }
9132
9210
  });
9133
9211
  }
@@ -9148,7 +9226,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9148
9226
  */
9149
9227
  async assignImportedLocation(deviceId, externalLocation, knownLocations) {
9150
9228
  try {
9151
- const match = require_dist.bestLocationMatch(externalLocation, knownLocations);
9229
+ const match = require_ha_broker_source.bestLocationMatch(externalLocation, knownLocations);
9152
9230
  const name = match ?? externalLocation;
9153
9231
  let locations = knownLocations;
9154
9232
  if (match === null) {
@@ -9164,7 +9242,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9164
9242
  this.ctx.logger.warn("ha-adoption: location import failed (non-fatal)", { meta: {
9165
9243
  deviceId,
9166
9244
  externalLocation,
9167
- error: require_dist.errMsg(err)
9245
+ error: require_ha_broker_source.errMsg(err)
9168
9246
  } });
9169
9247
  return knownLocations;
9170
9248
  }
@@ -9365,7 +9443,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9365
9443
  } catch (err) {
9366
9444
  this.ctx.logger.warn("ha bus-event aggregator ensure failed", { meta: {
9367
9445
  brokerId,
9368
- error: require_dist.errMsg(err)
9446
+ error: require_ha_broker_source.errMsg(err)
9369
9447
  } });
9370
9448
  }
9371
9449
  await reconcileBroker(brokerId, {
@@ -9375,7 +9453,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9375
9453
  onFetchError: (id, error) => {
9376
9454
  this.ctx.logger.warn("ha re-sync: inventory fetch failed", { meta: {
9377
9455
  brokerId: id,
9378
- error: require_dist.errMsg(error)
9456
+ error: require_ha_broker_source.errMsg(error)
9379
9457
  } });
9380
9458
  }
9381
9459
  });
@@ -9413,7 +9491,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9413
9491
  meta: {
9414
9492
  brokerId,
9415
9493
  haDeviceId,
9416
- error: require_dist.errMsg(err)
9494
+ error: require_ha_broker_source.errMsg(err)
9417
9495
  }
9418
9496
  });
9419
9497
  }
@@ -9458,7 +9536,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9458
9536
  tags: { deviceId: action.deviceId },
9459
9537
  meta: {
9460
9538
  brokerId,
9461
- error: require_dist.errMsg(err)
9539
+ error: require_ha_broker_source.errMsg(err)
9462
9540
  }
9463
9541
  });
9464
9542
  }
@@ -9539,7 +9617,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9539
9617
  brokerId,
9540
9618
  kind: "event-bus"
9541
9619
  }, null, {
9542
- type: require_dist.DeviceType.EventEmitter,
9620
+ type: require_ha_broker_source.DeviceType.EventEmitter,
9543
9621
  name: "Home Assistant Events"
9544
9622
  });
9545
9623
  this.eventBusDeviceIds.set(brokerId, device.id);
@@ -9569,7 +9647,7 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
9569
9647
  this.ctx.logger.debug("ha bus-event dropped — aggregator not ready", { meta: {
9570
9648
  brokerId,
9571
9649
  eventType: ev.eventType,
9572
- error: require_dist.errMsg(err)
9650
+ error: require_ha_broker_source.errMsg(err)
9573
9651
  } });
9574
9652
  return;
9575
9653
  }