@camstack/addon-provider-homeassistant 1.2.147 → 1.2.149
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 +16 -5
- package/dist/addon.mjs +16 -5
- package/dist/{dist-CslhAXSs.js → dist-BHAS4ZKN.js} +517 -202
- package/dist/{dist-DVwhiKWh.mjs → dist-CpKTdyca.mjs} +517 -202
- package/dist/ha-export/ha-export.addon.js +7 -57
- package/dist/ha-export/ha-export.addon.mjs +7 -57
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-BHAS4ZKN.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
|
|
@@ -959,13 +959,15 @@ var HaBinarySensorDevice = class extends HaBaseChildDevice {
|
|
|
959
959
|
super(ctx, persisted.role !== void 0 ? { role: persisted.role } : {});
|
|
960
960
|
this.capName = capName;
|
|
961
961
|
this.registerCap(capName);
|
|
962
|
-
this.runtimeState.
|
|
962
|
+
const stored = this.runtimeState.getCapState(capName);
|
|
963
|
+
this.runtimeState.setCapState(this.capName, buildSlice(capName, false, 0, stored));
|
|
963
964
|
}
|
|
964
965
|
handleStatePush(state) {
|
|
965
966
|
if (state.state === "unavailable" || state.state === "unknown") return;
|
|
966
967
|
const active = state.state === "on";
|
|
967
968
|
const lastChangedAt = Date.parse(state.last_changed) || Date.now();
|
|
968
|
-
this.runtimeState.
|
|
969
|
+
const prior = this.runtimeState.getCapState(this.capName);
|
|
970
|
+
this.runtimeState.setCapState(this.capName, buildSlice(this.capName, active, lastChangedAt, prior));
|
|
969
971
|
}
|
|
970
972
|
registerCap(name) {
|
|
971
973
|
switch (name) {
|
|
@@ -1041,7 +1043,16 @@ var HaBinarySensorDevice = class extends HaBaseChildDevice {
|
|
|
1041
1043
|
return this.runtimeState.getCapState(this.capName) ?? fallback;
|
|
1042
1044
|
}
|
|
1043
1045
|
};
|
|
1044
|
-
|
|
1046
|
+
/**
|
|
1047
|
+
* The motion slice's last rise, carried across a fall. `null` only while no
|
|
1048
|
+
* rise was ever observed — never a time taken from an `off` state, whose HA
|
|
1049
|
+
* `last_changed` is the FALL, not the rise.
|
|
1050
|
+
*/
|
|
1051
|
+
function priorLastDetectedAt(prior) {
|
|
1052
|
+
const raw = prior?.["lastDetectedAt"];
|
|
1053
|
+
return typeof raw === "number" && Number.isFinite(raw) && raw > 0 ? raw : null;
|
|
1054
|
+
}
|
|
1055
|
+
function buildSlice(capName, active, lastChangedAt, prior) {
|
|
1045
1056
|
switch (capName) {
|
|
1046
1057
|
case "contact": return {
|
|
1047
1058
|
entryOpen: active,
|
|
@@ -1081,7 +1092,7 @@ function buildSlice(capName, active, lastChangedAt) {
|
|
|
1081
1092
|
};
|
|
1082
1093
|
case "motion": return {
|
|
1083
1094
|
detected: active,
|
|
1084
|
-
lastDetectedAt: active ? lastChangedAt :
|
|
1095
|
+
lastDetectedAt: active ? lastChangedAt : priorLastDetectedAt(prior),
|
|
1085
1096
|
autoClearAfterMs: null
|
|
1086
1097
|
};
|
|
1087
1098
|
}
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as parseAdminBase, A as contactCapability, At as union, B as gasCapability, C as buildAddonRouteProvider, Ct as array, D as climateControlCapability, Dt as object, E as carbonMonoxideCapability, Et as number, G as lockControlCapability, H as humiditySensorCapability, I as enumSensorCapability, J as normalizeUnit, K as mediaPlayerCapability, L as eventEmitterCapability, M as coverCapability, Mt as url, N as deviceAdminLinkCapability, Nt as EventCategory, O as colorCapability, Ot as record, P as deviceAdoptionCapability, R as fanControlCapability, S as brokerCapability, St as _enum, T as buttonCapability, Tt as literal, U as imageCapability, V as humidifierCapability, W as lawnMowerControlCapability, X as notifierCapability, Y as notificationOutputCapability, Z as numericSensorCapability, _ as automationControlCapability, _t as DeviceType, at as smokeCapability, b as binaryCapability, bt as createEvent, ct as temperatureSensorCapability, d as TargetSchema, dt as valveCapability, et as powerMeterCapability, f as accessoriesCapability, ft as vibrationCapability, g as ambientLightSensorCapability, gt as DeviceRole, h as alarmPanelCapability, ht as DeviceFeature, it as scriptRunnerCapability, j as controlCapability, jt as unknown, k as connectivityCapability, kt as string, lt as updateCapability, m as airQualitySensorCapability, mt as weatherCapability, n as BaseDevice, nt as presenceCapability, ot as switchCapability, p as addonRoutesCapability, pt as waterHeaterCapability, q as motionCapability, r as BaseDeviceProvider, rt as pressureSensorCapability, s as EnumSensorDateTimeFormatSchema, st as tamperCapability, tt as prepareNotification, ut as vacuumControlCapability, v as batteryCapability, vt as errMsg, w as buildDeviceAdminUrl, wt as discriminatedUnion, x as brightnessCapability, y as bestLocationMatch, z as floodCapability } from "./dist-
|
|
1
|
+
import { $ as parseAdminBase, A as contactCapability, At as union, B as gasCapability, C as buildAddonRouteProvider, Ct as array, D as climateControlCapability, Dt as object, E as carbonMonoxideCapability, Et as number, G as lockControlCapability, H as humiditySensorCapability, I as enumSensorCapability, J as normalizeUnit, K as mediaPlayerCapability, L as eventEmitterCapability, M as coverCapability, Mt as url, N as deviceAdminLinkCapability, Nt as EventCategory, O as colorCapability, Ot as record, P as deviceAdoptionCapability, R as fanControlCapability, S as brokerCapability, St as _enum, T as buttonCapability, Tt as literal, U as imageCapability, V as humidifierCapability, W as lawnMowerControlCapability, X as notifierCapability, Y as notificationOutputCapability, Z as numericSensorCapability, _ as automationControlCapability, _t as DeviceType, at as smokeCapability, b as binaryCapability, bt as createEvent, ct as temperatureSensorCapability, d as TargetSchema, dt as valveCapability, et as powerMeterCapability, f as accessoriesCapability, ft as vibrationCapability, g as ambientLightSensorCapability, gt as DeviceRole, h as alarmPanelCapability, ht as DeviceFeature, it as scriptRunnerCapability, j as controlCapability, jt as unknown, k as connectivityCapability, kt as string, lt as updateCapability, m as airQualitySensorCapability, mt as weatherCapability, n as BaseDevice, nt as presenceCapability, ot as switchCapability, p as addonRoutesCapability, pt as waterHeaterCapability, q as motionCapability, r as BaseDeviceProvider, rt as pressureSensorCapability, s as EnumSensorDateTimeFormatSchema, st as tamperCapability, tt as prepareNotification, ut as vacuumControlCapability, v as batteryCapability, vt as errMsg, w as buildDeviceAdminUrl, wt as discriminatedUnion, x as brightnessCapability, y as bestLocationMatch, z as floodCapability } from "./dist-CpKTdyca.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
|
|
@@ -958,13 +958,15 @@ var HaBinarySensorDevice = class extends HaBaseChildDevice {
|
|
|
958
958
|
super(ctx, persisted.role !== void 0 ? { role: persisted.role } : {});
|
|
959
959
|
this.capName = capName;
|
|
960
960
|
this.registerCap(capName);
|
|
961
|
-
this.runtimeState.
|
|
961
|
+
const stored = this.runtimeState.getCapState(capName);
|
|
962
|
+
this.runtimeState.setCapState(this.capName, buildSlice(capName, false, 0, stored));
|
|
962
963
|
}
|
|
963
964
|
handleStatePush(state) {
|
|
964
965
|
if (state.state === "unavailable" || state.state === "unknown") return;
|
|
965
966
|
const active = state.state === "on";
|
|
966
967
|
const lastChangedAt = Date.parse(state.last_changed) || Date.now();
|
|
967
|
-
this.runtimeState.
|
|
968
|
+
const prior = this.runtimeState.getCapState(this.capName);
|
|
969
|
+
this.runtimeState.setCapState(this.capName, buildSlice(this.capName, active, lastChangedAt, prior));
|
|
968
970
|
}
|
|
969
971
|
registerCap(name) {
|
|
970
972
|
switch (name) {
|
|
@@ -1040,7 +1042,16 @@ var HaBinarySensorDevice = class extends HaBaseChildDevice {
|
|
|
1040
1042
|
return this.runtimeState.getCapState(this.capName) ?? fallback;
|
|
1041
1043
|
}
|
|
1042
1044
|
};
|
|
1043
|
-
|
|
1045
|
+
/**
|
|
1046
|
+
* The motion slice's last rise, carried across a fall. `null` only while no
|
|
1047
|
+
* rise was ever observed — never a time taken from an `off` state, whose HA
|
|
1048
|
+
* `last_changed` is the FALL, not the rise.
|
|
1049
|
+
*/
|
|
1050
|
+
function priorLastDetectedAt(prior) {
|
|
1051
|
+
const raw = prior?.["lastDetectedAt"];
|
|
1052
|
+
return typeof raw === "number" && Number.isFinite(raw) && raw > 0 ? raw : null;
|
|
1053
|
+
}
|
|
1054
|
+
function buildSlice(capName, active, lastChangedAt, prior) {
|
|
1044
1055
|
switch (capName) {
|
|
1045
1056
|
case "contact": return {
|
|
1046
1057
|
entryOpen: active,
|
|
@@ -1080,7 +1091,7 @@ function buildSlice(capName, active, lastChangedAt) {
|
|
|
1080
1091
|
};
|
|
1081
1092
|
case "motion": return {
|
|
1082
1093
|
detected: active,
|
|
1083
|
-
lastDetectedAt: active ? lastChangedAt :
|
|
1094
|
+
lastDetectedAt: active ? lastChangedAt : priorLastDetectedAt(prior),
|
|
1084
1095
|
autoClearAfterMs: null
|
|
1085
1096
|
};
|
|
1086
1097
|
}
|