@matter-server/dashboard 1.3.0 → 1.3.1

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.
Files changed (49) hide show
  1. package/dist/esm/client/models/descriptions.d.ts +8 -0
  2. package/dist/esm/client/models/descriptions.d.ts.map +1 -1
  3. package/dist/esm/client/models/descriptions.js +2049 -81
  4. package/dist/esm/client/models/descriptions.js.map +1 -1
  5. package/dist/esm/components/webrtc-stream-view.d.ts +22 -1
  6. package/dist/esm/components/webrtc-stream-view.d.ts.map +1 -1
  7. package/dist/esm/components/webrtc-stream-view.js +104 -80
  8. package/dist/esm/components/webrtc-stream-view.js.map +1 -1
  9. package/dist/esm/pages/camera-overlay.d.ts +1 -0
  10. package/dist/esm/pages/camera-overlay.d.ts.map +1 -1
  11. package/dist/esm/pages/camera-overlay.js +10 -4
  12. package/dist/esm/pages/camera-overlay.js.map +1 -1
  13. package/dist/esm/pages/components/node-details.d.ts.map +1 -1
  14. package/dist/esm/pages/components/node-details.js +14 -4
  15. package/dist/esm/pages/components/node-details.js.map +1 -1
  16. package/dist/esm/pages/matter-cluster-view.d.ts +1 -0
  17. package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
  18. package/dist/esm/pages/matter-cluster-view.js +64 -0
  19. package/dist/esm/pages/matter-cluster-view.js.map +1 -1
  20. package/dist/esm/util/camera.d.ts +7 -0
  21. package/dist/esm/util/camera.d.ts.map +1 -1
  22. package/dist/esm/util/camera.js +7 -1
  23. package/dist/esm/util/camera.js.map +1 -1
  24. package/dist/esm/util/cluster-features.d.ts +8 -0
  25. package/dist/esm/util/cluster-features.d.ts.map +1 -0
  26. package/dist/esm/util/cluster-features.js +14 -0
  27. package/dist/esm/util/cluster-features.js.map +6 -0
  28. package/dist/web/js/{attribute-write-dialog-Bdg5QUXX.js → attribute-write-dialog-UxEN5w8r.js} +1 -1
  29. package/dist/web/js/{command-invoke-dialog-BXBss5sm.js → command-invoke-dialog-CVXU-ZoZ.js} +1 -1
  30. package/dist/web/js/{commission-node-dialog-JvFwNpuW.js → commission-node-dialog-D5HIBPy_.js} +5 -5
  31. package/dist/web/js/{commission-node-existing-DaHKu2E3.js → commission-node-existing-Bniw0yfY.js} +1 -1
  32. package/dist/web/js/{commission-node-thread-U9sFT51X.js → commission-node-thread-D7w0p3f2.js} +1 -1
  33. package/dist/web/js/{commission-node-wifi-BkNcTxuy.js → commission-node-wifi-DeTq4twp.js} +1 -1
  34. package/dist/web/js/{dialog-box-Cn3JA0xi.js → dialog-box-DkTPEszi.js} +1 -1
  35. package/dist/web/js/{fabric-label-dialog-BLzecxP3.js → fabric-label-dialog-8kIYOl4q.js} +1 -1
  36. package/dist/web/js/main.js +1 -1
  37. package/dist/web/js/{matter-dashboard-app-KaEKzt4L.js → matter-dashboard-app-BBGILOPg.js} +2232 -162
  38. package/dist/web/js/{node-acl-add-dialog-B5G0k15F.js → node-acl-add-dialog-KiDTJk-M.js} +1 -1
  39. package/dist/web/js/{node-binding-dialog-fPE92bGT.js → node-binding-dialog-DffAwr6H.js} +1 -1
  40. package/dist/web/js/{node-label-dialog-B9pZzv7_.js → node-label-dialog-DhRlTzGl.js} +1 -1
  41. package/dist/web/js/{settings-dialog-CmhSbsTn.js → settings-dialog-BOy5I7JW.js} +1 -1
  42. package/package.json +4 -4
  43. package/src/client/models/descriptions.ts +2053 -78
  44. package/src/components/webrtc-stream-view.ts +150 -101
  45. package/src/pages/camera-overlay.ts +15 -4
  46. package/src/pages/components/node-details.ts +16 -4
  47. package/src/pages/matter-cluster-view.ts +73 -0
  48. package/src/util/camera.ts +12 -0
  49. package/src/util/cluster-features.ts +17 -0
@@ -7,6 +7,7 @@
7
7
  import { consume } from "@lit/context";
8
8
  import type {
9
9
  MatterClient,
10
+ MatterNode,
10
11
  WebRtcAnswerData,
11
12
  WebRtcCallbackData,
12
13
  WebRtcIceCandidatesData,
@@ -36,9 +37,13 @@ const END_REASON_USER_HANGUP = 2;
36
37
  export const CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID = 0x551;
37
38
  const WEBRTC_TRANSPORT_PROVIDER_CLUSTER_ID = 0x553;
38
39
 
39
- // AVSM FeatureMap bits (spec §11.2.4): SNP=2 enables snapshot streams, WMARK=6
40
- // enables watermark overlay, OSD=7 enables on-screen display. When advertised,
41
- // VideoStreamAllocate and SnapshotStreamAllocate REQUIRE watermarkEnabled / osdEnabled fields.
40
+ // AVSM FeatureMap bits (spec §11.2.4): ADO=0 audio, VDO=1 gates VideoStreamAllocate —
41
+ // audio-only devices such as Audio Doorbell advertise ADO without VDO — SNP=2 enables
42
+ // snapshot streams, WMARK=6 enables watermark overlay, OSD=7 enables on-screen display.
43
+ // When advertised, VideoStreamAllocate and SnapshotStreamAllocate REQUIRE
44
+ // watermarkEnabled / osdEnabled fields.
45
+ export const AVSM_FEAT_ADO = 1 << 0;
46
+ export const AVSM_FEAT_VDO = 1 << 1;
42
47
  export const AVSM_FEAT_SNP = 1 << 2;
43
48
  export const AVSM_FEAT_WMARK = 1 << 6;
44
49
  export const AVSM_FEAT_OSD = 1 << 7;
@@ -47,6 +52,44 @@ export const AVSM_FEATURE_MAP_ATTR_ID = 0xfffc;
47
52
  // snapshot streams draw from.
48
53
  const AVSM_MAX_ENCODED_PIXEL_RATE_ATTR_ID = 0x1;
49
54
 
55
+ export interface AvsmFeatures {
56
+ // false until the FeatureMap attribute is cached; callers must not read a missing FeatureMap
57
+ // as "no video" (that would skip VideoStreamAllocate on a real camera whose attribute is late).
58
+ known: boolean;
59
+ ado: boolean;
60
+ vdo: boolean;
61
+ snp: boolean;
62
+ wmark: boolean;
63
+ osd: boolean;
64
+ }
65
+
66
+ /**
67
+ * Reads the AVSM FeatureMap (spec §11.2.4) for a node/endpoint's CameraAvStreamManagement
68
+ * cluster. Audio-only devices (Intercom, Audio Doorbell) advertise Audio without Video (vdo).
69
+ */
70
+ export function readAvsmFeatures(node: MatterNode | undefined, endpoint: number): AvsmFeatures {
71
+ const raw = node?.attributes[`${endpoint}/${CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID}/${AVSM_FEATURE_MAP_ATTR_ID}`];
72
+ const known = typeof raw === "number";
73
+ const bits = known ? raw : 0;
74
+ return {
75
+ known,
76
+ ado: (bits & AVSM_FEAT_ADO) !== 0,
77
+ vdo: (bits & AVSM_FEAT_VDO) !== 0,
78
+ snp: (bits & AVSM_FEAT_SNP) !== 0,
79
+ wmark: (bits & AVSM_FEAT_WMARK) !== 0,
80
+ osd: (bits & AVSM_FEAT_OSD) !== 0,
81
+ };
82
+ }
83
+
84
+ /**
85
+ * Audio-only live view: the FeatureMap is known and does not advertise Video. When the FeatureMap
86
+ * hasn't arrived we assume video-capable, so a late attribute can't strand a real camera in an
87
+ * audio-only session (and VideoStreamAllocate is still attempted).
88
+ */
89
+ export function isAudioOnlyAvsm(features: AvsmFeatures): boolean {
90
+ return features.known && !features.vdo;
91
+ }
92
+
50
93
  const DEFAULT_MAX_RESOLUTION = { width: 1920, height: 1080 };
51
94
  const DEFAULT_MIN_RESOLUTION = { width: 640, height: 480 };
52
95
 
@@ -299,8 +342,10 @@ export class WebRtcStreamView extends LitElement {
299
342
  try {
300
343
  const pc = new RTCPeerConnection({ iceServers: [] });
301
344
  this._pc = pc;
345
+ const avsmFeatures = this._readAvsmFeatures();
346
+ const audioOnly = isAudioOnlyAvsm(avsmFeatures);
302
347
 
303
- pc.addTransceiver("video", { direction: "recvonly" });
348
+ if (!audioOnly) pc.addTransceiver("video", { direction: "recvonly" });
304
349
  pc.addTransceiver("audio", { direction: "recvonly" });
305
350
 
306
351
  pc.onicecandidate = ev => {
@@ -355,73 +400,61 @@ export class WebRtcStreamView extends LitElement {
355
400
 
356
401
  const minResolution = this.resolution ?? DEFAULT_MIN_RESOLUTION;
357
402
  const maxResolution = this.resolution ?? DEFAULT_MAX_RESOLUTION;
358
- const avsmFeatures = this._readAvsmFeatures();
359
403
  const maxEncodedPixelRate = this._readMaxEncodedPixelRate();
360
404
  const snapshotReservation = this._snapshotBudgetReservation();
361
- // Reserving the whole MaxEncodedPixelRate (e.g. 1080p@120) starves a concurrent
362
- // SnapshotStreamAllocate (ResourceExhausted); size the video rate to leave the
363
- // snapshot stream room within the shared encoder budget.
364
- const videoMaxFrameRate = planVideoMaxFrameRate({
365
- maxEncodedPixelRate,
366
- videoResolution: maxResolution,
367
- snapshotReservation,
368
- });
369
- const videoAllocPayload: Record<string, unknown> = {
370
- streamUsage: STREAM_USAGE_LIVE_VIEW,
371
- videoCodec: 0,
372
- minFrameRate: Math.min(VIDEO_MIN_FRAME_RATE, videoMaxFrameRate),
373
- maxFrameRate: videoMaxFrameRate,
374
- minResolution,
375
- maxResolution,
376
- minBitRate: 10000,
377
- maxBitRate: 10000,
378
- keyFrameInterval: 4000,
379
- };
380
- if (avsmFeatures.wmark) videoAllocPayload.watermarkEnabled = this.watermarkEnabled;
381
- if (avsmFeatures.osd) videoAllocPayload.osdEnabled = this.osdEnabled;
382
-
383
- // Spec §11.2.1.2.1 — server SHALL reuse an existing stream that covers our
384
- // request. Search AllocatedVideoStreams (attr 0x000F) first to avoid even
385
- // sending VideoStreamAllocate when a usable stream is already in place. Skip
386
- // candidates that over-reserve the encoder budget so reuse can't reintroduce
387
- // the snapshot ResourceExhausted a fresh allocation avoids.
388
- const videoWant = {
389
- streamUsage: STREAM_USAGE_LIVE_VIEW,
390
- videoCodec: 0,
391
- minRes: minResolution,
392
- maxRes: maxResolution,
393
- watermarkEnabled: avsmFeatures.wmark ? this.watermarkEnabled : undefined,
394
- osdEnabled: avsmFeatures.osd ? this.osdEnabled : undefined,
395
- budget: { maxEncodedPixelRate, snapshotReservation },
396
- };
397
- const reusedVideoId = this._findMatchingVideoStream(videoWant);
398
- let videoAlloc: unknown = null;
399
- let usedFallbackReuse = false;
400
- if (reusedVideoId !== null) {
401
- console.info("[webrtc-stream-view] reusing existing video stream", reusedVideoId);
402
- this._videoStreamId = reusedVideoId;
405
+
406
+ if (audioOnly) {
407
+ // Audio-only devices (e.g. Audio Doorbell) don't advertise VDO: VideoStreamAllocate
408
+ // isn't in their AcceptedCommandList and would fail with UnsupportedCommand
409
+ // (code 129). Skip video entirely and stream audio-only.
410
+ this._videoStreamId = null;
403
411
  this._videoStreamOwned = false;
404
412
  } else {
405
- try {
406
- videoAlloc = await this.client.deviceCommand(
407
- this.nodeId,
408
- this.endpointId,
409
- CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID,
410
- "VideoStreamAllocate",
411
- videoAllocPayload,
412
- );
413
- } catch (err) {
414
- const message = err instanceof Error ? err.message : String(err);
415
- const isResourceExhausted =
416
- message.includes("Resource exhausted") || message.includes("(code 137)");
417
- if (!isResourceExhausted) throw err;
418
- // Cameras with a shared encoder pool refuse VideoStreamAllocate while a snapshot
419
- // stream is held — free ours and retry once.
420
- if (this._snapshotStreamId !== null) {
421
- console.info(
422
- "[webrtc-stream-view] VideoStreamAllocate ResourceExhausted; freeing snapshot stream and retrying",
423
- );
424
- await this._runSerialized(() => this.deallocateSnapshot());
413
+ // Reserving the whole MaxEncodedPixelRate (e.g. 1080p@120) starves a concurrent
414
+ // SnapshotStreamAllocate (ResourceExhausted); size the video rate to leave the
415
+ // snapshot stream room within the shared encoder budget.
416
+ const videoMaxFrameRate = planVideoMaxFrameRate({
417
+ maxEncodedPixelRate,
418
+ videoResolution: maxResolution,
419
+ snapshotReservation,
420
+ });
421
+ const videoAllocPayload: Record<string, unknown> = {
422
+ streamUsage: STREAM_USAGE_LIVE_VIEW,
423
+ videoCodec: 0,
424
+ minFrameRate: Math.min(VIDEO_MIN_FRAME_RATE, videoMaxFrameRate),
425
+ maxFrameRate: videoMaxFrameRate,
426
+ minResolution,
427
+ maxResolution,
428
+ minBitRate: 10000,
429
+ maxBitRate: 10000,
430
+ keyFrameInterval: 4000,
431
+ };
432
+ if (avsmFeatures.wmark) videoAllocPayload.watermarkEnabled = this.watermarkEnabled;
433
+ if (avsmFeatures.osd) videoAllocPayload.osdEnabled = this.osdEnabled;
434
+
435
+ // Spec §11.2.1.2.1 — server SHALL reuse an existing stream that covers our
436
+ // request. Search AllocatedVideoStreams (attr 0x000F) first to avoid even
437
+ // sending VideoStreamAllocate when a usable stream is already in place. Skip
438
+ // candidates that over-reserve the encoder budget so reuse can't reintroduce
439
+ // the snapshot ResourceExhausted a fresh allocation avoids.
440
+ const videoWant = {
441
+ streamUsage: STREAM_USAGE_LIVE_VIEW,
442
+ videoCodec: 0,
443
+ minRes: minResolution,
444
+ maxRes: maxResolution,
445
+ watermarkEnabled: avsmFeatures.wmark ? this.watermarkEnabled : undefined,
446
+ osdEnabled: avsmFeatures.osd ? this.osdEnabled : undefined,
447
+ budget: { maxEncodedPixelRate, snapshotReservation },
448
+ };
449
+ const reusedVideoId = this._findMatchingVideoStream(videoWant);
450
+ let videoAlloc: unknown = null;
451
+ let usedFallbackReuse = false;
452
+ if (reusedVideoId !== null) {
453
+ console.info("[webrtc-stream-view] reusing existing video stream", reusedVideoId);
454
+ this._videoStreamId = reusedVideoId;
455
+ this._videoStreamOwned = false;
456
+ } else {
457
+ try {
425
458
  videoAlloc = await this.client.deviceCommand(
426
459
  this.nodeId,
427
460
  this.endpointId,
@@ -429,29 +462,49 @@ export class WebRtcStreamView extends LitElement {
429
462
  "VideoStreamAllocate",
430
463
  videoAllocPayload,
431
464
  );
432
- } else {
433
- // The budget is held by a stream we didn't allocate (e.g. another
434
- // controller's 120 fps stream). Fall back to reusing it so live view
435
- // still works; a concurrent snapshot may then be refused.
436
- const fallbackId = this._findMatchingVideoStream({ ...videoWant, budget: undefined });
437
- if (fallbackId === null) throw err;
438
- console.warn(
439
- "[webrtc-stream-view] VideoStreamAllocate ResourceExhausted; reusing over-budget stream",
440
- fallbackId,
441
- "(concurrent snapshot may be unavailable)",
442
- );
443
- this._videoStreamId = fallbackId;
444
- this._videoStreamOwned = false;
445
- usedFallbackReuse = true;
465
+ } catch (err) {
466
+ const message = err instanceof Error ? err.message : String(err);
467
+ const isResourceExhausted =
468
+ message.includes("Resource exhausted") || message.includes("(code 137)");
469
+ if (!isResourceExhausted) throw err;
470
+ // Cameras with a shared encoder pool refuse VideoStreamAllocate while a snapshot
471
+ // stream is held — free ours and retry once.
472
+ if (this._snapshotStreamId !== null) {
473
+ console.info(
474
+ "[webrtc-stream-view] VideoStreamAllocate ResourceExhausted; freeing snapshot stream and retrying",
475
+ );
476
+ await this._runSerialized(() => this.deallocateSnapshot());
477
+ videoAlloc = await this.client.deviceCommand(
478
+ this.nodeId,
479
+ this.endpointId,
480
+ CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID,
481
+ "VideoStreamAllocate",
482
+ videoAllocPayload,
483
+ );
484
+ } else {
485
+ // The budget is held by a stream we didn't allocate (e.g. another
486
+ // controller's 120 fps stream). Fall back to reusing it so live view
487
+ // still works; a concurrent snapshot may then be refused.
488
+ const fallbackId = this._findMatchingVideoStream({ ...videoWant, budget: undefined });
489
+ if (fallbackId === null) throw err;
490
+ console.warn(
491
+ "[webrtc-stream-view] VideoStreamAllocate ResourceExhausted; reusing over-budget stream",
492
+ fallbackId,
493
+ "(concurrent snapshot may be unavailable)",
494
+ );
495
+ this._videoStreamId = fallbackId;
496
+ this._videoStreamOwned = false;
497
+ usedFallbackReuse = true;
498
+ }
446
499
  }
447
- }
448
- if (!usedFallbackReuse) {
449
- const videoStreamId = parseStreamAllocate(videoAlloc, "videoStreamId");
450
- if (videoStreamId === null) {
451
- throw new Error("VideoStreamAllocate did not return a videoStreamId");
500
+ if (!usedFallbackReuse) {
501
+ const videoStreamId = parseStreamAllocate(videoAlloc, "videoStreamId");
502
+ if (videoStreamId === null) {
503
+ throw new Error("VideoStreamAllocate did not return a videoStreamId");
504
+ }
505
+ this._videoStreamId = videoStreamId;
506
+ this._videoStreamOwned = true;
452
507
  }
453
- this._videoStreamId = videoStreamId;
454
- this._videoStreamOwned = true;
455
508
  }
456
509
  }
457
510
 
@@ -484,11 +537,17 @@ export class WebRtcStreamView extends LitElement {
484
537
  this._audioStreamId = parseStreamAllocate(audioAlloc, "audioStreamId");
485
538
  this._audioStreamOwned = this._audioStreamId !== null;
486
539
  } catch (err) {
487
- console.info("AudioStreamAllocate failed; continuing video-only", err);
540
+ console.info("AudioStreamAllocate failed; continuing without audio", err);
488
541
  this._audioStreamId = null;
489
542
  }
490
543
  }
491
544
 
545
+ if (this._videoStreamId === null && this._audioStreamId === null) {
546
+ // Without either stream ProvideOffer requests no media; fail loudly instead of
547
+ // negotiating an empty session (audio-only device whose AudioStreamAllocate failed).
548
+ throw new Error("No media stream allocated: device advertises neither video nor audio");
549
+ }
550
+
492
551
  const offer = await pc.createOffer();
493
552
  await pc.setLocalDescription(offer);
494
553
 
@@ -657,18 +716,8 @@ export class WebRtcStreamView extends LitElement {
657
716
  };
658
717
  }
659
718
 
660
- private _readAvsmFeatures(): { snp: boolean; wmark: boolean; osd: boolean } {
661
- const node = this.client?.nodes[String(this.nodeId)];
662
- const raw =
663
- node?.attributes[
664
- `${this.endpointId}/${CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID}/${AVSM_FEATURE_MAP_ATTR_ID}`
665
- ];
666
- const bits = typeof raw === "number" ? raw : 0;
667
- return {
668
- snp: (bits & AVSM_FEAT_SNP) !== 0,
669
- wmark: (bits & AVSM_FEAT_WMARK) !== 0,
670
- osd: (bits & AVSM_FEAT_OSD) !== 0,
671
- };
719
+ private _readAvsmFeatures(): AvsmFeatures {
720
+ return readAvsmFeatures(this.client?.nodes[String(this.nodeId)], this.endpointId);
672
721
  }
673
722
 
674
723
  private _readMaxEncodedPixelRate(): number | null {
@@ -28,7 +28,7 @@ import "../components/webrtc-stream-view.js";
28
28
  import type { WebRtcStreamView } from "../components/webrtc-stream-view.js";
29
29
  import { asObject, pickNumber } from "../util/attribute-shapes.js";
30
30
  import { hasAvsumOnEndpoint } from "../util/avsum.js";
31
- import { supportsLiveView, supportsSnapshot } from "../util/camera.js";
31
+ import { supportsAudioOnlyLiveView, supportsLiveView, supportsSnapshot } from "../util/camera.js";
32
32
 
33
33
  type StreamState = "idle" | "connecting" | "streaming" | "error";
34
34
 
@@ -163,9 +163,8 @@ export class CameraOverlay extends LitElement {
163
163
  }
164
164
 
165
165
  private _getSensorSize(): { width: number; height: number } | null {
166
- const node = this.client?.nodes[String(this.nodeId)];
167
- if (!node) return null;
168
- const raw = node.attributes[`${this.endpointId}/1361/7`];
166
+ // AVSM VideoSensorParams (attr 0x2): SensorWidth/SensorHeight.
167
+ const raw = this._readCachedAvsmAttribute(0x2);
169
168
  const obj = asObject(raw);
170
169
  if (!obj) return null;
171
170
  const w = pickNumber(obj, "sensorWidth", "0");
@@ -215,6 +214,18 @@ export class CameraOverlay extends LitElement {
215
214
  // stream is being torn down) or a not-yet-allocated null (during connecting).
216
215
  this._activeVideoStreamId =
217
216
  ev.detail.state === "streaming" ? (this._streamViewRef.value?.videoStreamId ?? null) : null;
217
+
218
+ // Audio-only "Listen" sessions have no video; starting muted would defeat the feature, so
219
+ // unmute on stream start. Started from the user's Start click, so autoplay policy allows it.
220
+ if (ev.detail.state === "streaming" && this._isAudioOnly()) {
221
+ this._streamViewRef.value?.setMuted(false);
222
+ this._muted = false;
223
+ }
224
+ }
225
+
226
+ private _isAudioOnly(): boolean {
227
+ const node = this.client?.nodes[String(this.nodeId)];
228
+ return node ? supportsAudioOnlyLiveView(node, this.endpointId) : false;
218
229
  }
219
230
 
220
231
  private _start(): void {
@@ -13,7 +13,16 @@ import "@material/web/list/list";
13
13
  import "@material/web/list/list-item";
14
14
  import { consume } from "@lit/context";
15
15
  import { MatterClient, MatterNode, UpdateSource } from "@matter-server/ws-client";
16
- import { mdiCamera, mdiChatProcessing, mdiPencil, mdiShareVariant, mdiTrashCan, mdiUpdate, mdiVideo } from "@mdi/js";
16
+ import {
17
+ mdiCamera,
18
+ mdiChatProcessing,
19
+ mdiMicrophone,
20
+ mdiPencil,
21
+ mdiShareVariant,
22
+ mdiTrashCan,
23
+ mdiUpdate,
24
+ mdiVideo,
25
+ } from "@mdi/js";
17
26
  import { LitElement, css, html, nothing } from "lit";
18
27
  import { customElement, property, state } from "lit/decorators.js";
19
28
  import { clientContext, tickContext } from "../../client/client-context.js";
@@ -23,7 +32,7 @@ import { showNodeLabelDialog } from "../../components/dialogs/node-label-dialog/
23
32
  import { handleAsync } from "../../util/async-handler.js";
24
33
  import "../../components/ha-svg-icon";
25
34
  import "../camera-overlay.js";
26
- import { supportsCameraOverlay, supportsLiveView } from "../../util/camera.js";
35
+ import { supportsAudioOnlyLiveView, supportsCameraOverlay, supportsLiveView } from "../../util/camera.js";
27
36
  import { getDeviceIcon } from "../../util/device-icons.js";
28
37
  import { getEndpointDeviceTypes } from "../../util/endpoints.js";
29
38
  import { ICD_CLUSTER_ID, icdBadge } from "../../util/icd.js";
@@ -83,6 +92,9 @@ export class NodeDetails extends LitElement {
83
92
 
84
93
  const isCamera = supportsCameraOverlay(this.node, this.endpoint);
85
94
  const isLiveViewCamera = supportsLiveView(this.node, this.endpoint);
95
+ // Audio-only live view (e.g. Audio Doorbell, Intercom) gets its own label/icon rather
96
+ // than "Live View", since no video is actually streamed.
97
+ const isAudioOnly = supportsAudioOnlyLiveView(this.node, this.endpoint);
86
98
  const badge = icdBadge(this.node.attributes, this.node.available);
87
99
 
88
100
  return html`
@@ -164,10 +176,10 @@ export class NodeDetails extends LitElement {
164
176
  @click=${() => this._openCameraOverlay()}
165
177
  ?disabled=${!this.node.available}
166
178
  >
167
- ${isLiveViewCamera ? "Live View" : "Snapshot"}
179
+ ${isAudioOnly ? "Listen" : isLiveViewCamera ? "Live View" : "Snapshot"}
168
180
  <ha-svg-icon
169
181
  slot="icon"
170
- .path=${isLiveViewCamera ? mdiVideo : mdiCamera}
182
+ .path=${isAudioOnly ? mdiMicrophone : isLiveViewCamera ? mdiVideo : mdiCamera}
171
183
  ></ha-svg-icon>
172
184
  </md-outlined-button>
173
185
  `
@@ -24,6 +24,7 @@ import { showCommandInvokeDialog } from "../components/dialogs/dev/show-command-
24
24
  import "../components/ha-svg-icon";
25
25
  import "../pages/components/node-details";
26
26
  // Cluster command components (auto-register on import)
27
+ import { computeActiveClusterFeatures } from "../util/cluster-features.js";
27
28
  import { DevModeService } from "../util/dev-mode-service.js";
28
29
  import { formatHex, formatNodeAddress, getEffectiveFabricIndex } from "../util/format_hex.js";
29
30
  import { notFoundStyles } from "../util/shared-styles.js";
@@ -43,6 +44,9 @@ const GLOBAL_ATTRIBUTE_MAX = 0xffff;
43
44
  // AcceptedCommandList global attribute (lists server-supported command IDs per cluster instance)
44
45
  const ACCEPTED_COMMAND_LIST_ATTR = 0xfff9;
45
46
 
47
+ // FeatureMap global attribute (bitmap of cluster feature flags supported by this instance)
48
+ const FEATURE_MAP_ATTR = 0xfffc;
49
+
46
50
  // How long to flash the refresh icon in success state.
47
51
  const REFRESH_SUCCESS_MS = 600;
48
52
 
@@ -148,6 +152,9 @@ class MatterClusterView extends LitElement {
148
152
  <!-- Developer-mode commands panel -->
149
153
  ${this._devMode ? this._renderDevCommandsPanel() : nothing}
150
154
 
155
+ <!-- Active features panel -->
156
+ ${this._renderFeaturesPanel()}
157
+
151
158
  <!-- Cluster attributes listing -->
152
159
  <div class="container">
153
160
  <md-list>
@@ -341,6 +348,42 @@ class MatterClusterView extends LitElement {
341
348
  });
342
349
  }
343
350
 
351
+ private _renderFeaturesPanel(): TemplateResult | typeof nothing {
352
+ if (this.cluster === undefined || !this.node) return nothing;
353
+
354
+ const clusterMeta = clusters[this.cluster];
355
+ const knownFeatures = Object.values(clusterMeta?.features ?? {});
356
+ if (knownFeatures.length === 0) return nothing;
357
+
358
+ const featureMapValue = this.node.attributes[`${this.endpoint}/${this.cluster}/${FEATURE_MAP_ATTR}`];
359
+ if (featureMapValue === undefined) return nothing;
360
+
361
+ const activeFeatures = computeActiveClusterFeatures(featureMapValue, knownFeatures);
362
+
363
+ return html`
364
+ <div class="container">
365
+ <div class="features-panel">
366
+ <div class="features-panel-header">Active Features</div>
367
+ <div class="features-panel-body">
368
+ ${activeFeatures.length === 0
369
+ ? html`<p class="empty">No active features</p>`
370
+ : html`
371
+ <ul class="feature-chip-list">
372
+ ${activeFeatures.map(
373
+ feature => html`
374
+ <li class="feature-chip" title="Bit ${feature.bit} (${feature.code})">
375
+ ${feature.label}
376
+ </li>
377
+ `,
378
+ )}
379
+ </ul>
380
+ `}
381
+ </div>
382
+ </div>
383
+ </div>
384
+ `;
385
+ }
386
+
344
387
  private async _showAttributeValue(value: any) {
345
388
  showAlertDialog({
346
389
  title: "Attribute value",
@@ -626,6 +669,36 @@ class MatterClusterView extends LitElement {
626
669
  padding: 0 4px;
627
670
  border-radius: 3px;
628
671
  }
672
+
673
+ .features-panel {
674
+ background-color: var(--md-sys-color-surface-container);
675
+ border: 1px solid var(--md-sys-color-outline-variant);
676
+ border-radius: 12px;
677
+ padding: 14px 16px;
678
+ }
679
+
680
+ .features-panel-header {
681
+ font-weight: 500;
682
+ color: var(--md-sys-color-on-surface);
683
+ margin-bottom: 10px;
684
+ }
685
+
686
+ .feature-chip-list {
687
+ list-style: none;
688
+ margin: 0;
689
+ padding: 0;
690
+ display: flex;
691
+ flex-wrap: wrap;
692
+ gap: 8px;
693
+ }
694
+
695
+ .feature-chip {
696
+ font-size: 0.85rem;
697
+ color: var(--md-sys-color-on-secondary-container);
698
+ background: var(--md-sys-color-secondary-container);
699
+ padding: 4px 10px;
700
+ border-radius: 8px;
701
+ }
629
702
  `,
630
703
  ];
631
704
  }
@@ -9,6 +9,8 @@ import {
9
9
  AVSM_FEAT_SNP,
10
10
  AVSM_FEATURE_MAP_ATTR_ID,
11
11
  CAMERA_AV_STREAM_MANAGEMENT_CLUSTER_ID,
12
+ isAudioOnlyAvsm,
13
+ readAvsmFeatures,
12
14
  } from "../components/webrtc-stream-view.js";
13
15
 
14
16
  export const WEBRTC_TRANSPORT_PROVIDER_CLUSTER_ID = 0x553;
@@ -53,3 +55,13 @@ export function supportsSnapshot(node: MatterNode, endpoint: number): boolean {
53
55
  export function supportsCameraOverlay(node: MatterNode, endpoint: number): boolean {
54
56
  return supportsLiveView(node, endpoint) || supportsSnapshot(node, endpoint);
55
57
  }
58
+
59
+ /**
60
+ * True when live view is available and the FeatureMap is known not to advertise Video (VDO) —
61
+ * e.g. Audio Doorbell, Intercom. The session streams audio only, so the UI should say "Listen"
62
+ * rather than "Live View". A device whose FeatureMap hasn't been read yet is not treated as
63
+ * audio-only, so a real camera isn't mislabelled while its attribute is still in flight.
64
+ */
65
+ export function supportsAudioOnlyLiveView(node: MatterNode, endpoint: number): boolean {
66
+ return supportsLiveView(node, endpoint) && isAudioOnlyAvsm(readAvsmFeatures(node, endpoint));
67
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025-2026 Open Home Foundation
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import type { ClusterFeatureDescription } from "../client/models/descriptions.js";
8
+
9
+ // Decode a cluster's FeatureMap bitmap into the subset of its known features that are active.
10
+ export function computeActiveClusterFeatures(
11
+ featureMapValue: unknown,
12
+ knownFeatures: ClusterFeatureDescription[],
13
+ ): ClusterFeatureDescription[] {
14
+ if (featureMapValue === undefined) return [];
15
+ const featureMap = Number(featureMapValue);
16
+ return knownFeatures.filter(feature => (featureMap & (1 << feature.bit)) !== 0).sort((a, b) => a.bit - b.bit);
17
+ }