@camstack/addon-provider-homeassistant 1.2.170 → 1.2.172

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-B7c8ebLd.js");
2
+ const require_dist = require("./dist-Ba9raKow.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
@@ -5744,18 +5744,22 @@ var HaBrokerRegistry = class {
5744
5744
  var haBrokerSettingsSchema = { sections: [{
5745
5745
  id: "ha-broker-credentials",
5746
5746
  title: "Home Assistant connection",
5747
+ titleKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.title",
5747
5748
  columns: 1,
5748
5749
  fields: [
5749
5750
  {
5750
5751
  type: "select",
5751
5752
  key: "authKind",
5752
5753
  label: "Auth mode",
5754
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.label",
5753
5755
  options: [{
5754
5756
  value: "long-lived",
5755
- label: "Long-lived token"
5757
+ label: "Long-lived token",
5758
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.o_long-lived.label"
5756
5759
  }, {
5757
5760
  value: "supervisor",
5758
- label: "Supervisor (HA add-on)"
5761
+ label: "Supervisor (HA add-on)",
5762
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.o_supervisor.label"
5759
5763
  }],
5760
5764
  default: "long-lived"
5761
5765
  },
@@ -5763,6 +5767,7 @@ var haBrokerSettingsSchema = { sections: [{
5763
5767
  type: "text",
5764
5768
  key: "baseUrl",
5765
5769
  label: "HA base URL",
5770
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.baseUrl.label",
5766
5771
  placeholder: "https://hassio.local:8123",
5767
5772
  showWhen: {
5768
5773
  field: "authKind",
@@ -5773,6 +5778,7 @@ var haBrokerSettingsSchema = { sections: [{
5773
5778
  type: "password",
5774
5779
  key: "accessToken",
5775
5780
  label: "Long-lived access token",
5781
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.accessToken.label",
5776
5782
  showToggle: true,
5777
5783
  showWhen: {
5778
5784
  field: "authKind",
@@ -5783,6 +5789,7 @@ var haBrokerSettingsSchema = { sections: [{
5783
5789
  type: "password",
5784
5790
  key: "supervisorToken",
5785
5791
  label: "Supervisor token",
5792
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.supervisorToken.label",
5786
5793
  showToggle: true,
5787
5794
  showWhen: {
5788
5795
  field: "authKind",
@@ -5935,18 +5942,33 @@ function mapLock(attributes) {
5935
5942
  features
5936
5943
  };
5937
5944
  }
5938
- function mapCover(attributes, _deviceClass) {
5945
+ function mapCover(attributes, deviceClass) {
5939
5946
  const features = [];
5940
5947
  const sf = readNumericAttr(attributes, "supported_features");
5941
5948
  if (sf !== null && (sf & 4) !== 0) features.push(require_dist.DeviceFeature.CoverPositionable);
5942
5949
  if (sf !== null && (sf & 128) !== 0) features.push(require_dist.DeviceFeature.CoverTilt);
5943
5950
  return {
5944
5951
  deviceType: require_dist.DeviceType.Cover,
5945
- role: null,
5952
+ role: coverRoleFor(deviceClass),
5946
5953
  capabilities: ["cover"],
5947
5954
  features
5948
5955
  };
5949
5956
  }
5957
+ /** The cover KIND for an HA cover `device_class`; null for none / `damper`. */
5958
+ function coverRoleFor(deviceClass) {
5959
+ switch (deviceClass) {
5960
+ case "blind":
5961
+ case "shade": return require_dist.DeviceRole.CoverBlind;
5962
+ case "shutter": return require_dist.DeviceRole.CoverShutter;
5963
+ case "awning": return require_dist.DeviceRole.CoverAwning;
5964
+ case "curtain": return require_dist.DeviceRole.CoverCurtain;
5965
+ case "garage": return require_dist.DeviceRole.CoverGarage;
5966
+ case "gate": return require_dist.DeviceRole.CoverGate;
5967
+ case "door": return require_dist.DeviceRole.CoverDoor;
5968
+ case "window": return require_dist.DeviceRole.CoverWindow;
5969
+ default: return null;
5970
+ }
5971
+ }
5950
5972
  function mapValve(attributes, _deviceClass) {
5951
5973
  const features = [];
5952
5974
  const sf = readNumericAttr(attributes, "supported_features");
@@ -6796,18 +6818,23 @@ function haConfigSchema() {
6796
6818
  return { sections: [{
6797
6819
  id: "connection",
6798
6820
  title: "Home Assistant notify",
6821
+ titleKey: "provider-homeassistant:haConfig.s_connection.title",
6799
6822
  fields: [{
6800
6823
  type: "text",
6801
6824
  key: "service",
6802
6825
  label: "Notify service",
6826
+ labelKey: "provider-homeassistant:haConfig.s_connection.service.label",
6803
6827
  required: true,
6804
6828
  placeholder: "mobile_app_pixel_7",
6805
- description: "The Home Assistant notify service to call — the part after `notify.` (e.g. `mobile_app_pixel_7`). Use Discover to list available services."
6829
+ description: "The Home Assistant notify service to call — the part after `notify.` (e.g. `mobile_app_pixel_7`). Use Discover to list available services.",
6830
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.service.description"
6806
6831
  }, {
6807
6832
  type: "text",
6808
6833
  key: "brokerId",
6809
6834
  label: "Broker",
6810
- description: "Optional — the Home Assistant broker id to route through. Leave blank to use the only configured broker."
6835
+ labelKey: "provider-homeassistant:haConfig.s_connection.brokerId.label",
6836
+ description: "Optional — the Home Assistant broker id to route through. Leave blank to use the only configured broker.",
6837
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.brokerId.description"
6811
6838
  }]
6812
6839
  }] };
6813
6840
  }
@@ -7290,7 +7317,7 @@ function formatHaError(err) {
7290
7317
  }
7291
7318
  function parseHaDate(value) {
7292
7319
  if (typeof value !== "string" || value.length === 0) return null;
7293
- const normalised = value.length === 10 ? `${value}T00:00:00` : value.includes("T") ? value : value.replace(" ", "T");
7320
+ const normalised = value.length === 10 ? `${value}T00:00:00.000Z` : value.includes("T") ? value : value.replace(" ", "T");
7294
7321
  const ms = Date.parse(normalised);
7295
7322
  return Number.isFinite(ms) ? ms : null;
7296
7323
  }
@@ -8103,26 +8130,33 @@ var HaProviderAddon = class HaProviderAddon extends require_dist.BaseDeviceProvi
8103
8130
  if (cap === "calendar-source") return this.schema({ sections: [{
8104
8131
  id: "ha-calendars-import",
8105
8132
  title: "Calendars to import",
8133
+ titleKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.title",
8106
8134
  description: "Pick which Home Assistant calendar entities feed System → Calendars. Nothing selected = no calendars imported.",
8135
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.description",
8107
8136
  columns: 1,
8108
8137
  fields: [{
8109
8138
  type: "multiselect",
8110
8139
  key: "calendarIds",
8111
8140
  label: "Calendars",
8141
+ labelKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.calendarIds.label",
8112
8142
  options: [],
8113
8143
  optionsFrom: "_calendarCatalog",
8114
- description: "Discovered from connected HA brokers. Select at least one to import; leave empty to import none."
8144
+ description: "Discovered from connected HA brokers. Select at least one to import; leave empty to import none.",
8145
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.calendarIds.description"
8115
8146
  }]
8116
8147
  }] });
8117
8148
  return this.schema({ sections: [{
8118
8149
  id: "ha-broker",
8119
8150
  title: "Home Assistant broker",
8151
+ titleKey: "provider-homeassistant:globalSettings.s_ha-broker.title",
8120
8152
  description: "Home Assistant brokers are managed in Connectivity → Brokers.",
8153
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-broker.description",
8121
8154
  columns: 1,
8122
8155
  fields: [{
8123
8156
  type: "info",
8124
8157
  key: "brokerHelp",
8125
8158
  label: "Brokers are managed separately",
8159
+ labelKey: "provider-homeassistant:globalSettings.s_ha-broker.brokerHelp.label",
8126
8160
  content: "This integration links to a Home Assistant broker. Add, edit, or remove brokers from Connectivity → Brokers. The integration only stores a reference to its broker — no credentials are kept here."
8127
8161
  }]
8128
8162
  }] });
package/dist/addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as connectivityCapability, At as record, B as floodCapability, C as buildAddonRouteProvider, Ct as _enum, D as carbonMonoxideCapability, Dt as literal, E as calendarSourceCapability, Et as discriminatedUnion, F as deviceAdoptionCapability, Ft as EventCategory, G as lawnMowerControlCapability, H as humidifierCapability, J as motionCapability, K as lockControlCapability, L as enumSensorCapability, M as controlCapability, Mt as union, N as coverCapability, Nt as unknown, O as climateControlCapability, Ot as number, P as deviceAdminLinkCapability, Pt as url, Q as numericSensorCapability, R as eventEmitterCapability, S as brokerCapability, T as buttonCapability, Tt as boolean, U as humiditySensorCapability, V as gasCapability, W as imageCapability, X as notificationOutputCapability, Y as normalizeUnit, Z as notifierCapability, _ as automationControlCapability, _t as DeviceRole, at as scriptRunnerCapability, b as binaryCapability, ct as tamperCapability, d as TargetSchema, dt as vacuumControlCapability, et as parseAdminBase, f as accessoriesCapability, ft as valveCapability, g as ambientLightSensorCapability, gt as DeviceFeature, h as alarmPanelCapability, ht as weatherCapability, it as pressureSensorCapability, j as contactCapability, jt as string, k as colorCapability, kt as object, lt as temperatureSensorCapability, m as airQualitySensorCapability, mt as waterHeaterCapability, n as BaseDevice, nt as prepareNotification, ot as smokeCapability, p as addonRoutesCapability, pt as vibrationCapability, q as mediaPlayerCapability, r as BaseDeviceProvider, rt as presenceCapability, s as EnumSensorDateTimeFormatSchema, st as switchCapability, tt as powerMeterCapability, ut as updateCapability, v as batteryCapability, vt as DeviceType, w as buildDeviceAdminUrl, wt as array, x as brightnessCapability, xt as createEvent, y as bestLocationMatch, yt as errMsg, z as fanControlCapability } from "./dist-BaG2A4xn.mjs";
1
+ import { A as connectivityCapability, At as record, B as floodCapability, C as buildAddonRouteProvider, Ct as _enum, D as carbonMonoxideCapability, Dt as literal, E as calendarSourceCapability, Et as discriminatedUnion, F as deviceAdoptionCapability, Ft as EventCategory, G as lawnMowerControlCapability, H as humidifierCapability, J as motionCapability, K as lockControlCapability, L as enumSensorCapability, M as controlCapability, Mt as union, N as coverCapability, Nt as unknown, O as climateControlCapability, Ot as number, P as deviceAdminLinkCapability, Pt as url, Q as numericSensorCapability, R as eventEmitterCapability, S as brokerCapability, T as buttonCapability, Tt as boolean, U as humiditySensorCapability, V as gasCapability, W as imageCapability, X as notificationOutputCapability, Y as normalizeUnit, Z as notifierCapability, _ as automationControlCapability, _t as DeviceRole, at as scriptRunnerCapability, b as binaryCapability, ct as tamperCapability, d as TargetSchema, dt as vacuumControlCapability, et as parseAdminBase, f as accessoriesCapability, ft as valveCapability, g as ambientLightSensorCapability, gt as DeviceFeature, h as alarmPanelCapability, ht as weatherCapability, it as pressureSensorCapability, j as contactCapability, jt as string, k as colorCapability, kt as object, lt as temperatureSensorCapability, m as airQualitySensorCapability, mt as waterHeaterCapability, n as BaseDevice, nt as prepareNotification, ot as smokeCapability, p as addonRoutesCapability, pt as vibrationCapability, q as mediaPlayerCapability, r as BaseDeviceProvider, rt as presenceCapability, s as EnumSensorDateTimeFormatSchema, st as switchCapability, tt as powerMeterCapability, ut as updateCapability, v as batteryCapability, vt as DeviceType, w as buildDeviceAdminUrl, wt as array, x as brightnessCapability, xt as createEvent, y as bestLocationMatch, yt as errMsg, z as fanControlCapability } from "./dist-B9xf8_Ix.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
4
4
  //#region src/ha-admin-link.ts
@@ -5743,18 +5743,22 @@ var HaBrokerRegistry = class {
5743
5743
  var haBrokerSettingsSchema = { sections: [{
5744
5744
  id: "ha-broker-credentials",
5745
5745
  title: "Home Assistant connection",
5746
+ titleKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.title",
5746
5747
  columns: 1,
5747
5748
  fields: [
5748
5749
  {
5749
5750
  type: "select",
5750
5751
  key: "authKind",
5751
5752
  label: "Auth mode",
5753
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.label",
5752
5754
  options: [{
5753
5755
  value: "long-lived",
5754
- label: "Long-lived token"
5756
+ label: "Long-lived token",
5757
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.o_long-lived.label"
5755
5758
  }, {
5756
5759
  value: "supervisor",
5757
- label: "Supervisor (HA add-on)"
5760
+ label: "Supervisor (HA add-on)",
5761
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.authKind.o_supervisor.label"
5758
5762
  }],
5759
5763
  default: "long-lived"
5760
5764
  },
@@ -5762,6 +5766,7 @@ var haBrokerSettingsSchema = { sections: [{
5762
5766
  type: "text",
5763
5767
  key: "baseUrl",
5764
5768
  label: "HA base URL",
5769
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.baseUrl.label",
5765
5770
  placeholder: "https://hassio.local:8123",
5766
5771
  showWhen: {
5767
5772
  field: "authKind",
@@ -5772,6 +5777,7 @@ var haBrokerSettingsSchema = { sections: [{
5772
5777
  type: "password",
5773
5778
  key: "accessToken",
5774
5779
  label: "Long-lived access token",
5780
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.accessToken.label",
5775
5781
  showToggle: true,
5776
5782
  showWhen: {
5777
5783
  field: "authKind",
@@ -5782,6 +5788,7 @@ var haBrokerSettingsSchema = { sections: [{
5782
5788
  type: "password",
5783
5789
  key: "supervisorToken",
5784
5790
  label: "Supervisor token",
5791
+ labelKey: "provider-homeassistant:haBrokerSettings.s_ha-broker-credentials.supervisorToken.label",
5785
5792
  showToggle: true,
5786
5793
  showWhen: {
5787
5794
  field: "authKind",
@@ -5934,18 +5941,33 @@ function mapLock(attributes) {
5934
5941
  features
5935
5942
  };
5936
5943
  }
5937
- function mapCover(attributes, _deviceClass) {
5944
+ function mapCover(attributes, deviceClass) {
5938
5945
  const features = [];
5939
5946
  const sf = readNumericAttr(attributes, "supported_features");
5940
5947
  if (sf !== null && (sf & 4) !== 0) features.push(DeviceFeature.CoverPositionable);
5941
5948
  if (sf !== null && (sf & 128) !== 0) features.push(DeviceFeature.CoverTilt);
5942
5949
  return {
5943
5950
  deviceType: DeviceType.Cover,
5944
- role: null,
5951
+ role: coverRoleFor(deviceClass),
5945
5952
  capabilities: ["cover"],
5946
5953
  features
5947
5954
  };
5948
5955
  }
5956
+ /** The cover KIND for an HA cover `device_class`; null for none / `damper`. */
5957
+ function coverRoleFor(deviceClass) {
5958
+ switch (deviceClass) {
5959
+ case "blind":
5960
+ case "shade": return DeviceRole.CoverBlind;
5961
+ case "shutter": return DeviceRole.CoverShutter;
5962
+ case "awning": return DeviceRole.CoverAwning;
5963
+ case "curtain": return DeviceRole.CoverCurtain;
5964
+ case "garage": return DeviceRole.CoverGarage;
5965
+ case "gate": return DeviceRole.CoverGate;
5966
+ case "door": return DeviceRole.CoverDoor;
5967
+ case "window": return DeviceRole.CoverWindow;
5968
+ default: return null;
5969
+ }
5970
+ }
5949
5971
  function mapValve(attributes, _deviceClass) {
5950
5972
  const features = [];
5951
5973
  const sf = readNumericAttr(attributes, "supported_features");
@@ -6795,18 +6817,23 @@ function haConfigSchema() {
6795
6817
  return { sections: [{
6796
6818
  id: "connection",
6797
6819
  title: "Home Assistant notify",
6820
+ titleKey: "provider-homeassistant:haConfig.s_connection.title",
6798
6821
  fields: [{
6799
6822
  type: "text",
6800
6823
  key: "service",
6801
6824
  label: "Notify service",
6825
+ labelKey: "provider-homeassistant:haConfig.s_connection.service.label",
6802
6826
  required: true,
6803
6827
  placeholder: "mobile_app_pixel_7",
6804
- description: "The Home Assistant notify service to call — the part after `notify.` (e.g. `mobile_app_pixel_7`). Use Discover to list available services."
6828
+ description: "The Home Assistant notify service to call — the part after `notify.` (e.g. `mobile_app_pixel_7`). Use Discover to list available services.",
6829
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.service.description"
6805
6830
  }, {
6806
6831
  type: "text",
6807
6832
  key: "brokerId",
6808
6833
  label: "Broker",
6809
- description: "Optional — the Home Assistant broker id to route through. Leave blank to use the only configured broker."
6834
+ labelKey: "provider-homeassistant:haConfig.s_connection.brokerId.label",
6835
+ description: "Optional — the Home Assistant broker id to route through. Leave blank to use the only configured broker.",
6836
+ descriptionKey: "provider-homeassistant:haConfig.s_connection.brokerId.description"
6810
6837
  }]
6811
6838
  }] };
6812
6839
  }
@@ -7289,7 +7316,7 @@ function formatHaError(err) {
7289
7316
  }
7290
7317
  function parseHaDate(value) {
7291
7318
  if (typeof value !== "string" || value.length === 0) return null;
7292
- const normalised = value.length === 10 ? `${value}T00:00:00` : value.includes("T") ? value : value.replace(" ", "T");
7319
+ const normalised = value.length === 10 ? `${value}T00:00:00.000Z` : value.includes("T") ? value : value.replace(" ", "T");
7293
7320
  const ms = Date.parse(normalised);
7294
7321
  return Number.isFinite(ms) ? ms : null;
7295
7322
  }
@@ -8102,26 +8129,33 @@ var HaProviderAddon = class HaProviderAddon extends BaseDeviceProvider {
8102
8129
  if (cap === "calendar-source") return this.schema({ sections: [{
8103
8130
  id: "ha-calendars-import",
8104
8131
  title: "Calendars to import",
8132
+ titleKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.title",
8105
8133
  description: "Pick which Home Assistant calendar entities feed System → Calendars. Nothing selected = no calendars imported.",
8134
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.description",
8106
8135
  columns: 1,
8107
8136
  fields: [{
8108
8137
  type: "multiselect",
8109
8138
  key: "calendarIds",
8110
8139
  label: "Calendars",
8140
+ labelKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.calendarIds.label",
8111
8141
  options: [],
8112
8142
  optionsFrom: "_calendarCatalog",
8113
- description: "Discovered from connected HA brokers. Select at least one to import; leave empty to import none."
8143
+ description: "Discovered from connected HA brokers. Select at least one to import; leave empty to import none.",
8144
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-calendars-import.calendarIds.description"
8114
8145
  }]
8115
8146
  }] });
8116
8147
  return this.schema({ sections: [{
8117
8148
  id: "ha-broker",
8118
8149
  title: "Home Assistant broker",
8150
+ titleKey: "provider-homeassistant:globalSettings.s_ha-broker.title",
8119
8151
  description: "Home Assistant brokers are managed in Connectivity → Brokers.",
8152
+ descriptionKey: "provider-homeassistant:globalSettings.s_ha-broker.description",
8120
8153
  columns: 1,
8121
8154
  fields: [{
8122
8155
  type: "info",
8123
8156
  key: "brokerHelp",
8124
8157
  label: "Brokers are managed separately",
8158
+ labelKey: "provider-homeassistant:globalSettings.s_ha-broker.brokerHelp.label",
8125
8159
  content: "This integration links to a Home Assistant broker. Add, edit, or remove brokers from Connectivity → Brokers. The integration only stores a reference to its broker — no credentials are kept here."
8126
8160
  }]
8127
8161
  }] });