@camstack/addon-provider-homeassistant 1.2.143 → 1.2.145

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-BQE3XuD4.js");
6
+ const require_dist = require("../dist-C_Vy4lAi.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  //#region src/ha-export/topics.ts
9
9
  /**
@@ -2868,6 +2868,10 @@ var CAPS_NOT_EXPORTED = [
2868
2868
  cap: "stream-params",
2869
2869
  reason: "Encoder parameters (bitrate/resolution/fps) — transport rather than state."
2870
2870
  },
2871
+ {
2872
+ cap: "device-extension",
2873
+ reason: "A configuration VIEW (D648): which other devices extend this one (linked devices, doorbell trigger sources), read from stores other addons own. It has no state of its own to publish, and the extended functions already export through their own caps."
2874
+ },
2871
2875
  {
2872
2876
  cap: "videoclips",
2873
2877
  reason: "Media retrieval by handle, not a state. Clips reach the operator through notifications and the viewer."
@@ -4938,9 +4942,11 @@ function projectMotion(deviceKey, input) {
4938
4942
  /**
4939
4943
  * A clearing edge carries no timestamp. `last_detection` answers "when
4940
4944
  * did something last happen", and restamping it when nothing happened
4941
- * makes an idle camera look permanently busy.
4945
+ * makes an idle camera look permanently busy. Same for a detection whose
4946
+ * timestamp is unknown or implausible — omitted rather than published as
4947
+ * a lie the automation author would trust.
4942
4948
  */
4943
- if (input.detected) values.push({
4949
+ if (input.detected && input.timestamp !== null) values.push({
4944
4950
  topic: stateTopic(deviceKey, "motion_last_detection"),
4945
4951
  value: iso(input.timestamp)
4946
4952
  });
@@ -5930,6 +5936,13 @@ var PUSH_PATH = "/api/camstack/push";
5930
5936
  var MEDIA_ROUTE_PREFIX = `/addon/${ADDON_ID}/ha-media`;
5931
5937
  /** How long `doorbell_pressed` stays on before its OFF edge is published. */
5932
5938
  var DOORBELL_PULSE_MS = 5e3;
5939
+ /**
5940
+ * The earliest timestamp a real change could plausibly carry. Below this,
5941
+ * a slice field is a placeholder or a seeded "known value, unknown change
5942
+ * time" stamp (e.g. Homematic's `HM_SEEDED_CHANGED_AT = 1`) — never a real
5943
+ * instant. Year 2000 predates every device this addon exports.
5944
+ */
5945
+ var MIN_PLAUSIBLE_TIMESTAMP_MS = Date.UTC(2e3, 0, 1);
5933
5946
  /** The hub's API port — where the data plane is reverse-proxied. */
5934
5947
  var HUB_API_PORT = 4443;
5935
5948
  /** One PTZ button press, as a relative move. */
@@ -6232,9 +6245,10 @@ var HaExportAddon = class extends require_dist.BaseAddon {
6232
6245
  const detected = slice["detected"];
6233
6246
  const lastDetectedAt = readNumber(slice, "lastDetectedAt");
6234
6247
  if (typeof detected !== "boolean") return;
6248
+ const timestamp = lastDetectedAt === null ? Date.now() : lastDetectedAt >= MIN_PLAUSIBLE_TIMESTAMP_MS ? lastDetectedAt : null;
6235
6249
  this.push(deviceId, projectMotion(deviceKey, {
6236
6250
  detected,
6237
- timestamp: lastDetectedAt ?? Date.now()
6251
+ timestamp
6238
6252
  }));
6239
6253
  }
6240
6254
  }
@@ -1,4 +1,4 @@
1
- import { C as buildAddonRouteProvider, F as deviceExportCapability, Nt as EventCategory, Q as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, gt as BaseAddon, i as CAMERA_SWITCH_ORDER, kt as string, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, xt as nodePin } from "../dist-CcnfBSQ5.mjs";
1
+ import { C as buildAddonRouteProvider, F as deviceExportCapability, Nt as EventCategory, Q as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, gt as BaseAddon, i as CAMERA_SWITCH_ORDER, kt as string, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, xt as nodePin } from "../dist-CN0BXfTz.mjs";
2
2
  import { createHmac, timingSafeEqual } from "node:crypto";
3
3
  //#region src/ha-export/topics.ts
4
4
  /**
@@ -2863,6 +2863,10 @@ var CAPS_NOT_EXPORTED = [
2863
2863
  cap: "stream-params",
2864
2864
  reason: "Encoder parameters (bitrate/resolution/fps) — transport rather than state."
2865
2865
  },
2866
+ {
2867
+ cap: "device-extension",
2868
+ reason: "A configuration VIEW (D648): which other devices extend this one (linked devices, doorbell trigger sources), read from stores other addons own. It has no state of its own to publish, and the extended functions already export through their own caps."
2869
+ },
2866
2870
  {
2867
2871
  cap: "videoclips",
2868
2872
  reason: "Media retrieval by handle, not a state. Clips reach the operator through notifications and the viewer."
@@ -4933,9 +4937,11 @@ function projectMotion(deviceKey, input) {
4933
4937
  /**
4934
4938
  * A clearing edge carries no timestamp. `last_detection` answers "when
4935
4939
  * did something last happen", and restamping it when nothing happened
4936
- * makes an idle camera look permanently busy.
4940
+ * makes an idle camera look permanently busy. Same for a detection whose
4941
+ * timestamp is unknown or implausible — omitted rather than published as
4942
+ * a lie the automation author would trust.
4937
4943
  */
4938
- if (input.detected) values.push({
4944
+ if (input.detected && input.timestamp !== null) values.push({
4939
4945
  topic: stateTopic(deviceKey, "motion_last_detection"),
4940
4946
  value: iso(input.timestamp)
4941
4947
  });
@@ -5925,6 +5931,13 @@ var PUSH_PATH = "/api/camstack/push";
5925
5931
  var MEDIA_ROUTE_PREFIX = `/addon/${ADDON_ID}/ha-media`;
5926
5932
  /** How long `doorbell_pressed` stays on before its OFF edge is published. */
5927
5933
  var DOORBELL_PULSE_MS = 5e3;
5934
+ /**
5935
+ * The earliest timestamp a real change could plausibly carry. Below this,
5936
+ * a slice field is a placeholder or a seeded "known value, unknown change
5937
+ * time" stamp (e.g. Homematic's `HM_SEEDED_CHANGED_AT = 1`) — never a real
5938
+ * instant. Year 2000 predates every device this addon exports.
5939
+ */
5940
+ var MIN_PLAUSIBLE_TIMESTAMP_MS = Date.UTC(2e3, 0, 1);
5928
5941
  /** The hub's API port — where the data plane is reverse-proxied. */
5929
5942
  var HUB_API_PORT = 4443;
5930
5943
  /** One PTZ button press, as a relative move. */
@@ -6227,9 +6240,10 @@ var HaExportAddon = class extends BaseAddon {
6227
6240
  const detected = slice["detected"];
6228
6241
  const lastDetectedAt = readNumber(slice, "lastDetectedAt");
6229
6242
  if (typeof detected !== "boolean") return;
6243
+ const timestamp = lastDetectedAt === null ? Date.now() : lastDetectedAt >= MIN_PLAUSIBLE_TIMESTAMP_MS ? lastDetectedAt : null;
6230
6244
  this.push(deviceId, projectMotion(deviceKey, {
6231
6245
  detected,
6232
- timestamp: lastDetectedAt ?? Date.now()
6246
+ timestamp
6233
6247
  }));
6234
6248
  }
6235
6249
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.143",
3
+ "version": "1.2.145",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",