@camstack/addon-provider-homeassistant 1.2.161 → 1.2.163

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.
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  //#endregion
6
- const require_dist = require("../dist-C3T2aMHG.js");
6
+ const require_dist = require("../dist-D4ygl7eZ.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  /** The `BrokerInfo.kind` tag the Home Assistant provider stamps. */
9
9
  var HA_BROKER_KIND = "home-assistant";
@@ -4414,6 +4414,16 @@ function verifyExpiringUrl(input) {
4414
4414
  * an expired link is refused whether or not its signature is valid, so a leaked
4415
4415
  * URL stops working on its own.
4416
4416
  */
4417
+ /**
4418
+ * The base a media link is minted on when the operator left the addon's own
4419
+ * field empty: the hub's `internal` role (D734) — the address flagged
4420
+ * "Internal" on the Network page, else the detected LAN address. Home
4421
+ * Assistant is a LAN device pulling from the hub, so never the public
4422
+ * endpoint, and never loopback (`null` when nothing qualifies).
4423
+ */
4424
+ function haMediaBaseUrl(book) {
4425
+ return book.roles.internal.resolved;
4426
+ }
4417
4427
  /** How long a minted link stays valid. Long enough for HA to render it. */
4418
4428
  var MEDIA_URL_TTL_MS = 360 * 60 * 1e3;
4419
4429
  function signMedia(secret, id, expMs) {
@@ -7884,15 +7894,7 @@ var HaExportAddon = class extends require_dist.BaseAddon {
7884
7894
  return;
7885
7895
  }
7886
7896
  try {
7887
- /**
7888
- * Home Assistant is a LAN device pulling from the hub: the `agents`
7889
- * role (the address flagged "Agents" on the Network page, else the
7890
- * detected LAN address), never loopback — a link Home Assistant
7891
- * cannot open is worse than no image, because it renders as a broken
7892
- * entity rather than an empty one. Ranked by `local-network`, never here.
7893
- */
7894
- const { roles } = await this.ctx.api.localNetwork.getAddresses.query();
7895
- this.mediaBaseUrl = roles.agents.resolved;
7897
+ this.mediaBaseUrl = haMediaBaseUrl(await this.ctx.api.localNetwork.getAddresses.query());
7896
7898
  } catch (err) {
7897
7899
  this.mediaBaseUrl = null;
7898
7900
  this.ctx.logger.debug("ha-export: could not resolve a media base URL", { meta: { error: errMsg(err) } });
@@ -7936,36 +7938,47 @@ var HaExportAddon = class extends require_dist.BaseAddon {
7936
7938
  style: "switch",
7937
7939
  default: false
7938
7940
  }));
7939
- return { sections: [{
7940
- id: "ha-export-brokers",
7941
- title: "Home Assistant instances",
7942
- description: brokerFields.length > 0 ? "One switch per Home Assistant broker. An instance that is off receives nothing; the devices exported to it are remembered and resume when it is turned back on." : "No Home Assistant broker is registered yet. Add one under External systems → Brokers and it will appear here.",
7943
- columns: 1,
7944
- fields: brokerFields.length > 0 ? brokerFields : [{
7945
- type: "info",
7946
- key: "ha-export:__no-brokers",
7947
- label: "No brokers",
7948
- content: "Register a Home Assistant broker to enable the export.",
7949
- variant: "warning"
7950
- }]
7951
- }, {
7952
- id: "ha-export-transport",
7953
- title: "Transport",
7954
- columns: 1,
7955
- fields: [{
7956
- type: "text",
7957
- key: "publicBaseUrl",
7958
- label: "Hub URL Home Assistant can reach",
7959
- description: "Used to build the signed image links Home Assistant fetches. Leave empty to derive one from the network capabilities; a link that cannot be built is never sent.",
7960
- default: ""
7961
- }, {
7962
- type: "number",
7963
- key: "reconcileIntervalSec",
7964
- label: "Reconcile interval (s)",
7965
- description: "Full re-announce and re-push cadence. Bus events are telemetry and may be dropped; this is the contract.",
7966
- default: DEFAULT_CONFIG.reconcileIntervalSec
7967
- }]
7968
- }] };
7941
+ return { sections: [
7942
+ {
7943
+ id: "ha-export-brokers",
7944
+ title: "Home Assistant instances",
7945
+ description: brokerFields.length > 0 ? "One switch per Home Assistant broker. An instance that is off receives nothing; the devices exported to it are remembered and resume when it is turned back on." : "No Home Assistant broker is registered yet. Add one under External systems → Brokers and it will appear here.",
7946
+ columns: 1,
7947
+ fields: brokerFields.length > 0 ? brokerFields : [{
7948
+ type: "info",
7949
+ key: "ha-export:__no-brokers",
7950
+ label: "No brokers",
7951
+ content: "Register a Home Assistant broker to enable the export.",
7952
+ variant: "warning"
7953
+ }]
7954
+ },
7955
+ {
7956
+ id: "ha-export-transport",
7957
+ title: "Connection",
7958
+ columns: 1,
7959
+ fields: [{
7960
+ type: "text",
7961
+ key: "publicBaseUrl",
7962
+ label: "Hub URL Home Assistant can reach",
7963
+ description: "Used to build the signed image links Home Assistant fetches. Leave empty to derive one from the network capabilities; a link that cannot be built is never sent.",
7964
+ default: ""
7965
+ }]
7966
+ },
7967
+ {
7968
+ id: "ha-export-advanced",
7969
+ title: "Advanced",
7970
+ style: "accordion",
7971
+ defaultCollapsed: true,
7972
+ columns: 1,
7973
+ fields: [{
7974
+ type: "number",
7975
+ key: "reconcileIntervalSec",
7976
+ label: "Reconcile interval (s)",
7977
+ description: "Full re-announce and re-push cadence. Bus events are telemetry and may be dropped; this is the contract.",
7978
+ default: DEFAULT_CONFIG.reconcileIntervalSec
7979
+ }]
7980
+ }
7981
+ ] };
7969
7982
  }
7970
7983
  /**
7971
7984
  * Per-device Export panel — one switch PER BROKER.
@@ -1,4 +1,4 @@
1
- import { $ as oauthIntegrationCapability, C as buildAddonRouteProvider, Ft as EventCategory, I as deviceExportCapability, St as nodePin, a as COCO_TO_MACRO, bt as BaseAddon, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, jt as string, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema } from "../dist-B1FEp9mY.mjs";
1
+ import { $ as oauthIntegrationCapability, C as buildAddonRouteProvider, Ft as EventCategory, I as deviceExportCapability, St as nodePin, a as COCO_TO_MACRO, bt as BaseAddon, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, jt as string, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema } from "../dist-CDvVJ5hh.mjs";
2
2
  import { createHmac, timingSafeEqual } from "node:crypto";
3
3
  /** The `BrokerInfo.kind` tag the Home Assistant provider stamps. */
4
4
  var HA_BROKER_KIND = "home-assistant";
@@ -4409,6 +4409,16 @@ function verifyExpiringUrl(input) {
4409
4409
  * an expired link is refused whether or not its signature is valid, so a leaked
4410
4410
  * URL stops working on its own.
4411
4411
  */
4412
+ /**
4413
+ * The base a media link is minted on when the operator left the addon's own
4414
+ * field empty: the hub's `internal` role (D734) — the address flagged
4415
+ * "Internal" on the Network page, else the detected LAN address. Home
4416
+ * Assistant is a LAN device pulling from the hub, so never the public
4417
+ * endpoint, and never loopback (`null` when nothing qualifies).
4418
+ */
4419
+ function haMediaBaseUrl(book) {
4420
+ return book.roles.internal.resolved;
4421
+ }
4412
4422
  /** How long a minted link stays valid. Long enough for HA to render it. */
4413
4423
  var MEDIA_URL_TTL_MS = 360 * 60 * 1e3;
4414
4424
  function signMedia(secret, id, expMs) {
@@ -7879,15 +7889,7 @@ var HaExportAddon = class extends BaseAddon {
7879
7889
  return;
7880
7890
  }
7881
7891
  try {
7882
- /**
7883
- * Home Assistant is a LAN device pulling from the hub: the `agents`
7884
- * role (the address flagged "Agents" on the Network page, else the
7885
- * detected LAN address), never loopback — a link Home Assistant
7886
- * cannot open is worse than no image, because it renders as a broken
7887
- * entity rather than an empty one. Ranked by `local-network`, never here.
7888
- */
7889
- const { roles } = await this.ctx.api.localNetwork.getAddresses.query();
7890
- this.mediaBaseUrl = roles.agents.resolved;
7892
+ this.mediaBaseUrl = haMediaBaseUrl(await this.ctx.api.localNetwork.getAddresses.query());
7891
7893
  } catch (err) {
7892
7894
  this.mediaBaseUrl = null;
7893
7895
  this.ctx.logger.debug("ha-export: could not resolve a media base URL", { meta: { error: errMsg(err) } });
@@ -7931,36 +7933,47 @@ var HaExportAddon = class extends BaseAddon {
7931
7933
  style: "switch",
7932
7934
  default: false
7933
7935
  }));
7934
- return { sections: [{
7935
- id: "ha-export-brokers",
7936
- title: "Home Assistant instances",
7937
- description: brokerFields.length > 0 ? "One switch per Home Assistant broker. An instance that is off receives nothing; the devices exported to it are remembered and resume when it is turned back on." : "No Home Assistant broker is registered yet. Add one under External systems → Brokers and it will appear here.",
7938
- columns: 1,
7939
- fields: brokerFields.length > 0 ? brokerFields : [{
7940
- type: "info",
7941
- key: "ha-export:__no-brokers",
7942
- label: "No brokers",
7943
- content: "Register a Home Assistant broker to enable the export.",
7944
- variant: "warning"
7945
- }]
7946
- }, {
7947
- id: "ha-export-transport",
7948
- title: "Transport",
7949
- columns: 1,
7950
- fields: [{
7951
- type: "text",
7952
- key: "publicBaseUrl",
7953
- label: "Hub URL Home Assistant can reach",
7954
- description: "Used to build the signed image links Home Assistant fetches. Leave empty to derive one from the network capabilities; a link that cannot be built is never sent.",
7955
- default: ""
7956
- }, {
7957
- type: "number",
7958
- key: "reconcileIntervalSec",
7959
- label: "Reconcile interval (s)",
7960
- description: "Full re-announce and re-push cadence. Bus events are telemetry and may be dropped; this is the contract.",
7961
- default: DEFAULT_CONFIG.reconcileIntervalSec
7962
- }]
7963
- }] };
7936
+ return { sections: [
7937
+ {
7938
+ id: "ha-export-brokers",
7939
+ title: "Home Assistant instances",
7940
+ description: brokerFields.length > 0 ? "One switch per Home Assistant broker. An instance that is off receives nothing; the devices exported to it are remembered and resume when it is turned back on." : "No Home Assistant broker is registered yet. Add one under External systems → Brokers and it will appear here.",
7941
+ columns: 1,
7942
+ fields: brokerFields.length > 0 ? brokerFields : [{
7943
+ type: "info",
7944
+ key: "ha-export:__no-brokers",
7945
+ label: "No brokers",
7946
+ content: "Register a Home Assistant broker to enable the export.",
7947
+ variant: "warning"
7948
+ }]
7949
+ },
7950
+ {
7951
+ id: "ha-export-transport",
7952
+ title: "Connection",
7953
+ columns: 1,
7954
+ fields: [{
7955
+ type: "text",
7956
+ key: "publicBaseUrl",
7957
+ label: "Hub URL Home Assistant can reach",
7958
+ description: "Used to build the signed image links Home Assistant fetches. Leave empty to derive one from the network capabilities; a link that cannot be built is never sent.",
7959
+ default: ""
7960
+ }]
7961
+ },
7962
+ {
7963
+ id: "ha-export-advanced",
7964
+ title: "Advanced",
7965
+ style: "accordion",
7966
+ defaultCollapsed: true,
7967
+ columns: 1,
7968
+ fields: [{
7969
+ type: "number",
7970
+ key: "reconcileIntervalSec",
7971
+ label: "Reconcile interval (s)",
7972
+ description: "Full re-announce and re-push cadence. Bus events are telemetry and may be dropped; this is the contract.",
7973
+ default: DEFAULT_CONFIG.reconcileIntervalSec
7974
+ }]
7975
+ }
7976
+ ] };
7964
7977
  }
7965
7978
  /**
7966
7979
  * Per-device Export panel — one switch PER BROKER.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.161",
3
+ "version": "1.2.163",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",