@camstack/addon-provider-homeassistant 1.2.659 → 1.2.661
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/CHANGELOG.md +12 -0
- package/dist/addon.js +666 -553
- package/dist/addon.mjs +197 -84
- package/dist/ha-export/ha-export.addon.js +77 -71
- package/dist/ha-export/ha-export.addon.mjs +8 -2
- package/dist/{ha-instance-settings-CRvQ5rH6.js → legacy-integration-rows-B_X4VL29.js} +94 -65
- package/dist/{ha-instance-settings-qhCNJbbn.mjs → legacy-integration-rows-Bhvthv-s.mjs} +94 -65
- package/package.json +2 -2
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
|
-
const
|
|
27
|
+
const require_legacy_integration_rows = require("../legacy-integration-rows-B_X4VL29.js");
|
|
28
28
|
let node_crypto = require("node:crypto");
|
|
29
29
|
require("node:zlib");
|
|
30
30
|
let node_fs = require("node:fs");
|
|
@@ -91,7 +91,7 @@ async function applyCameraFunctionWrite(api, deviceId, write, sourceNodeId) {
|
|
|
91
91
|
await api.streamBroker.setDeviceAudioMute.mutate({
|
|
92
92
|
deviceId,
|
|
93
93
|
muted: write.muted
|
|
94
|
-
},
|
|
94
|
+
}, require_legacy_integration_rows.nodePin(sourceNodeId));
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -725,8 +725,8 @@ function consumableEntity(key, facet) {
|
|
|
725
725
|
* rather than to an icon for nothing.
|
|
726
726
|
*/
|
|
727
727
|
function consumableForm(item) {
|
|
728
|
-
const declared =
|
|
729
|
-
return
|
|
728
|
+
const declared = require_legacy_integration_rows.ConsumableFormSchema.safeParse(item.form);
|
|
729
|
+
return require_legacy_integration_rows.consumableFormOf({
|
|
730
730
|
...item.kind !== void 0 ? { kind: item.kind } : {},
|
|
731
731
|
...declared.success ? { form: declared.data } : {}
|
|
732
732
|
});
|
|
@@ -739,7 +739,7 @@ function partIcon(key, label) {
|
|
|
739
739
|
function formIcon(item, form) {
|
|
740
740
|
switch (form) {
|
|
741
741
|
case "part": return partIcon(item.key, item.label);
|
|
742
|
-
case "tank": return
|
|
742
|
+
case "tank": return require_legacy_integration_rows.consumableKindOf(item) === "waste" ? "mdi:water-off" : "mdi:water";
|
|
743
743
|
case "product": return "mdi:shaker-outline";
|
|
744
744
|
case "bin": return "mdi:delete";
|
|
745
745
|
}
|
|
@@ -750,8 +750,8 @@ function formIcon(item, form) {
|
|
|
750
750
|
* form this export does not know degrades one icon instead of refusing the
|
|
751
751
|
* whole slice.
|
|
752
752
|
*/
|
|
753
|
-
var ExportConsumableItemSchema =
|
|
754
|
-
var ExportConsumablesSchema =
|
|
753
|
+
var ExportConsumableItemSchema = require_legacy_integration_rows.ConsumableItemSchema.extend({ form: require_legacy_integration_rows.unknown().optional() });
|
|
754
|
+
var ExportConsumablesSchema = require_legacy_integration_rows.object({ items: require_legacy_integration_rows.array(ExportConsumableItemSchema) });
|
|
755
755
|
/**
|
|
756
756
|
* A worn part's life is a diagnostic; a tank's fill is what the device page
|
|
757
757
|
* is for (a vacuum's clean water, a dishwasher's salt), so it is not hidden.
|
|
@@ -764,7 +764,7 @@ function consumableEntities(item) {
|
|
|
764
764
|
capName: "consumables",
|
|
765
765
|
itemKey: item.key
|
|
766
766
|
};
|
|
767
|
-
const kind =
|
|
767
|
+
const kind = require_legacy_integration_rows.consumableKindOf(item);
|
|
768
768
|
const form = consumableForm(item);
|
|
769
769
|
const icon = formIcon(item, form);
|
|
770
770
|
/** What the item IS, on the sensors that describe it (not on a counter or a button). */
|
|
@@ -804,7 +804,7 @@ function consumableEntities(item) {
|
|
|
804
804
|
platform: "sensor",
|
|
805
805
|
label: `${item.label} status`,
|
|
806
806
|
deviceClass: "enum",
|
|
807
|
-
options:
|
|
807
|
+
options: require_legacy_integration_rows.ConsumableStatusSchema.options,
|
|
808
808
|
icon,
|
|
809
809
|
attributes,
|
|
810
810
|
entityCategory: "diagnostic"
|
|
@@ -2405,7 +2405,7 @@ var CAP_ENTITY_MAP = {
|
|
|
2405
2405
|
* failure. `fanMode` and `preset` get no such list at all: they are
|
|
2406
2406
|
* free-form strings, so they stay sensors.
|
|
2407
2407
|
*/
|
|
2408
|
-
options:
|
|
2408
|
+
options: require_legacy_integration_rows.HvacModeSchema.options,
|
|
2409
2409
|
extras: {
|
|
2410
2410
|
"current-temp": {
|
|
2411
2411
|
platform: "sensor",
|
|
@@ -2555,7 +2555,7 @@ var CAP_ENTITY_MAP = {
|
|
|
2555
2555
|
field: "direction",
|
|
2556
2556
|
label: "Direction",
|
|
2557
2557
|
writable: true,
|
|
2558
|
-
options:
|
|
2558
|
+
options: require_legacy_integration_rows.FanDirectionSchema.options,
|
|
2559
2559
|
enabledByDefault: false
|
|
2560
2560
|
}
|
|
2561
2561
|
}
|
|
@@ -2985,7 +2985,7 @@ var CAP_ENTITY_MAP = {
|
|
|
2985
2985
|
field: "repeat",
|
|
2986
2986
|
label: "Repeat",
|
|
2987
2987
|
writable: true,
|
|
2988
|
-
options:
|
|
2988
|
+
options: require_legacy_integration_rows.MediaPlayerRepeatSchema.options,
|
|
2989
2989
|
enabledByDefault: false
|
|
2990
2990
|
},
|
|
2991
2991
|
shuffle: {
|
|
@@ -3481,7 +3481,7 @@ function controlEntitySpecs(slice, quantity) {
|
|
|
3481
3481
|
const min = readFiniteNumber(slice, "min") ?? PERCENT_RANGE.min;
|
|
3482
3482
|
const max = readFiniteNumber(slice, "max") ?? PERCENT_RANGE.max;
|
|
3483
3483
|
const step = readFiniteNumber(slice, "step") ?? PERCENT_RANGE.step;
|
|
3484
|
-
const unit = quantity === void 0 ? void 0 :
|
|
3484
|
+
const unit = quantity === void 0 ? void 0 : require_legacy_integration_rows.baseUnitOf(quantity);
|
|
3485
3485
|
if (min < max && step > 0) return [{
|
|
3486
3486
|
entity: primary,
|
|
3487
3487
|
platform: "number",
|
|
@@ -3803,7 +3803,7 @@ function buildDerivedPlan(device, options = UNNEGOTIATED_PLAN_OPTIONS) {
|
|
|
3803
3803
|
continue;
|
|
3804
3804
|
}
|
|
3805
3805
|
if (cap === "numeric-sensor") {
|
|
3806
|
-
const unit = device.readingQuantity === void 0 ? void 0 :
|
|
3806
|
+
const unit = device.readingQuantity === void 0 ? void 0 : require_legacy_integration_rows.baseUnitOf(device.readingQuantity);
|
|
3807
3807
|
specs.push(...capEntitySpecs(cap).map((spec) => degradeUnsupported(unit === void 0 ? spec : {
|
|
3808
3808
|
...spec,
|
|
3809
3809
|
unit
|
|
@@ -3878,7 +3878,7 @@ function buildDevicePlan(device, options = UNNEGOTIATED_PLAN_OPTIONS) {
|
|
|
3878
3878
|
* was.
|
|
3879
3879
|
*/
|
|
3880
3880
|
/** The camera function ids, keyed by the entity slug the catalog emits. */
|
|
3881
|
-
var CAMERA_SWITCH_BY_SLUG = Object.fromEntries(
|
|
3881
|
+
var CAMERA_SWITCH_BY_SLUG = Object.fromEntries(require_legacy_integration_rows.CAMERA_SWITCH_ORDER.map((id) => [toSlug(id), id]));
|
|
3882
3882
|
var PTZ_DIRECTION_BY_ENTITY = Object.fromEntries(PTZ_BUTTONS.map((entity) => [entity, entity.slice(4)]));
|
|
3883
3883
|
function parseBool(value) {
|
|
3884
3884
|
const lower = value.trim().toLowerCase();
|
|
@@ -3941,7 +3941,7 @@ function parseAlarmAction(value) {
|
|
|
3941
3941
|
if (lower === "disarm" || lower === "disarmed") return { kind: "disarm" };
|
|
3942
3942
|
if (lower === "trigger" || lower === "triggered") return { kind: "trigger" };
|
|
3943
3943
|
const withoutPrefix = lower.startsWith("armed_") ? lower.slice(6) : lower.startsWith("arm_") ? lower.slice(4) : lower;
|
|
3944
|
-
const mode =
|
|
3944
|
+
const mode = require_legacy_integration_rows.AlarmArmModeSchema.safeParse(withoutPrefix);
|
|
3945
3945
|
return mode.success ? {
|
|
3946
3946
|
kind: "arm",
|
|
3947
3947
|
mode: mode.data
|
|
@@ -4090,7 +4090,7 @@ var CAP_COMMAND_ROUTES = {
|
|
|
4090
4090
|
},
|
|
4091
4091
|
"climate-control": {
|
|
4092
4092
|
primary: (deviceId, value) => {
|
|
4093
|
-
const mode = parseEnum(
|
|
4093
|
+
const mode = parseEnum(require_legacy_integration_rows.HvacModeSchema, value);
|
|
4094
4094
|
return mode === null ? null : {
|
|
4095
4095
|
kind: "climate-mode",
|
|
4096
4096
|
deviceId,
|
|
@@ -4205,7 +4205,7 @@ var CAP_COMMAND_ROUTES = {
|
|
|
4205
4205
|
};
|
|
4206
4206
|
},
|
|
4207
4207
|
direction: (deviceId, value) => {
|
|
4208
|
-
const direction = parseEnum(
|
|
4208
|
+
const direction = parseEnum(require_legacy_integration_rows.FanDirectionSchema, value);
|
|
4209
4209
|
return direction === null ? null : {
|
|
4210
4210
|
kind: "fan-direction",
|
|
4211
4211
|
deviceId,
|
|
@@ -4409,7 +4409,7 @@ var CAP_COMMAND_ROUTES = {
|
|
|
4409
4409
|
};
|
|
4410
4410
|
},
|
|
4411
4411
|
repeat: (deviceId, value) => {
|
|
4412
|
-
const repeat = parseEnum(
|
|
4412
|
+
const repeat = parseEnum(require_legacy_integration_rows.MediaPlayerRepeatSchema, value);
|
|
4413
4413
|
return repeat === null ? null : {
|
|
4414
4414
|
kind: "media-repeat",
|
|
4415
4415
|
deviceId,
|
|
@@ -5001,7 +5001,7 @@ async function planDropPublicBaseUrl(ports) {
|
|
|
5001
5001
|
op: "deleteKeys",
|
|
5002
5002
|
scope: ADDON_SETTINGS_TABLE,
|
|
5003
5003
|
keys: present.map(rowId),
|
|
5004
|
-
precondition:
|
|
5004
|
+
precondition: require_legacy_integration_rows.preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
5005
5005
|
addonId: HA_EXPORT_ADDON_ID,
|
|
5006
5006
|
key,
|
|
5007
5007
|
value: stored[key]
|
|
@@ -5231,7 +5231,7 @@ async function planDropPerBrokerFlags(ports) {
|
|
|
5231
5231
|
op: "deleteKeys",
|
|
5232
5232
|
scope: ADDON_SETTINGS_TABLE,
|
|
5233
5233
|
keys: drop.map((entry) => rowId(entry.storeKey)),
|
|
5234
|
-
precondition:
|
|
5234
|
+
precondition: require_legacy_integration_rows.preconditionOf(Object.fromEntries(drop.map((entry) => [rowId(entry.storeKey), {
|
|
5235
5235
|
addonId: HA_EXPORT_ADDON_ID,
|
|
5236
5236
|
key: entry.storeKey,
|
|
5237
5237
|
value: entry.value
|
|
@@ -5257,15 +5257,15 @@ var HA_EXPORT_TARGETS_KIND_NAME = "ha-export-targets";
|
|
|
5257
5257
|
var HA_TARGET_KIND = "ha-target";
|
|
5258
5258
|
var TARGET_ID_PREFIX = "hae_";
|
|
5259
5259
|
/** The schema is checked against the interface by its annotation: a drifted field fails the typecheck. */
|
|
5260
|
-
var HaExportTargetBodySchema =
|
|
5261
|
-
name:
|
|
5262
|
-
connectionId:
|
|
5263
|
-
mediaRole:
|
|
5264
|
-
reconcileIntervalSec:
|
|
5265
|
-
devices:
|
|
5266
|
-
enabled:
|
|
5260
|
+
var HaExportTargetBodySchema = require_legacy_integration_rows.object({
|
|
5261
|
+
name: require_legacy_integration_rows.string().min(1),
|
|
5262
|
+
connectionId: require_legacy_integration_rows.string(),
|
|
5263
|
+
mediaRole: require_legacy_integration_rows._enum(HA_MEDIA_ROLES),
|
|
5264
|
+
reconcileIntervalSec: require_legacy_integration_rows.number(),
|
|
5265
|
+
devices: require_legacy_integration_rows.array(require_legacy_integration_rows.string()),
|
|
5266
|
+
enabled: require_legacy_integration_rows.boolean().optional()
|
|
5267
5267
|
});
|
|
5268
|
-
var haExportTargetsKind =
|
|
5268
|
+
var haExportTargetsKind = require_legacy_integration_rows.defineEntryKind(HA_EXPORT_TARGETS_KIND_NAME, {
|
|
5269
5269
|
title: "Home Assistant export targets",
|
|
5270
5270
|
nameField: "name",
|
|
5271
5271
|
schema: HaExportTargetBodySchema,
|
|
@@ -5604,7 +5604,7 @@ async function planDropMovedLinks(ports) {
|
|
|
5604
5604
|
op: "deleteKeys",
|
|
5605
5605
|
scope: ADDON_SETTINGS_TABLE,
|
|
5606
5606
|
keys: present.map(rowId),
|
|
5607
|
-
precondition:
|
|
5607
|
+
precondition: require_legacy_integration_rows.preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
5608
5608
|
addonId: HA_EXPORT_ADDON_ID,
|
|
5609
5609
|
key,
|
|
5610
5610
|
value: stored[key]
|
|
@@ -5740,13 +5740,13 @@ var ADDON_MIGRATIONS = [
|
|
|
5740
5740
|
* outside `migrations/` names it (`no-legacy-links-reader.spec.ts`).
|
|
5741
5741
|
*/
|
|
5742
5742
|
var HA_EXPORT_LINKS_KIND_NAME = "ha-export-links";
|
|
5743
|
-
var HaExportLinksBodySchema =
|
|
5744
|
-
name:
|
|
5745
|
-
exportTo:
|
|
5746
|
-
mediaRole:
|
|
5747
|
-
devices:
|
|
5743
|
+
var HaExportLinksBodySchema = require_legacy_integration_rows.object({
|
|
5744
|
+
name: require_legacy_integration_rows.string().min(1),
|
|
5745
|
+
exportTo: require_legacy_integration_rows.boolean(),
|
|
5746
|
+
mediaRole: require_legacy_integration_rows._enum(HA_MEDIA_ROLES),
|
|
5747
|
+
devices: require_legacy_integration_rows.array(require_legacy_integration_rows.string())
|
|
5748
5748
|
});
|
|
5749
|
-
var haExportLinksKind =
|
|
5749
|
+
var haExportLinksKind = require_legacy_integration_rows.defineEntryKind(HA_EXPORT_LINKS_KIND_NAME, {
|
|
5750
5750
|
title: "Home Assistant export links (retired)",
|
|
5751
5751
|
nameField: "name",
|
|
5752
5752
|
schema: HaExportLinksBodySchema,
|
|
@@ -5781,7 +5781,12 @@ async function readAllLinks(handle) {
|
|
|
5781
5781
|
function haExportMigrationPorts(deps) {
|
|
5782
5782
|
return {
|
|
5783
5783
|
readStored: deps.readStored,
|
|
5784
|
-
...
|
|
5784
|
+
...require_legacy_integration_rows.haInstanceSettingsPortsOver({
|
|
5785
|
+
list: deps.api.integrations.list,
|
|
5786
|
+
readLegacyIntegrationRows: deps.api.migrations.readLegacyIntegrationRows,
|
|
5787
|
+
patchLegacyIntegrationRows: deps.api.migrations.patchLegacyIntegrationRows,
|
|
5788
|
+
deleteLegacyIntegrationRowKeys: deps.api.migrations.deleteLegacyIntegrationRowKeys
|
|
5789
|
+
}, deps.secrets ?? null),
|
|
5785
5790
|
warn: deps.warn,
|
|
5786
5791
|
putLinks: async (brokerId, body) => {
|
|
5787
5792
|
if (await deps.links.get(brokerId) !== null) return "exists";
|
|
@@ -5791,7 +5796,7 @@ function haExportMigrationPorts(deps) {
|
|
|
5791
5796
|
data: body
|
|
5792
5797
|
}, { ifRev: 0 });
|
|
5793
5798
|
} catch (err) {
|
|
5794
|
-
if (err instanceof
|
|
5799
|
+
if (err instanceof require_legacy_integration_rows.RevConflictError) return "exists";
|
|
5795
5800
|
throw err;
|
|
5796
5801
|
}
|
|
5797
5802
|
return "created";
|
|
@@ -5805,7 +5810,7 @@ function haExportMigrationPorts(deps) {
|
|
|
5805
5810
|
data: body
|
|
5806
5811
|
}, { ifRev: 0 });
|
|
5807
5812
|
} catch (err) {
|
|
5808
|
-
if (err instanceof
|
|
5813
|
+
if (err instanceof require_legacy_integration_rows.RevConflictError) return "exists";
|
|
5809
5814
|
throw err;
|
|
5810
5815
|
}
|
|
5811
5816
|
return "created";
|
|
@@ -5887,7 +5892,7 @@ function buildTargetForm() {
|
|
|
5887
5892
|
* may push to one Home Assistant.
|
|
5888
5893
|
*/
|
|
5889
5894
|
function openTargetInstances(records, deps) {
|
|
5890
|
-
return new
|
|
5895
|
+
return new require_legacy_integration_rows.RecordIntegrationInstances(records, haExportTargetsKind, {
|
|
5891
5896
|
description: {
|
|
5892
5897
|
role: "services",
|
|
5893
5898
|
instanceMode: "multiple",
|
|
@@ -6646,7 +6651,7 @@ function reduceLastTriggers(rows) {
|
|
|
6646
6651
|
function macroOf(className) {
|
|
6647
6652
|
const lower = className.toLowerCase();
|
|
6648
6653
|
if (EXPORTED_MACROS.includes(lower)) return lower;
|
|
6649
|
-
const mapped =
|
|
6654
|
+
const mapped = require_legacy_integration_rows.COCO_TO_MACRO.mapping[lower];
|
|
6650
6655
|
return typeof mapped === "string" ? mapped : null;
|
|
6651
6656
|
}
|
|
6652
6657
|
function iso(timestamp) {
|
|
@@ -7795,7 +7800,7 @@ var ExportedEntities = class {
|
|
|
7795
7800
|
this.ports.logger.warn("homeassistant-export: exported entities not reconciled — a list was unanswered", { meta: { error: errMsg$1(err) } });
|
|
7796
7801
|
return;
|
|
7797
7802
|
}
|
|
7798
|
-
const { dropped } =
|
|
7803
|
+
const { dropped } = require_legacy_integration_rows.pruneDeletedEntities([...this.state.actions.map((e) => ({
|
|
7799
7804
|
kind: "action",
|
|
7800
7805
|
actionId: e.actionId
|
|
7801
7806
|
})), ...this.state.targets.map((e) => ({
|
|
@@ -7867,7 +7872,7 @@ var ExportedEntities = class {
|
|
|
7867
7872
|
const action = this.state.actions.find((e) => actionEntity(e.actionId) === entity);
|
|
7868
7873
|
if (action !== void 0) return {
|
|
7869
7874
|
handled: true,
|
|
7870
|
-
applied: (await
|
|
7875
|
+
applied: (await require_legacy_integration_rows.runExportedAction(this.ports.api, this.ports.logger, {
|
|
7871
7876
|
exporter: EXPORTER,
|
|
7872
7877
|
actionId: action.actionId
|
|
7873
7878
|
})).status === "started"
|
|
@@ -7875,7 +7880,7 @@ var ExportedEntities = class {
|
|
|
7875
7880
|
const target = this.state.targets.find((e) => targetEntity(e.targetId) === entity);
|
|
7876
7881
|
if (target !== void 0) return {
|
|
7877
7882
|
handled: true,
|
|
7878
|
-
applied: (await
|
|
7883
|
+
applied: (await require_legacy_integration_rows.sendToExportedTarget(this.ports.api, this.ports.logger, {
|
|
7879
7884
|
exporter: EXPORTER,
|
|
7880
7885
|
targetId: target.targetId,
|
|
7881
7886
|
notification: { body: value }
|
|
@@ -7926,7 +7931,7 @@ var SUPPORTED_DEVICE_KINDS = [
|
|
|
7926
7931
|
"image",
|
|
7927
7932
|
"pet-feeder",
|
|
7928
7933
|
"hub",
|
|
7929
|
-
...
|
|
7934
|
+
...require_legacy_integration_rows.PLUG_APPLIANCE_TYPES
|
|
7930
7935
|
];
|
|
7931
7936
|
//#endregion
|
|
7932
7937
|
//#region src/ha-export/ha-export.addon.ts
|
|
@@ -7991,7 +7996,7 @@ var DEFAULT_CONFIG = { exportedEntities: {
|
|
|
7991
7996
|
actions: [],
|
|
7992
7997
|
targets: []
|
|
7993
7998
|
} };
|
|
7994
|
-
var HaExportAddon = class extends
|
|
7999
|
+
var HaExportAddon = class extends require_legacy_integration_rows.BaseAddon {
|
|
7995
8000
|
links = /* @__PURE__ */ new Map();
|
|
7996
8001
|
instances = null;
|
|
7997
8002
|
/** The Home Assistant connections (broker ids) the last `broker.list` answered. */
|
|
@@ -8105,9 +8110,10 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8105
8110
|
await records.declare({ "ha-export-targets": haExportTargetsKind });
|
|
8106
8111
|
const targetsHandle = records.kind(haExportTargetsKind);
|
|
8107
8112
|
const legacyLinks = await declareLegacyLinks(records);
|
|
8108
|
-
await this.runMigrations(
|
|
8113
|
+
await this.runMigrations(require_legacy_integration_rows.defineAddonMigrations(ADDON_MIGRATIONS, haExportMigrationPorts({
|
|
8109
8114
|
readStored: async () => this.resolveGlobalStore(),
|
|
8110
8115
|
api: this.ctx.api,
|
|
8116
|
+
secrets: this.ctx.secrets ?? null,
|
|
8111
8117
|
links: legacyLinks,
|
|
8112
8118
|
targets: targetsHandle,
|
|
8113
8119
|
clearSettingKeys: async (keys) => {
|
|
@@ -8122,7 +8128,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8122
8128
|
health: (id, body) => this.targetHealth(id, body),
|
|
8123
8129
|
onChanged: (id, change) => this.onTargetChanged(id, change)
|
|
8124
8130
|
});
|
|
8125
|
-
const secret = this.state("haExportMediaSecret",
|
|
8131
|
+
const secret = this.state("haExportMediaSecret", require_legacy_integration_rows.string(), "");
|
|
8126
8132
|
const existing = await secret.get();
|
|
8127
8133
|
if (existing.length === 0) {
|
|
8128
8134
|
const minted = randomSecret();
|
|
@@ -8155,9 +8161,9 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8155
8161
|
this.exportedEntities = exportedEntities;
|
|
8156
8162
|
return [
|
|
8157
8163
|
{
|
|
8158
|
-
capability:
|
|
8164
|
+
capability: require_legacy_integration_rows.deviceExportCapability,
|
|
8159
8165
|
provider: {
|
|
8160
|
-
getStatus: async (input) => this.buildStatus(this.targetScope(
|
|
8166
|
+
getStatus: async (input) => this.buildStatus(this.targetScope(require_legacy_integration_rows.statusInstanceOf(input))),
|
|
8161
8167
|
listInstances: async () => this.book().ids().map((id) => ({
|
|
8162
8168
|
instanceId: id,
|
|
8163
8169
|
name: this.book().name(id),
|
|
@@ -8203,12 +8209,12 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8203
8209
|
}
|
|
8204
8210
|
},
|
|
8205
8211
|
{
|
|
8206
|
-
capability:
|
|
8212
|
+
capability: require_legacy_integration_rows.integrationInstancesCapability,
|
|
8207
8213
|
provider: this.requireInstances().toProvider()
|
|
8208
8214
|
},
|
|
8209
8215
|
{
|
|
8210
|
-
capability:
|
|
8211
|
-
provider:
|
|
8216
|
+
capability: require_legacy_integration_rows.addonRoutesCapability,
|
|
8217
|
+
provider: require_legacy_integration_rows.buildAddonRouteProvider(ADDON_ID, [{
|
|
8212
8218
|
method: "POST",
|
|
8213
8219
|
path: "/command",
|
|
8214
8220
|
access: "authenticated",
|
|
@@ -8219,7 +8225,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8219
8225
|
}])
|
|
8220
8226
|
},
|
|
8221
8227
|
{
|
|
8222
|
-
capability:
|
|
8228
|
+
capability: require_legacy_integration_rows.oauthIntegrationCapability,
|
|
8223
8229
|
provider: { getDescriptor: async () => HOME_ASSISTANT_OAUTH_INTEGRATION }
|
|
8224
8230
|
}
|
|
8225
8231
|
];
|
|
@@ -8248,16 +8254,16 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8248
8254
|
return this.instances;
|
|
8249
8255
|
}
|
|
8250
8256
|
wireListeners() {
|
|
8251
|
-
this.subscribe({ category:
|
|
8257
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.DeviceStateChanged }, (event) => {
|
|
8252
8258
|
this.onSliceChanged(event.data);
|
|
8253
8259
|
});
|
|
8254
|
-
this.subscribe({ category:
|
|
8260
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.DeviceOnline }, (event) => {
|
|
8255
8261
|
this.onOnlineChanged(event.data, true);
|
|
8256
8262
|
});
|
|
8257
|
-
this.subscribe({ category:
|
|
8263
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.DeviceOffline }, (event) => {
|
|
8258
8264
|
this.onOnlineChanged(event.data, false);
|
|
8259
8265
|
});
|
|
8260
|
-
this.subscribe({ category:
|
|
8266
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.MotionOnMotionChanged }, (event) => {
|
|
8261
8267
|
this.onMotion(event.data);
|
|
8262
8268
|
});
|
|
8263
8269
|
/**
|
|
@@ -8266,13 +8272,13 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8266
8272
|
* the entity existed and effectively never moved. It also carries the
|
|
8267
8273
|
* window LEVEL, which nothing else on the export path does.
|
|
8268
8274
|
*/
|
|
8269
|
-
this.subscribe({ category:
|
|
8275
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.PipelineAudioInferenceResult }, (event) => {
|
|
8270
8276
|
this.onAudioWindow(event.data);
|
|
8271
8277
|
});
|
|
8272
|
-
this.subscribe({ category:
|
|
8278
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.PipelineAnalyticsTrackLifecycle }, (event) => {
|
|
8273
8279
|
this.onTrackLifecycle(event.data);
|
|
8274
8280
|
});
|
|
8275
|
-
this.subscribe({ category:
|
|
8281
|
+
this.subscribe({ category: require_legacy_integration_rows.EventCategory.ZoneAnalyticsOccupancyChanged }, (event) => {
|
|
8276
8282
|
this.onZoneOccupancy(event.data);
|
|
8277
8283
|
});
|
|
8278
8284
|
/**
|
|
@@ -8281,11 +8287,11 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
8281
8287
|
* rather than a state push.
|
|
8282
8288
|
*/
|
|
8283
8289
|
for (const category of [
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8290
|
+
require_legacy_integration_rows.EventCategory.DeviceRegistered,
|
|
8291
|
+
require_legacy_integration_rows.EventCategory.DeviceUnregistered,
|
|
8292
|
+
require_legacy_integration_rows.EventCategory.DeviceBindingsChanged,
|
|
8293
|
+
require_legacy_integration_rows.EventCategory.DeviceMetaChanged,
|
|
8294
|
+
require_legacy_integration_rows.EventCategory.BrokerStatusChanged
|
|
8289
8295
|
]) this.subscribe({ category }, () => {
|
|
8290
8296
|
this.reconcileSoon();
|
|
8291
8297
|
});
|
|
@@ -9398,7 +9404,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
9398
9404
|
*/
|
|
9399
9405
|
capSlices: snapshot,
|
|
9400
9406
|
itemEntities: items.entities,
|
|
9401
|
-
...
|
|
9407
|
+
...require_legacy_integration_rows.isReadingQuantity(readingQuantity) ? { readingQuantity } : {}
|
|
9402
9408
|
},
|
|
9403
9409
|
heldBack
|
|
9404
9410
|
};
|
|
@@ -9632,7 +9638,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
9632
9638
|
maskEnabled: privacySlice["enabled"] === true,
|
|
9633
9639
|
audioEnabled: typeof privacySlice["audioEnabled"] === "boolean" ? privacySlice["audioEnabled"] : null
|
|
9634
9640
|
};
|
|
9635
|
-
const brokerAudioMuted = sourceNodeId === null ? null : await this.ctx.api.streamBroker.getDeviceAudioMute.query({ deviceId },
|
|
9641
|
+
const brokerAudioMuted = sourceNodeId === null ? null : await this.ctx.api.streamBroker.getDeviceAudioMute.query({ deviceId }, require_legacy_integration_rows.nodePin(sourceNodeId)).then((r) => r.muted).catch((err) => {
|
|
9636
9642
|
this.ctx.logger.warn("ha-export: could not read broker audio mute, the broker-audio function degrades", {
|
|
9637
9643
|
tags: { deviceId },
|
|
9638
9644
|
meta: {
|
|
@@ -9683,7 +9689,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
9683
9689
|
* reasoning.
|
|
9684
9690
|
*/
|
|
9685
9691
|
async refreshBrokers() {
|
|
9686
|
-
const haBrokers = await
|
|
9692
|
+
const haBrokers = await require_legacy_integration_rows.listHomeAssistantBrokers((input) => this.ctx.api.broker.list.query(input));
|
|
9687
9693
|
/**
|
|
9688
9694
|
* NEVER treat an empty enumeration as "the connections are gone".
|
|
9689
9695
|
*
|
|
@@ -10064,7 +10070,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
10064
10070
|
}
|
|
10065
10071
|
switch (command.kind) {
|
|
10066
10072
|
case "camera-function": {
|
|
10067
|
-
const parsed =
|
|
10073
|
+
const parsed = require_legacy_integration_rows.CameraSwitchIdSchema.safeParse(command.switchId);
|
|
10068
10074
|
if (!parsed.success) {
|
|
10069
10075
|
this.ctx.logger.warn("ha-export: dropping a command for an unknown camera function", {
|
|
10070
10076
|
tags: { deviceId: command.deviceId },
|
|
@@ -10345,7 +10351,7 @@ var HaExportAddon = class extends require_ha_instance_settings.BaseAddon {
|
|
|
10345
10351
|
*/
|
|
10346
10352
|
targetScope(instanceId) {
|
|
10347
10353
|
if (instanceId === void 0) return this.enabledTargetIds();
|
|
10348
|
-
if (!this.knownTargetIds().has(instanceId)) throw new
|
|
10354
|
+
if (!this.knownTargetIds().has(instanceId)) throw new require_legacy_integration_rows.ExportInstanceUnknownError("provider-homeassistant", instanceId);
|
|
10349
10355
|
return [instanceId];
|
|
10350
10356
|
}
|
|
10351
10357
|
exposedDeviceRows(scope) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as buildAddonRouteProvider, It as statusInstanceOf, Jt as BaseAddon, Ot as runExportedAction, Pt as sendToExportedTarget, Qt as baseUnitOf, Sn as EventCategory, U as consumableFormOf, W as consumableKindOf, X as deviceExportCapability, Zt as RevConflictError, _ as HvacModeSchema, _t as oauthIntegrationCapability, a as AlarmArmModeSchema, an as nodePin, bt as preconditionOf, c as CAMERA_SWITCH_ORDER, cn as boolean, ct as integrationInstancesCapability, d as ConsumableFormSchema, dn as number, en as defineAddonMigrations, f as ConsumableItemSchema, fn as object, g as FanDirectionSchema, gn as unknown, h as ExportInstanceUnknownError, i as listHomeAssistantBrokers, in as isReadingQuantity, l as COCO_TO_MACRO, mn as string, on as _enum, p as ConsumableStatusSchema, sn as array, t as haInstanceSettingsPortsOver, tn as defineEntryKind, u as CameraSwitchIdSchema, v as MediaPlayerRepeatSchema, w as addonRoutesCapability, wt as pruneDeletedEntities, x as RecordIntegrationInstances, y as PLUG_APPLIANCE_TYPES } from "../
|
|
1
|
+
import { F as buildAddonRouteProvider, It as statusInstanceOf, Jt as BaseAddon, Ot as runExportedAction, Pt as sendToExportedTarget, Qt as baseUnitOf, Sn as EventCategory, U as consumableFormOf, W as consumableKindOf, X as deviceExportCapability, Zt as RevConflictError, _ as HvacModeSchema, _t as oauthIntegrationCapability, a as AlarmArmModeSchema, an as nodePin, bt as preconditionOf, c as CAMERA_SWITCH_ORDER, cn as boolean, ct as integrationInstancesCapability, d as ConsumableFormSchema, dn as number, en as defineAddonMigrations, f as ConsumableItemSchema, fn as object, g as FanDirectionSchema, gn as unknown, h as ExportInstanceUnknownError, i as listHomeAssistantBrokers, in as isReadingQuantity, l as COCO_TO_MACRO, mn as string, on as _enum, p as ConsumableStatusSchema, sn as array, t as haInstanceSettingsPortsOver, tn as defineEntryKind, u as CameraSwitchIdSchema, v as MediaPlayerRepeatSchema, w as addonRoutesCapability, wt as pruneDeletedEntities, x as RecordIntegrationInstances, y as PLUG_APPLIANCE_TYPES } from "../legacy-integration-rows-Bhvthv-s.mjs";
|
|
2
2
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
3
|
import "node:zlib";
|
|
4
4
|
import "node:fs";
|
|
@@ -5743,7 +5743,12 @@ async function readAllLinks(handle) {
|
|
|
5743
5743
|
function haExportMigrationPorts(deps) {
|
|
5744
5744
|
return {
|
|
5745
5745
|
readStored: deps.readStored,
|
|
5746
|
-
...haInstanceSettingsPortsOver(
|
|
5746
|
+
...haInstanceSettingsPortsOver({
|
|
5747
|
+
list: deps.api.integrations.list,
|
|
5748
|
+
readLegacyIntegrationRows: deps.api.migrations.readLegacyIntegrationRows,
|
|
5749
|
+
patchLegacyIntegrationRows: deps.api.migrations.patchLegacyIntegrationRows,
|
|
5750
|
+
deleteLegacyIntegrationRowKeys: deps.api.migrations.deleteLegacyIntegrationRowKeys
|
|
5751
|
+
}, deps.secrets ?? null),
|
|
5747
5752
|
warn: deps.warn,
|
|
5748
5753
|
putLinks: async (brokerId, body) => {
|
|
5749
5754
|
if (await deps.links.get(brokerId) !== null) return "exists";
|
|
@@ -8070,6 +8075,7 @@ var HaExportAddon = class extends BaseAddon {
|
|
|
8070
8075
|
await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, haExportMigrationPorts({
|
|
8071
8076
|
readStored: async () => this.resolveGlobalStore(),
|
|
8072
8077
|
api: this.ctx.api,
|
|
8078
|
+
secrets: this.ctx.secrets ?? null,
|
|
8073
8079
|
links: legacyLinks,
|
|
8074
8080
|
targets: targetsHandle,
|
|
8075
8081
|
clearSettingKeys: async (keys) => {
|