@camstack/addon-provider-homeassistant 1.2.76 → 1.2.78

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.
@@ -1538,13 +1538,31 @@ function cameraSpecs(device) {
1538
1538
  icon: "mdi:counter",
1539
1539
  enabledByDefault: false
1540
1540
  });
1541
- if (LABELLED_MACROS.includes(macro)) specs.push({
1542
- entity: `${macro}_last_label`,
1543
- platform: "sensor",
1544
- label: `${label} last label`,
1545
- icon: "mdi:tag",
1546
- enabledByDefault: true
1547
- });
1541
+ if (LABELLED_MACROS.includes(macro)) specs.push(
1542
+ {
1543
+ entity: `${macro}_last_label`,
1544
+ platform: "sensor",
1545
+ label: `${label} last label`,
1546
+ icon: "mdi:tag",
1547
+ enabledByDefault: true
1548
+ },
1549
+ /**
1550
+ * The identification OCCURRENCE — moves on every recognition,
1551
+ * including a repeat of the SAME name (an unchanged `last_label`
1552
+ * is deduped by the push client, and an identical value is not a
1553
+ * state change in HA). This is the entity an automation's trigger
1554
+ * binds to; the label value arrives in the same batch, ordered
1555
+ * first. Enabled for the same reason `<macro>_last_detection` is:
1556
+ * it IS the automation hook, not a diagnostic.
1557
+ */
1558
+ {
1559
+ entity: `${macro}_last_label_at`,
1560
+ platform: "sensor",
1561
+ label: `${label} last label at`,
1562
+ deviceClass: "timestamp",
1563
+ enabledByDefault: true
1564
+ }
1565
+ );
1548
1566
  }
1549
1567
  /**
1550
1568
  * The live picture — every stream the hub lists EXCEPT the adaptive one,
@@ -4886,10 +4904,29 @@ function projectTrackLifecycle(deviceKey, track, mediaUrl) {
4886
4904
  * topic nothing is subscribed to.
4887
4905
  */
4888
4906
  const label = track.plateText ?? track.label;
4889
- if (label !== void 0 && label.length > 0 && LABELLED_MACROS.includes(macro)) values.push({
4890
- topic: stateTopic(deviceKey, `${macro}_last_label`),
4891
- value: label
4892
- });
4907
+ if (label !== void 0 && label.length > 0 && LABELLED_MACROS.includes(macro)) {
4908
+ values.push({
4909
+ topic: stateTopic(deviceKey, `${macro}_last_label`),
4910
+ value: label
4911
+ });
4912
+ /**
4913
+ * The occurrence STAMP. A second recognition of the same person is a
4914
+ * real occurrence, but it is invisible on `_last_label`: the push
4915
+ * client dedups per topic, and an identical value is not a state
4916
+ * change in Home Assistant anyway — a state-trigger automation would
4917
+ * never re-fire. The stamp is the value that always moves, so an
4918
+ * automation binds its trigger HERE and reads `<macro>_last_label`
4919
+ * for the name — which is ordered BEFORE the stamp in this array, so
4920
+ * it is already applied when the trigger fires. HA's `event` platform
4921
+ * would be the native home for this, but no released component builds
4922
+ * it (`component-support.ts`): announcing one yields a warning in
4923
+ * HA's log and NO entity — the exact D152 zero-entities failure.
4924
+ */
4925
+ values.push({
4926
+ topic: stateTopic(deviceKey, `${macro}_last_label_at`),
4927
+ value: iso(track.lastSeen)
4928
+ });
4929
+ }
4893
4930
  if (mediaUrl !== null) values.push({
4894
4931
  topic: stateTopic(deviceKey, "last_image"),
4895
4932
  value: mediaUrl
@@ -1533,13 +1533,31 @@ function cameraSpecs(device) {
1533
1533
  icon: "mdi:counter",
1534
1534
  enabledByDefault: false
1535
1535
  });
1536
- if (LABELLED_MACROS.includes(macro)) specs.push({
1537
- entity: `${macro}_last_label`,
1538
- platform: "sensor",
1539
- label: `${label} last label`,
1540
- icon: "mdi:tag",
1541
- enabledByDefault: true
1542
- });
1536
+ if (LABELLED_MACROS.includes(macro)) specs.push(
1537
+ {
1538
+ entity: `${macro}_last_label`,
1539
+ platform: "sensor",
1540
+ label: `${label} last label`,
1541
+ icon: "mdi:tag",
1542
+ enabledByDefault: true
1543
+ },
1544
+ /**
1545
+ * The identification OCCURRENCE — moves on every recognition,
1546
+ * including a repeat of the SAME name (an unchanged `last_label`
1547
+ * is deduped by the push client, and an identical value is not a
1548
+ * state change in HA). This is the entity an automation's trigger
1549
+ * binds to; the label value arrives in the same batch, ordered
1550
+ * first. Enabled for the same reason `<macro>_last_detection` is:
1551
+ * it IS the automation hook, not a diagnostic.
1552
+ */
1553
+ {
1554
+ entity: `${macro}_last_label_at`,
1555
+ platform: "sensor",
1556
+ label: `${label} last label at`,
1557
+ deviceClass: "timestamp",
1558
+ enabledByDefault: true
1559
+ }
1560
+ );
1543
1561
  }
1544
1562
  /**
1545
1563
  * The live picture — every stream the hub lists EXCEPT the adaptive one,
@@ -4881,10 +4899,29 @@ function projectTrackLifecycle(deviceKey, track, mediaUrl) {
4881
4899
  * topic nothing is subscribed to.
4882
4900
  */
4883
4901
  const label = track.plateText ?? track.label;
4884
- if (label !== void 0 && label.length > 0 && LABELLED_MACROS.includes(macro)) values.push({
4885
- topic: stateTopic(deviceKey, `${macro}_last_label`),
4886
- value: label
4887
- });
4902
+ if (label !== void 0 && label.length > 0 && LABELLED_MACROS.includes(macro)) {
4903
+ values.push({
4904
+ topic: stateTopic(deviceKey, `${macro}_last_label`),
4905
+ value: label
4906
+ });
4907
+ /**
4908
+ * The occurrence STAMP. A second recognition of the same person is a
4909
+ * real occurrence, but it is invisible on `_last_label`: the push
4910
+ * client dedups per topic, and an identical value is not a state
4911
+ * change in Home Assistant anyway — a state-trigger automation would
4912
+ * never re-fire. The stamp is the value that always moves, so an
4913
+ * automation binds its trigger HERE and reads `<macro>_last_label`
4914
+ * for the name — which is ordered BEFORE the stamp in this array, so
4915
+ * it is already applied when the trigger fires. HA's `event` platform
4916
+ * would be the native home for this, but no released component builds
4917
+ * it (`component-support.ts`): announcing one yields a warning in
4918
+ * HA's log and NO entity — the exact D152 zero-entities failure.
4919
+ */
4920
+ values.push({
4921
+ topic: stateTopic(deviceKey, `${macro}_last_label_at`),
4922
+ value: iso(track.lastSeen)
4923
+ });
4924
+ }
4888
4925
  if (mediaUrl !== null) values.push({
4889
4926
  topic: stateTopic(deviceKey, "last_image"),
4890
4927
  value: mediaUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homeassistant",
3
- "version": "1.2.76",
3
+ "version": "1.2.78",
4
4
  "description": "Home Assistant device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",