@camstack/addon-export-ha-mqtt 1.1.26 → 1.1.27

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.
@@ -7678,6 +7678,160 @@ var EncodeProfileSchema = object({
7678
7678
  */
7679
7679
  outputArgs: array(string()).optional()
7680
7680
  });
7681
+ var COCO_TO_MACRO = {
7682
+ mapping: {
7683
+ person: "person",
7684
+ bicycle: "vehicle",
7685
+ car: "vehicle",
7686
+ motorcycle: "vehicle",
7687
+ airplane: "vehicle",
7688
+ bus: "vehicle",
7689
+ train: "vehicle",
7690
+ truck: "vehicle",
7691
+ boat: "vehicle",
7692
+ bird: "animal",
7693
+ cat: "animal",
7694
+ dog: "animal",
7695
+ horse: "animal",
7696
+ sheep: "animal",
7697
+ cow: "animal",
7698
+ elephant: "animal",
7699
+ bear: "animal",
7700
+ zebra: "animal",
7701
+ giraffe: "animal",
7702
+ suitcase: "package",
7703
+ backpack: "package",
7704
+ handbag: "package"
7705
+ },
7706
+ preserveOriginal: false
7707
+ };
7708
+ var AUDIO_MACRO_LABELS = [
7709
+ {
7710
+ id: "speech",
7711
+ name: "Speech",
7712
+ icon: "🗣️"
7713
+ },
7714
+ {
7715
+ id: "scream",
7716
+ name: "Scream / Shout",
7717
+ icon: "😱"
7718
+ },
7719
+ {
7720
+ id: "crying",
7721
+ name: "Crying / Baby",
7722
+ icon: "😢"
7723
+ },
7724
+ {
7725
+ id: "laughter",
7726
+ name: "Laughter",
7727
+ icon: "😂"
7728
+ },
7729
+ {
7730
+ id: "music",
7731
+ name: "Music",
7732
+ icon: "🎵"
7733
+ },
7734
+ {
7735
+ id: "dog",
7736
+ name: "Dog",
7737
+ icon: "🐕"
7738
+ },
7739
+ {
7740
+ id: "cat",
7741
+ name: "Cat",
7742
+ icon: "🐈"
7743
+ },
7744
+ {
7745
+ id: "bird",
7746
+ name: "Bird",
7747
+ icon: "🐦"
7748
+ },
7749
+ {
7750
+ id: "animal",
7751
+ name: "Animal (other)",
7752
+ icon: "🐾"
7753
+ },
7754
+ {
7755
+ id: "alarm",
7756
+ name: "Alarm / Siren",
7757
+ icon: "🚨"
7758
+ },
7759
+ {
7760
+ id: "doorbell",
7761
+ name: "Doorbell / Knock",
7762
+ icon: "🔔"
7763
+ },
7764
+ {
7765
+ id: "glass_breaking",
7766
+ name: "Glass Breaking",
7767
+ icon: "💥"
7768
+ },
7769
+ {
7770
+ id: "gunshot",
7771
+ name: "Gunshot / Explosion",
7772
+ icon: "💣"
7773
+ },
7774
+ {
7775
+ id: "vehicle",
7776
+ name: "Vehicle",
7777
+ icon: "🚗"
7778
+ },
7779
+ {
7780
+ id: "siren",
7781
+ name: "Emergency Siren",
7782
+ icon: "🚑"
7783
+ },
7784
+ {
7785
+ id: "fire",
7786
+ name: "Fire / Smoke",
7787
+ icon: "🔥"
7788
+ },
7789
+ {
7790
+ id: "water",
7791
+ name: "Water",
7792
+ icon: "💧"
7793
+ },
7794
+ {
7795
+ id: "wind",
7796
+ name: "Wind / Weather",
7797
+ icon: "🌬️"
7798
+ },
7799
+ {
7800
+ id: "door",
7801
+ name: "Door",
7802
+ icon: "🚪"
7803
+ },
7804
+ {
7805
+ id: "footsteps",
7806
+ name: "Footsteps",
7807
+ icon: "👣"
7808
+ },
7809
+ {
7810
+ id: "crowd",
7811
+ name: "Crowd / Chatter",
7812
+ icon: "👥"
7813
+ },
7814
+ {
7815
+ id: "telephone",
7816
+ name: "Telephone",
7817
+ icon: "📞"
7818
+ },
7819
+ {
7820
+ id: "engine",
7821
+ name: "Engine / Motor",
7822
+ icon: "⚙️"
7823
+ },
7824
+ {
7825
+ id: "tools",
7826
+ name: "Tools / Construction",
7827
+ icon: "🔨"
7828
+ },
7829
+ {
7830
+ id: "silence",
7831
+ name: "Silence",
7832
+ icon: "🤫"
7833
+ }
7834
+ ];
7681
7835
  var YAMNET_TO_MACRO = {
7682
7836
  mapping: {
7683
7837
  Speech: "speech",
@@ -7944,6 +8098,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7944
8098
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7945
8099
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7946
8100
  /**
8101
+ * Unified event-kind taxonomy — THE single source of truth for
8102
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8103
+ * icon }`.
8104
+ *
8105
+ * This dictionary folds together what used to be scattered across four
8106
+ * copies:
8107
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8108
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8109
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8110
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8111
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8112
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8113
+ *
8114
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8115
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8116
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8117
+ * color or an icon: they read this dictionary (server descriptors carry the
8118
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8119
+ *
8120
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8121
+ */
8122
+ var TAXONOMY_COLORS = {
8123
+ motion: "#f59e0b",
8124
+ audio: "#06b6d4",
8125
+ person: "#22c55e",
8126
+ vehicle: "#3b82f6",
8127
+ animal: "#f97316",
8128
+ package: "#a855f7",
8129
+ sensor: "#8b5cf6",
8130
+ control: "#10b981",
8131
+ genericDetection: "#64748b"
8132
+ };
8133
+ var DETECTION_SUB_COLORS = {
8134
+ car: "#f59e0b",
8135
+ truck: "#d97706",
8136
+ bus: "#b45309",
8137
+ motorcycle: "#eab308",
8138
+ bicycle: "#ca8a04",
8139
+ airplane: "#60a5fa",
8140
+ boat: "#2563eb",
8141
+ train: "#1d4ed8",
8142
+ bird: "#14b8a6",
8143
+ dog: "#84cc16",
8144
+ cat: "#f97316",
8145
+ horse: "#a16207",
8146
+ sheep: "#a3a3a3",
8147
+ cow: "#78716c",
8148
+ elephant: "#6b7280",
8149
+ bear: "#7c2d12",
8150
+ zebra: "#404040",
8151
+ giraffe: "#d4a373"
8152
+ };
8153
+ function titleCase(id) {
8154
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8155
+ }
8156
+ var entries = /* @__PURE__ */ new Map();
8157
+ function macro(kind, category, color, iconId, label) {
8158
+ entries.set(kind, {
8159
+ kind,
8160
+ parentKind: null,
8161
+ level: "macro",
8162
+ category,
8163
+ color,
8164
+ iconId,
8165
+ labelKey: `eventKind.${kind}`,
8166
+ label
8167
+ });
8168
+ }
8169
+ function sub(kind, parentKind, category, color, iconId, label) {
8170
+ entries.set(kind, {
8171
+ kind,
8172
+ parentKind,
8173
+ level: "sub",
8174
+ category,
8175
+ color,
8176
+ iconId,
8177
+ labelKey: `eventKind.${kind}`,
8178
+ label
8179
+ });
8180
+ }
8181
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8182
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8183
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8184
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8185
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8186
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8187
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8188
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8189
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8190
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8191
+ if (entries.has(cocoClass)) continue;
8192
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8193
+ }
8194
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8195
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8196
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8197
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8198
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8199
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8200
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8201
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8202
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8203
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8204
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8205
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8206
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8207
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8208
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8209
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8210
+ sub("button", "control", "control", "#10b981", "button", "Button");
8211
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8212
+ for (const l of AUDIO_MACRO_LABELS) {
8213
+ const kind = `audio-${l.id}`;
8214
+ if (entries.has(kind)) continue;
8215
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8216
+ }
8217
+ /** The complete taxonomy dictionary, keyed by kind. */
8218
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8219
+ /**
7947
8220
  * Error types for the safe expression engine. Two distinct classes so callers
7948
8221
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7949
8222
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15918,17 +16191,30 @@ var EventKindCategorySchema = _enum([
15918
16191
  "audio",
15919
16192
  "detection",
15920
16193
  "sensor",
16194
+ "control",
15921
16195
  "custom",
15922
16196
  "package"
15923
16197
  ]);
16198
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16199
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15924
16200
  var EventKindDescriptorSchema = object({
15925
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16201
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15926
16202
  kind: string(),
16203
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16204
+ labelKey: string(),
16205
+ /** English fallback label (kept for clients that don't translate). */
15927
16206
  label: string(),
15928
16207
  /** Hex color for timeline/legend rendering. */
15929
16208
  color: string(),
16209
+ /** Dictionary id → lucide component on the UI side. */
16210
+ iconId: string(),
16211
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15930
16212
  icon: EventKindIconSchema,
15931
16213
  category: EventKindCategorySchema,
16214
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16215
+ parentKind: string().nullable(),
16216
+ /** Derived from `parentKind`, explicit for the client tree. */
16217
+ level: EventKindLevelSchema,
15932
16218
  /** Which cap + device contributes this kind. For built-ins the camera
15933
16219
  * itself; for sensor kinds the LINKED source device. */
15934
16220
  source: object({
@@ -16001,11 +16287,21 @@ var TrackAudioLabelSchema = object({
16001
16287
  firstAt: number$1(),
16002
16288
  lastAt: number$1()
16003
16289
  });
16290
+ /**
16291
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16292
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16293
+ * linked sensor/control state change (no positions; carries a snapshot). The
16294
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16295
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16296
+ */
16297
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16004
16298
  var TrackSchema = object({
16005
16299
  trackId: string(),
16006
16300
  deviceId: number$1(),
16007
16301
  className: string(),
16008
16302
  label: string().optional(),
16303
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16304
+ source: TrackSourceSchema.optional(),
16009
16305
  firstSeen: number$1(),
16010
16306
  lastSeen: number$1(),
16011
16307
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16382,6 +16678,76 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
16382
16678
  eventId: string(),
16383
16679
  timestamp: number$1()
16384
16680
  });
16681
+ /**
16682
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16683
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16684
+ * caps into per-camera event-kind descriptors.
16685
+ *
16686
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16687
+ * is NOT duplicated here — every entry is derived from the single
16688
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16689
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16690
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16691
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16692
+ * eventful cap is missing.
16693
+ */
16694
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16695
+ var LEGACY_ICON = {
16696
+ motion: "motion",
16697
+ audio: "audio",
16698
+ person: "person",
16699
+ vehicle: "vehicle",
16700
+ animal: "animal",
16701
+ package: "package",
16702
+ door: "door",
16703
+ pir: "pir",
16704
+ smoke: "smoke",
16705
+ water: "water",
16706
+ button: "button",
16707
+ generic: "generic",
16708
+ gas: "smoke",
16709
+ vibration: "generic",
16710
+ tamper: "generic",
16711
+ presence: "person",
16712
+ lock: "generic",
16713
+ siren: "generic",
16714
+ switch: "generic",
16715
+ doorbell: "button"
16716
+ };
16717
+ function legacyIcon(iconId) {
16718
+ return LEGACY_ICON[iconId] ?? "generic";
16719
+ }
16720
+ /**
16721
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16722
+ * The anti-drift guard cross-checks this against the eventful caps declared
16723
+ * in `packages/types/src/capabilities/*.cap.ts`.
16724
+ */
16725
+ var CAP_TO_KIND = {
16726
+ contact: "contact",
16727
+ motion: "motion-sensor",
16728
+ smoke: "smoke",
16729
+ flood: "flood",
16730
+ gas: "gas",
16731
+ "carbon-monoxide": "carbon-monoxide",
16732
+ vibration: "vibration",
16733
+ tamper: "tamper",
16734
+ presence: "presence",
16735
+ "enum-sensor": "enum-sensor",
16736
+ "event-emitter": "device-event",
16737
+ "lock-control": "lock",
16738
+ switch: "switch",
16739
+ button: "button",
16740
+ doorbell: "doorbell"
16741
+ };
16742
+ function buildDescriptor(capName, kind) {
16743
+ const t = EVENT_TAXONOMY[kind];
16744
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16745
+ return {
16746
+ ...t,
16747
+ icon: legacyIcon(t.iconId)
16748
+ };
16749
+ }
16750
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16385
16751
  var CameraPipelineConfigSchema = object({
16386
16752
  engine: PipelineEngineChoiceSchema.optional(),
16387
16753
  steps: array(PipelineStepInputSchema).readonly(),
@@ -7676,6 +7676,160 @@ var EncodeProfileSchema = object({
7676
7676
  */
7677
7677
  outputArgs: array(string()).optional()
7678
7678
  });
7679
+ var COCO_TO_MACRO = {
7680
+ mapping: {
7681
+ person: "person",
7682
+ bicycle: "vehicle",
7683
+ car: "vehicle",
7684
+ motorcycle: "vehicle",
7685
+ airplane: "vehicle",
7686
+ bus: "vehicle",
7687
+ train: "vehicle",
7688
+ truck: "vehicle",
7689
+ boat: "vehicle",
7690
+ bird: "animal",
7691
+ cat: "animal",
7692
+ dog: "animal",
7693
+ horse: "animal",
7694
+ sheep: "animal",
7695
+ cow: "animal",
7696
+ elephant: "animal",
7697
+ bear: "animal",
7698
+ zebra: "animal",
7699
+ giraffe: "animal",
7700
+ suitcase: "package",
7701
+ backpack: "package",
7702
+ handbag: "package"
7703
+ },
7704
+ preserveOriginal: false
7705
+ };
7706
+ var AUDIO_MACRO_LABELS = [
7707
+ {
7708
+ id: "speech",
7709
+ name: "Speech",
7710
+ icon: "🗣️"
7711
+ },
7712
+ {
7713
+ id: "scream",
7714
+ name: "Scream / Shout",
7715
+ icon: "😱"
7716
+ },
7717
+ {
7718
+ id: "crying",
7719
+ name: "Crying / Baby",
7720
+ icon: "😢"
7721
+ },
7722
+ {
7723
+ id: "laughter",
7724
+ name: "Laughter",
7725
+ icon: "😂"
7726
+ },
7727
+ {
7728
+ id: "music",
7729
+ name: "Music",
7730
+ icon: "🎵"
7731
+ },
7732
+ {
7733
+ id: "dog",
7734
+ name: "Dog",
7735
+ icon: "🐕"
7736
+ },
7737
+ {
7738
+ id: "cat",
7739
+ name: "Cat",
7740
+ icon: "🐈"
7741
+ },
7742
+ {
7743
+ id: "bird",
7744
+ name: "Bird",
7745
+ icon: "🐦"
7746
+ },
7747
+ {
7748
+ id: "animal",
7749
+ name: "Animal (other)",
7750
+ icon: "🐾"
7751
+ },
7752
+ {
7753
+ id: "alarm",
7754
+ name: "Alarm / Siren",
7755
+ icon: "🚨"
7756
+ },
7757
+ {
7758
+ id: "doorbell",
7759
+ name: "Doorbell / Knock",
7760
+ icon: "🔔"
7761
+ },
7762
+ {
7763
+ id: "glass_breaking",
7764
+ name: "Glass Breaking",
7765
+ icon: "💥"
7766
+ },
7767
+ {
7768
+ id: "gunshot",
7769
+ name: "Gunshot / Explosion",
7770
+ icon: "💣"
7771
+ },
7772
+ {
7773
+ id: "vehicle",
7774
+ name: "Vehicle",
7775
+ icon: "🚗"
7776
+ },
7777
+ {
7778
+ id: "siren",
7779
+ name: "Emergency Siren",
7780
+ icon: "🚑"
7781
+ },
7782
+ {
7783
+ id: "fire",
7784
+ name: "Fire / Smoke",
7785
+ icon: "🔥"
7786
+ },
7787
+ {
7788
+ id: "water",
7789
+ name: "Water",
7790
+ icon: "💧"
7791
+ },
7792
+ {
7793
+ id: "wind",
7794
+ name: "Wind / Weather",
7795
+ icon: "🌬️"
7796
+ },
7797
+ {
7798
+ id: "door",
7799
+ name: "Door",
7800
+ icon: "🚪"
7801
+ },
7802
+ {
7803
+ id: "footsteps",
7804
+ name: "Footsteps",
7805
+ icon: "👣"
7806
+ },
7807
+ {
7808
+ id: "crowd",
7809
+ name: "Crowd / Chatter",
7810
+ icon: "👥"
7811
+ },
7812
+ {
7813
+ id: "telephone",
7814
+ name: "Telephone",
7815
+ icon: "📞"
7816
+ },
7817
+ {
7818
+ id: "engine",
7819
+ name: "Engine / Motor",
7820
+ icon: "⚙️"
7821
+ },
7822
+ {
7823
+ id: "tools",
7824
+ name: "Tools / Construction",
7825
+ icon: "🔨"
7826
+ },
7827
+ {
7828
+ id: "silence",
7829
+ name: "Silence",
7830
+ icon: "🤫"
7831
+ }
7832
+ ];
7679
7833
  var YAMNET_TO_MACRO = {
7680
7834
  mapping: {
7681
7835
  Speech: "speech",
@@ -7942,6 +8096,125 @@ var _macroLookup = /* @__PURE__ */ new Map();
7942
8096
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7943
8097
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7944
8098
  /**
8099
+ * Unified event-kind taxonomy — THE single source of truth for
8100
+ * `kind → { parentKind, category, level, color, iconId, labelKey, label,
8101
+ * icon }`.
8102
+ *
8103
+ * This dictionary folds together what used to be scattered across four
8104
+ * copies:
8105
+ * - `capabilities/sensor-event-kinds.ts` (sensor cap colors)
8106
+ * - `addon-post-analysis/.../services/event-kinds.ts`
8107
+ * (MOTION/PERSON/VEHICLE… _COLOR constants)
8108
+ * - `ui-library/composites/detection-colors.ts` (CLASS_COLORS)
8109
+ * - `addon-post-analysis/shared/frame/box-drawer.ts` (DEFAULT_COLOR)
8110
+ * - the COCO / audio class maps (macro ↔ sub relationships)
8111
+ *
8112
+ * The DATA (serializable — color/iconId/labelKey/parentKind) lives here in
8113
+ * `@camstack/types`. The UI-side mapping `iconId → lucide component` and
8114
+ * `labelKey → t()` lives in `@camstack/ui-library`. UIs never hardcode a
8115
+ * color or an icon: they read this dictionary (server descriptors carry the
8116
+ * fields inline; the client resolves color/icon/label from `iconId`/`kind`).
8117
+ *
8118
+ * Two levels only (v1 YAGNI): macro → sub. `person` is a leaf macro.
8119
+ */
8120
+ var TAXONOMY_COLORS = {
8121
+ motion: "#f59e0b",
8122
+ audio: "#06b6d4",
8123
+ person: "#22c55e",
8124
+ vehicle: "#3b82f6",
8125
+ animal: "#f97316",
8126
+ package: "#a855f7",
8127
+ sensor: "#8b5cf6",
8128
+ control: "#10b981",
8129
+ genericDetection: "#64748b"
8130
+ };
8131
+ var DETECTION_SUB_COLORS = {
8132
+ car: "#f59e0b",
8133
+ truck: "#d97706",
8134
+ bus: "#b45309",
8135
+ motorcycle: "#eab308",
8136
+ bicycle: "#ca8a04",
8137
+ airplane: "#60a5fa",
8138
+ boat: "#2563eb",
8139
+ train: "#1d4ed8",
8140
+ bird: "#14b8a6",
8141
+ dog: "#84cc16",
8142
+ cat: "#f97316",
8143
+ horse: "#a16207",
8144
+ sheep: "#a3a3a3",
8145
+ cow: "#78716c",
8146
+ elephant: "#6b7280",
8147
+ bear: "#7c2d12",
8148
+ zebra: "#404040",
8149
+ giraffe: "#d4a373"
8150
+ };
8151
+ function titleCase(id) {
8152
+ return id.split(/[-_ ]/).filter((p) => p.length > 0).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
8153
+ }
8154
+ var entries = /* @__PURE__ */ new Map();
8155
+ function macro(kind, category, color, iconId, label) {
8156
+ entries.set(kind, {
8157
+ kind,
8158
+ parentKind: null,
8159
+ level: "macro",
8160
+ category,
8161
+ color,
8162
+ iconId,
8163
+ labelKey: `eventKind.${kind}`,
8164
+ label
8165
+ });
8166
+ }
8167
+ function sub(kind, parentKind, category, color, iconId, label) {
8168
+ entries.set(kind, {
8169
+ kind,
8170
+ parentKind,
8171
+ level: "sub",
8172
+ category,
8173
+ color,
8174
+ iconId,
8175
+ labelKey: `eventKind.${kind}`,
8176
+ label
8177
+ });
8178
+ }
8179
+ macro("motion", "motion", TAXONOMY_COLORS.motion, "motion", "Motion");
8180
+ macro("audio", "audio", TAXONOMY_COLORS.audio, "audio", "Audio");
8181
+ macro("person", "detection", TAXONOMY_COLORS.person, "person", "Person");
8182
+ macro("vehicle", "detection", TAXONOMY_COLORS.vehicle, "vehicle", "Vehicle");
8183
+ macro("animal", "detection", TAXONOMY_COLORS.animal, "animal", "Animal");
8184
+ macro("package", "package", TAXONOMY_COLORS.package, "package", "Package");
8185
+ macro("sensor", "sensor", TAXONOMY_COLORS.sensor, "sensor", "Sensor");
8186
+ macro("control", "control", TAXONOMY_COLORS.control, "control", "Control");
8187
+ for (const [cocoClass, macroClass] of Object.entries(COCO_TO_MACRO.mapping)) {
8188
+ if (macroClass !== "vehicle" && macroClass !== "animal") continue;
8189
+ if (entries.has(cocoClass)) continue;
8190
+ sub(cocoClass, macroClass, "detection", DETECTION_SUB_COLORS[cocoClass] ?? TAXONOMY_COLORS.genericDetection, cocoClass, titleCase(cocoClass));
8191
+ }
8192
+ sub("package-delivered", "package", "package", TAXONOMY_COLORS.package, "package", "Package delivered");
8193
+ sub("package-picked-up", "package", "package", TAXONOMY_COLORS.package, "package", "Package picked up");
8194
+ sub("contact", "sensor", "sensor", "#f59e0b", "door", "Contact");
8195
+ sub("motion-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "pir", "Motion sensor");
8196
+ sub("smoke", "sensor", "sensor", "#ef4444", "smoke", "Smoke");
8197
+ sub("flood", "sensor", "sensor", "#3b82f6", "water", "Water leak");
8198
+ sub("gas", "sensor", "sensor", "#ef4444", "gas", "Gas");
8199
+ sub("carbon-monoxide", "sensor", "sensor", "#dc2626", "smoke", "Carbon monoxide");
8200
+ sub("vibration", "sensor", "sensor", "#eab308", "vibration", "Vibration");
8201
+ sub("tamper", "sensor", "sensor", "#f97316", "tamper", "Tamper");
8202
+ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
8203
+ sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
8204
+ sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
8205
+ sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
8206
+ sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
8207
+ sub("siren", "control", "control", "#dc2626", "siren", "Siren");
8208
+ sub("button", "control", "control", "#10b981", "button", "Button");
8209
+ sub("doorbell", "control", "control", "#a855f7", "doorbell", "Doorbell");
8210
+ for (const l of AUDIO_MACRO_LABELS) {
8211
+ const kind = `audio-${l.id}`;
8212
+ if (entries.has(kind)) continue;
8213
+ sub(kind, "audio", "audio", TAXONOMY_COLORS.audio, kind, l.name);
8214
+ }
8215
+ /** The complete taxonomy dictionary, keyed by kind. */
8216
+ var EVENT_TAXONOMY = Object.freeze(Object.fromEntries(entries));
8217
+ /**
7945
8218
  * Error types for the safe expression engine. Two distinct classes so callers
7946
8219
  * can tell a compile-time (grammar) failure from a runtime (evaluation)
7947
8220
  * failure — both are non-fatal to the host: read paths degrade to "skip link".
@@ -15916,17 +16189,30 @@ var EventKindCategorySchema = _enum([
15916
16189
  "audio",
15917
16190
  "detection",
15918
16191
  "sensor",
16192
+ "control",
15919
16193
  "custom",
15920
16194
  "package"
15921
16195
  ]);
16196
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
16197
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
15922
16198
  var EventKindDescriptorSchema = object({
15923
- /** Stable kind id (e.g. 'motion', 'person', 'contact'). */
16199
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
15924
16200
  kind: string(),
16201
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
16202
+ labelKey: string(),
16203
+ /** English fallback label (kept for clients that don't translate). */
15925
16204
  label: string(),
15926
16205
  /** Hex color for timeline/legend rendering. */
15927
16206
  color: string(),
16207
+ /** Dictionary id → lucide component on the UI side. */
16208
+ iconId: string(),
16209
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
15928
16210
  icon: EventKindIconSchema,
15929
16211
  category: EventKindCategorySchema,
16212
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
16213
+ parentKind: string().nullable(),
16214
+ /** Derived from `parentKind`, explicit for the client tree. */
16215
+ level: EventKindLevelSchema,
15930
16216
  /** Which cap + device contributes this kind. For built-ins the camera
15931
16217
  * itself; for sensor kinds the LINKED source device. */
15932
16218
  source: object({
@@ -15999,11 +16285,21 @@ var TrackAudioLabelSchema = object({
15999
16285
  firstAt: number$1(),
16000
16286
  lastAt: number$1()
16001
16287
  });
16288
+ /**
16289
+ * How a track was produced. `pipeline` (default / absent) = the spatial
16290
+ * detection+tracking pipeline. `sensor` = a SYNTHETIC track projected from a
16291
+ * linked sensor/control state change (no positions; carries a snapshot). The
16292
+ * spatial subsystems (tracker association, occupancy count, re-id/embedding,
16293
+ * resurrection) MUST skip `sensor` tracks — they have no bbox trajectory.
16294
+ */
16295
+ var TrackSourceSchema = _enum(["pipeline", "sensor"]);
16002
16296
  var TrackSchema = object({
16003
16297
  trackId: string(),
16004
16298
  deviceId: number$1(),
16005
16299
  className: string(),
16006
16300
  label: string().optional(),
16301
+ /** Track provenance. Absent ⇒ `pipeline` (legacy rows). */
16302
+ source: TrackSourceSchema.optional(),
16007
16303
  firstSeen: number$1(),
16008
16304
  lastSeen: number$1(),
16009
16305
  /** Frame-rate position history (subject to maxPositionHistory cap). */
@@ -16380,6 +16676,76 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
16380
16676
  eventId: string(),
16381
16677
  timestamp: number$1()
16382
16678
  });
16679
+ /**
16680
+ * Cap → event-kind mapping for the SENSOR / CONTROL cap families — the table
16681
+ * `pipeline-analytics.listEventKinds` uses to turn a linked device's bound
16682
+ * caps into per-camera event-kind descriptors.
16683
+ *
16684
+ * The descriptor DATA (color / iconId / labelKey / parentKind / category)
16685
+ * is NOT duplicated here — every entry is derived from the single
16686
+ * `EVENT_TAXONOMY` dictionary (`catalogs/event-taxonomy.ts`). This file owns
16687
+ * ONLY the cap-name → taxonomy-kind mapping. Adding a new eventful sensor /
16688
+ * control cap means adding one line here (and a taxonomy entry); the anti-
16689
+ * drift guard `scripts/check-event-kind-coverage.ts` fails the build if an
16690
+ * eventful cap is missing.
16691
+ */
16692
+ /** Map a taxonomy `iconId` onto the legacy closed `EventKindIcon` enum. */
16693
+ var LEGACY_ICON = {
16694
+ motion: "motion",
16695
+ audio: "audio",
16696
+ person: "person",
16697
+ vehicle: "vehicle",
16698
+ animal: "animal",
16699
+ package: "package",
16700
+ door: "door",
16701
+ pir: "pir",
16702
+ smoke: "smoke",
16703
+ water: "water",
16704
+ button: "button",
16705
+ generic: "generic",
16706
+ gas: "smoke",
16707
+ vibration: "generic",
16708
+ tamper: "generic",
16709
+ presence: "person",
16710
+ lock: "generic",
16711
+ siren: "generic",
16712
+ switch: "generic",
16713
+ doorbell: "button"
16714
+ };
16715
+ function legacyIcon(iconId) {
16716
+ return LEGACY_ICON[iconId] ?? "generic";
16717
+ }
16718
+ /**
16719
+ * Cap name → taxonomy kind id. Covers EVERY eventful sensor / control cap.
16720
+ * The anti-drift guard cross-checks this against the eventful caps declared
16721
+ * in `packages/types/src/capabilities/*.cap.ts`.
16722
+ */
16723
+ var CAP_TO_KIND = {
16724
+ contact: "contact",
16725
+ motion: "motion-sensor",
16726
+ smoke: "smoke",
16727
+ flood: "flood",
16728
+ gas: "gas",
16729
+ "carbon-monoxide": "carbon-monoxide",
16730
+ vibration: "vibration",
16731
+ tamper: "tamper",
16732
+ presence: "presence",
16733
+ "enum-sensor": "enum-sensor",
16734
+ "event-emitter": "device-event",
16735
+ "lock-control": "lock",
16736
+ switch: "switch",
16737
+ button: "button",
16738
+ doorbell: "doorbell"
16739
+ };
16740
+ function buildDescriptor(capName, kind) {
16741
+ const t = EVENT_TAXONOMY[kind];
16742
+ if (t === void 0) throw new Error(`EVENT_KIND_BY_CAP: cap '${capName}' maps to unknown taxonomy kind '${kind}'`);
16743
+ return {
16744
+ ...t,
16745
+ icon: legacyIcon(t.iconId)
16746
+ };
16747
+ }
16748
+ Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
16383
16749
  var CameraPipelineConfigSchema = object({
16384
16750
  engine: PipelineEngineChoiceSchema.optional(),
16385
16751
  steps: array(PipelineStepInputSchema).readonly(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-ha-mqtt",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "HomeAssistant MQTT discovery exporter for CamStack devices. Publishes discovery topics so HA auto-creates entities for exposed cameras/switches/intercoms/sensors.",
5
5
  "keywords": [
6
6
  "camstack",