@matter-server/dashboard 1.3.2-alpha.0-20260725-35ee6c7 → 1.3.2

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 (48) hide show
  1. package/dist/esm/client/models/descriptions.d.ts +12 -0
  2. package/dist/esm/client/models/descriptions.d.ts.map +1 -1
  3. package/dist/esm/client/models/descriptions.js +1480 -1
  4. package/dist/esm/client/models/descriptions.js.map +1 -1
  5. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.d.ts +1 -1
  6. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.d.ts.map +1 -1
  7. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js +3 -3
  8. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js.map +1 -1
  9. package/dist/esm/pages/matter-cluster-view.d.ts +3 -1
  10. package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
  11. package/dist/esm/pages/matter-cluster-view.js +72 -25
  12. package/dist/esm/pages/matter-cluster-view.js.map +1 -1
  13. package/dist/esm/pages/network/network-details.js +10 -10
  14. package/dist/esm/pages/network/update-connections-dialog.d.ts +14 -1
  15. package/dist/esm/pages/network/update-connections-dialog.d.ts.map +1 -1
  16. package/dist/esm/pages/network/update-connections-dialog.js +107 -15
  17. package/dist/esm/pages/network/update-connections-dialog.js.map +1 -1
  18. package/dist/esm/util/icd.d.ts +2 -6
  19. package/dist/esm/util/icd.d.ts.map +1 -1
  20. package/dist/esm/util/icd.js +3 -9
  21. package/dist/esm/util/icd.js.map +1 -1
  22. package/dist/esm/util/semantic-tags.d.ts +31 -0
  23. package/dist/esm/util/semantic-tags.d.ts.map +1 -0
  24. package/dist/esm/util/semantic-tags.js +65 -0
  25. package/dist/esm/util/semantic-tags.js.map +6 -0
  26. package/dist/web/js/{attribute-write-dialog-CkiQUNFq.js → attribute-write-dialog-0cxaSZB5.js} +1 -1
  27. package/dist/web/js/{command-invoke-dialog-Dtye7PDb.js → command-invoke-dialog-_8bFD1ig.js} +1 -1
  28. package/dist/web/js/{commission-node-dialog-Cuo40Dr7.js → commission-node-dialog-V9V2umsa.js} +5 -5
  29. package/dist/web/js/{commission-node-existing-D8RUnS0A.js → commission-node-existing-fdDrRxoL.js} +1 -1
  30. package/dist/web/js/{commission-node-thread-D3yZyn1C.js → commission-node-thread-CQEWKKOl.js} +1 -1
  31. package/dist/web/js/{commission-node-wifi-CFjMNLFK.js → commission-node-wifi-BPNdhbb9.js} +1 -1
  32. package/dist/web/js/{dialog-box-Czucnaxa.js → dialog-box-82Jr5Nw_.js} +1 -1
  33. package/dist/web/js/{fabric-label-dialog-BmtFzYpy.js → fabric-label-dialog-D4Us5kQC.js} +1 -1
  34. package/dist/web/js/main.js +1 -1
  35. package/dist/web/js/{matter-dashboard-app-oMzclOCt.js → matter-dashboard-app-ZHThIPO5.js} +2178 -466
  36. package/dist/web/js/{node-acl-add-dialog-BR9QnhXU.js → node-acl-add-dialog-CQysaUCt.js} +1 -1
  37. package/dist/web/js/{node-binding-dialog-0gvMjLun.js → node-binding-dialog-BFp0rWiU.js} +1 -1
  38. package/dist/web/js/{node-label-dialog-BZr5Z56f.js → node-label-dialog-BJ2n0-fu.js} +1 -1
  39. package/dist/web/js/{settings-dialog-4blntgYl.js → settings-dialog-DE0vIsq8.js} +1 -1
  40. package/package.json +4 -4
  41. package/src/client/models/descriptions.ts +1490 -0
  42. package/src/pages/cluster-commands/AGENTS.md +6 -0
  43. package/src/pages/cluster-commands/clusters/icd-management-commands.ts +3 -6
  44. package/src/pages/matter-cluster-view.ts +83 -29
  45. package/src/pages/network/network-details.ts +10 -10
  46. package/src/pages/network/update-connections-dialog.ts +142 -22
  47. package/src/util/icd.ts +5 -13
  48. package/src/util/semantic-tags.ts +89 -0
@@ -0,0 +1,6 @@
1
+ # cluster-commands — non-obvious invariants
2
+
3
+ - **Panel DOM reuse:** `matter-cluster-view` reuses panel elements across hash navigations (tag keyed by cluster id only). Every async flow must capture `const node = this.node` / `const endpoint = this.endpoint` before its first `await`, target the captured values, and guard post-await state writes with `BaseClusterCommands.isSameContext(node, endpoint)`. Guards go BEFORE the write/dialog, never after.
4
+ - **Busy-flag resets:** ACL/Binding/BasicInformation reset `_busy`/`_saving` UNCONDITIONALLY in `finally` (avoids wedging a reused panel). The ICD panel instead resets only when `isSameContext` holds — safe solely because its `updated()` force-resets `_busy`/`_busyLabel` on node-id change AND IcdManagement is EP0-only. If ICD Management ever appears on a non-zero endpoint, that reset becomes reachable-stuck: make it unconditional then.
5
+ - **Loaded-flag keys:** Binding keys its `_loadedKey` by node+endpoint; ICD (`#loadedForNode`) and ACL (`_loadedKey`) are node-only — justified because both clusters are EP0-only (ACL reads hardcode `0/31/0`). Endpoint-scoped panels must include the endpoint in their key.
6
+ - **Incoming-event subscriptions** (e.g. chime's `addNodeEventListener`) correctly filter against LIVE `this.node`/`this.endpoint` — do not "fix" them to captured values; they are not request/response flows.
@@ -10,6 +10,7 @@ import "@material/web/progress/circular-progress";
10
10
  import "@material/web/radio/radio";
11
11
  import {
12
12
  ICD_MULTI_ADMIN_ERROR_CODE,
13
+ isLongIdleTimeCapable,
13
14
  ServerCommandError,
14
15
  type IcdStateData,
15
16
  type MatterNode,
@@ -24,7 +25,6 @@ import {
24
25
  ICD_CLUSTER_ID,
25
26
  icdInfo,
26
27
  isRegisteredByUs,
27
- litSpecVersionOk,
28
28
  otherFabricClientCount,
29
29
  parseMultiAdminDetails,
30
30
  wakeInstruction,
@@ -142,12 +142,9 @@ export class IcdManagementClusterCommands extends BaseClusterCommands {
142
142
  return isRegisteredByUs(this._info.registeredClients, this.client.serverInfo?.controller_node_id);
143
143
  }
144
144
 
145
- /** matter.js only treats a peer as LIT-capable with LITS feature AND spec version >= 1.4.0. */
145
+ /** The server's own IcdClient verdict wins; the attribute check is the fallback before it arrives. */
146
146
  private get _litSupported(): boolean {
147
- return (
148
- this._serverState?.lit_supported ??
149
- (this._info.features.longIdleTimeSupport && litSpecVersionOk(this.node.attributes))
150
- );
147
+ return this._serverState?.lit_supported ?? isLongIdleTimeCapable(this.node.attributes);
151
148
  }
152
149
 
153
150
  private get _actualMode(): IcdMode {
@@ -27,6 +27,12 @@ import "../pages/components/node-details";
27
27
  import { computeActiveClusterFeatures } from "../util/cluster-features.js";
28
28
  import { DevModeService } from "../util/dev-mode-service.js";
29
29
  import { formatHex, formatNodeAddress, getEffectiveFabricIndex } from "../util/format_hex.js";
30
+ import {
31
+ decodeSemanticTagList,
32
+ describeSemanticTagListEntry,
33
+ DESCRIPTOR_CLUSTER_ID,
34
+ TAG_LIST_ATTR,
35
+ } from "../util/semantic-tags.js";
30
36
  import { notFoundStyles } from "../util/shared-styles.js";
31
37
  import { BaseClusterCommands, getClusterCommandsTag } from "./cluster-commands/index.js";
32
38
  import { bindingContext } from "./components/context.js";
@@ -146,8 +152,7 @@ class MatterClusterView extends LitElement {
146
152
  <node-details .node=${this.node}></node-details>
147
153
  </div>
148
154
 
149
- <!-- Active features panel -->
150
- ${this._renderFeaturesPanel()}
155
+ ${this._renderClusterInfoPanel()}
151
156
 
152
157
  <!-- Cluster commands section (if available for this cluster) -->
153
158
  ${this._renderClusterCommands()}
@@ -348,38 +353,74 @@ class MatterClusterView extends LitElement {
348
353
  });
349
354
  }
350
355
 
351
- private _renderFeaturesPanel(): TemplateResult | typeof nothing {
352
- if (this.cluster === undefined || !this.node) return nothing;
356
+ private _renderClusterInfoPanel(): TemplateResult | typeof nothing {
357
+ const sections = new Array<TemplateResult>();
358
+ for (const section of [this._renderFeaturesSection(), this._renderTagListSection()]) {
359
+ if (section !== undefined) sections.push(section);
360
+ }
361
+ if (sections.length === 0) return nothing;
362
+
363
+ return html`
364
+ <div class="container">
365
+ <div class="info-panel">${sections}</div>
366
+ </div>
367
+ `;
368
+ }
369
+
370
+ private _renderFeaturesSection(): TemplateResult | undefined {
371
+ if (this.cluster === undefined || !this.node) return undefined;
353
372
 
354
373
  const clusterMeta = clusters[this.cluster];
355
374
  const knownFeatures = Object.values(clusterMeta?.features ?? {});
356
- if (knownFeatures.length === 0) return nothing;
375
+ if (knownFeatures.length === 0) return undefined;
357
376
 
358
377
  const featureMapValue = this.node.attributes[`${this.endpoint}/${this.cluster}/${FEATURE_MAP_ATTR}`];
359
- if (featureMapValue === undefined) return nothing;
378
+ if (featureMapValue === undefined) return undefined;
360
379
 
361
380
  const activeFeatures = computeActiveClusterFeatures(featureMapValue, knownFeatures);
362
381
 
363
382
  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 class="info-section">
384
+ <div class="info-section-header">Active Features</div>
385
+ ${activeFeatures.length === 0
386
+ ? html`<p class="empty">No active features</p>`
387
+ : html`
388
+ <ul class="chip-list">
389
+ ${activeFeatures.map(
390
+ feature => html`
391
+ <li class="chip" title="Bit ${feature.bit} (${feature.code})">
392
+ ${feature.label}
393
+ </li>
394
+ `,
395
+ )}
396
+ </ul>
397
+ `}
398
+ </div>
399
+ `;
400
+ }
401
+
402
+ private _renderTagListSection(): TemplateResult | undefined {
403
+ if (this.cluster !== DESCRIPTOR_CLUSTER_ID || !this.node) return undefined;
404
+
405
+ const tagListValue = this.node.attributes[`${this.endpoint}/${this.cluster}/${TAG_LIST_ATTR}`];
406
+ const tagList = decodeSemanticTagList(tagListValue);
407
+ if (tagList === undefined) return undefined;
408
+
409
+ return html`
410
+ <div class="info-section">
411
+ <div class="info-section-header">Semantic Tags (TagList)</div>
412
+ ${tagList.length === 0
413
+ ? html`<p class="empty">No semantic tags</p>`
414
+ : html`
415
+ <ul class="chip-list">
416
+ ${tagList.map(entry => {
417
+ const { text, title, erroneous } = describeSemanticTagListEntry(entry);
418
+ return html`<li class=${erroneous ? "chip chip-error" : "chip"} title=${title}>
419
+ ${text}
420
+ </li>`;
421
+ })}
422
+ </ul>
423
+ `}
383
424
  </div>
384
425
  `;
385
426
  }
@@ -670,20 +711,26 @@ class MatterClusterView extends LitElement {
670
711
  border-radius: 3px;
671
712
  }
672
713
 
673
- .features-panel {
714
+ .info-panel {
674
715
  background-color: var(--md-sys-color-surface-container);
675
716
  border: 1px solid var(--md-sys-color-outline-variant);
676
717
  border-radius: 12px;
677
718
  padding: 14px 16px;
678
719
  }
679
720
 
680
- .features-panel-header {
721
+ .info-section + .info-section {
722
+ margin-top: 12px;
723
+ padding-top: 12px;
724
+ border-top: 1px solid var(--md-sys-color-outline-variant);
725
+ }
726
+
727
+ .info-section-header {
681
728
  font-weight: 500;
682
729
  color: var(--md-sys-color-on-surface);
683
730
  margin-bottom: 10px;
684
731
  }
685
732
 
686
- .feature-chip-list {
733
+ .chip-list {
687
734
  list-style: none;
688
735
  margin: 0;
689
736
  padding: 0;
@@ -692,13 +739,20 @@ class MatterClusterView extends LitElement {
692
739
  gap: 8px;
693
740
  }
694
741
 
695
- .feature-chip {
742
+ .chip {
696
743
  font-size: 0.85rem;
697
744
  color: var(--md-sys-color-on-secondary-container);
698
745
  background: var(--md-sys-color-secondary-container);
699
746
  padding: 4px 10px;
700
747
  border-radius: 8px;
701
748
  }
749
+
750
+ .chip.chip-error {
751
+ color: var(--md-sys-color-on-error-container);
752
+ background: var(--md-sys-color-error-container);
753
+ border: 1px solid var(--md-sys-color-error);
754
+ font-family: var(--monospace-font);
755
+ }
702
756
  `,
703
757
  ];
704
758
  }
@@ -211,7 +211,7 @@ export class NetworkDetails extends LitElement {
211
211
  ${wifiDiag.wifiVersion !== null
212
212
  ? html`
213
213
  <div class="info-row">
214
- <span class="label">WiFi Version:</span>
214
+ <span class="label">WiFi version:</span>
215
215
  <span class="value">${getWiFiVersionName(wifiDiag.wifiVersion)}</span>
216
216
  </div>
217
217
  `
@@ -261,7 +261,7 @@ export class NetworkDetails extends LitElement {
261
261
  ${extAddressHex
262
262
  ? html`
263
263
  <div class="info-row">
264
- <span class="label">Extended Address:</span>
264
+ <span class="label">Extended address:</span>
265
265
  <span class="value mono">${extAddressHex}</span>
266
266
  </div>
267
267
  `
@@ -462,7 +462,7 @@ export class NetworkDetails extends LitElement {
462
462
  ${extMac !== undefined
463
463
  ? html`
464
464
  <div class="info-row">
465
- <span class="label">Extended Address:</span>
465
+ <span class="label">Extended address:</span>
466
466
  <span class="value mono">${extMac}</span>
467
467
  </div>
468
468
  `
@@ -510,13 +510,13 @@ export class NetworkDetails extends LitElement {
510
510
  ? html`<p class="hint-text inline-note">${EXTERNAL_ROUTER_CAPABLE_NOTE}</p>`
511
511
  : nothing}
512
512
  <div class="info-row">
513
- <span class="label">Extended Address:</span>
513
+ <span class="label">Extended address:</span>
514
514
  <span class="value mono">${unknown.extAddressHex}</span>
515
515
  </div>
516
516
  ${unknown.networkName !== undefined
517
517
  ? html`
518
518
  <div class="info-row">
519
- <span class="label">Thread Network:</span>
519
+ <span class="label">Thread network:</span>
520
520
  <span class="value">${unknown.networkName}</span>
521
521
  </div>
522
522
  `
@@ -675,7 +675,7 @@ export class NetworkDetails extends LitElement {
675
675
  ${includeExtAddr
676
676
  ? html`
677
677
  <div class="info-row">
678
- <span class="label">Extended Address:</span>
678
+ <span class="label">Extended address:</span>
679
679
  <span class="value mono">${br.extAddressHex}</span>
680
680
  </div>
681
681
  `
@@ -834,7 +834,7 @@ export class NetworkDetails extends LitElement {
834
834
  ${br.meshcopPort !== undefined
835
835
  ? html`
836
836
  <div class="info-row">
837
- <span class="label">meshcop port:</span>
837
+ <span class="label">MeshCoP port:</span>
838
838
  <span class="value">${br.meshcopPort}</span>
839
839
  </div>
840
840
  `
@@ -842,7 +842,7 @@ export class NetworkDetails extends LitElement {
842
842
  ${br.trelPort !== undefined
843
843
  ? html`
844
844
  <div class="info-row">
845
- <span class="label">trel port:</span>
845
+ <span class="label">TREL port:</span>
846
846
  <span class="value">${br.trelPort}</span>
847
847
  </div>
848
848
  `
@@ -953,11 +953,11 @@ export class NetworkDetails extends LitElement {
953
953
  ${brNode?.leaderData !== undefined
954
954
  ? html`
955
955
  <div class="info-row">
956
- <span class="label">Leader router id:</span>
956
+ <span class="label">Leader router ID:</span>
957
957
  <span class="value">${brNode.leaderData.leaderRouterId}</span>
958
958
  </div>
959
959
  <div class="info-row">
960
- <span class="label">Partition id:</span>
960
+ <span class="label">Partition ID:</span>
961
961
  <span class="value mono">${brNode.leaderData.partitionId.toString(16)}</span>
962
962
  </div>
963
963
  `
@@ -9,7 +9,12 @@ import "@material/web/button/text-button";
9
9
  import "@material/web/checkbox/checkbox";
10
10
  import "@material/web/dialog/dialog";
11
11
  import { consume } from "@lit/context";
12
- import type { MatterClient, MatterNode } from "@matter-server/ws-client";
12
+ import {
13
+ isLongIdleTimeDevice,
14
+ THREAD_TOPOLOGY_ATTRIBUTE_PATHS,
15
+ type MatterClient,
16
+ type MatterNode,
17
+ } from "@matter-server/ws-client";
13
18
  import { mdiLoading } from "@mdi/js";
14
19
  import { LitElement, css, html, nothing, svg } from "lit";
15
20
  import { customElement, property, state } from "lit/decorators.js";
@@ -23,12 +28,14 @@ declare global {
23
28
  }
24
29
  }
25
30
 
26
- /** Thread network attributes to read */
27
- const THREAD_ATTRIBUTE_PATHS = ["0/53/7", "0/53/8", "0/51/0"]; // NeighborTable, RouteTable, NetworkInterfaces
28
-
29
31
  /** WiFi network attributes to read */
30
32
  const WIFI_ATTRIBUTE_PATHS = ["0/54/0", "0/54/3", "0/54/4"]; // BSSID, Channel, RSSI
31
33
 
34
+ // A LIT node answers when it next polls, which can be hours away. Give it a short grace period once
35
+ // the other nodes are done, capped so one sleepy device cannot hold the dialog open.
36
+ const LIT_GRACE_MS = 10_000;
37
+ const LIT_MAX_WAIT_MS = 20_000;
38
+
32
39
  @customElement("update-connections-dialog")
33
40
  export class UpdateConnectionsDialog extends LitElement {
34
41
  @consume({ context: clientContext })
@@ -61,10 +68,20 @@ export class UpdateConnectionsDialog extends LitElement {
61
68
  /** Timeout ID for auto-close */
62
69
  private _timeoutId: ReturnType<typeof setTimeout> | null = null;
63
70
 
71
+ private _litTimeoutId: ReturnType<typeof setTimeout> | null = null;
72
+
73
+ private _litGraceResolve: (() => void) | null = null;
74
+
64
75
  /** Track if we've already dispatched close event to prevent double-firing */
65
76
  private _hasClosedEvent: boolean = false;
66
77
 
67
78
  override firstUpdated(): void {
79
+ // A sleeping node cannot report its own link data in time, so its neighbours — which can — are
80
+ // the default target rather than an opt-in extra.
81
+ if (this._selectedIsLongIdleTime) {
82
+ this._includeNeighbors = true;
83
+ }
84
+
68
85
  // Open dialog when component is first rendered
69
86
  const dialog = this.shadowRoot?.querySelector("md-dialog") as HTMLElement & { show: () => void };
70
87
  dialog?.show();
@@ -77,6 +94,7 @@ export class UpdateConnectionsDialog extends LitElement {
77
94
  clearTimeout(this._timeoutId);
78
95
  this._timeoutId = null;
79
96
  }
97
+ this._endLongIdleTimeGrace();
80
98
  }
81
99
 
82
100
  /**
@@ -100,7 +118,7 @@ export class UpdateConnectionsDialog extends LitElement {
100
118
  const networkType = getNetworkType(node);
101
119
 
102
120
  if (networkType === "thread") {
103
- return THREAD_ATTRIBUTE_PATHS;
121
+ return [...THREAD_TOPOLOGY_ATTRIBUTE_PATHS];
104
122
  }
105
123
  if (networkType === "wifi") {
106
124
  return WIFI_ATTRIBUTE_PATHS;
@@ -124,6 +142,54 @@ export class UpdateConnectionsDialog extends LitElement {
124
142
  return this.onlineNeighborIds;
125
143
  }
126
144
 
145
+ private _longIdleTimeGrace(startedAt: number): Promise<void> {
146
+ const budget = Math.min(LIT_GRACE_MS, LIT_MAX_WAIT_MS - (Date.now() - startedAt));
147
+ if (budget <= 0) return Promise.resolve();
148
+ return new Promise<void>(resolve => {
149
+ this._litGraceResolve = resolve;
150
+ this._litTimeoutId = setTimeout(resolve, budget);
151
+ });
152
+ }
153
+
154
+ /**
155
+ * Ends the grace period. Resolving is what matters: dropping the timer alone would leave the raced
156
+ * promise pending on a LIT read that only settles on the client's command timeout, holding this
157
+ * element and its node map alive for as long as that takes.
158
+ */
159
+ private _endLongIdleTimeGrace(): void {
160
+ if (this._litTimeoutId) {
161
+ clearTimeout(this._litTimeoutId);
162
+ this._litTimeoutId = null;
163
+ }
164
+ this._litGraceResolve?.();
165
+ this._litGraceResolve = null;
166
+ }
167
+
168
+ private get _selectedIsLongIdleTime(): boolean {
169
+ if (this.selectedNodeType !== "online" || this.selectedNodeId === null) return false;
170
+ const node = this.nodes[String(this.selectedNodeId)];
171
+ return node !== undefined && isLongIdleTimeDevice(node.attributes);
172
+ }
173
+
174
+ private get _longIdleTimeNodeIds(): string[] {
175
+ return this._getNodeIdsToUpdate().filter(nodeId => {
176
+ const node = this.nodes[nodeId];
177
+ return node !== undefined && isLongIdleTimeDevice(node.attributes);
178
+ });
179
+ }
180
+
181
+ private _readNode(nodeIdStr: string): Promise<void> {
182
+ const node = this.nodes[nodeIdStr];
183
+ if (!node) return Promise.resolve();
184
+
185
+ const paths = this._getAttributePathsForNode(nodeIdStr);
186
+ if (paths.length === 0) return Promise.resolve();
187
+
188
+ // fabric_filtered must match the node subscription's filter (true), else matter.js
189
+ // discards the read and no attribute_updated fires, leaving the store stale.
190
+ return this.client.readAttribute(node.node_id, paths, undefined, true).then(() => undefined);
191
+ }
192
+
127
193
  private async _executeUpdate(): Promise<void> {
128
194
  if (this._isUpdating || this._updateCount === 0) return;
129
195
 
@@ -135,24 +201,40 @@ export class UpdateConnectionsDialog extends LitElement {
135
201
  this._closeDialog();
136
202
  }, 30000);
137
203
 
204
+ const startedAt = Date.now();
205
+
138
206
  try {
207
+ const longIdleTime = new Set(this._longIdleTimeNodeIds);
139
208
  const nodeIds = this._getNodeIdsToUpdate();
140
209
 
141
- // Build promises for all node updates
142
- const updatePromises = nodeIds.map(async nodeIdStr => {
143
- const node = this.nodes[nodeIdStr];
144
- if (!node) return;
210
+ // A LIT node answers only when it next polls, so its read is started but never waited out:
211
+ // the value still lands in the store via attribute_updated whenever the node wakes up.
212
+ const litReads = new Array<Promise<void>>();
213
+ const reads = new Array<Promise<void>>();
214
+ let failures = 0;
215
+ for (const nodeId of nodeIds) {
216
+ const sleepy = longIdleTime.has(nodeId);
217
+ const read = this._readNode(nodeId).catch(error => {
218
+ // Only the awaited reads count: a LIT failure cannot say anything about the ones
219
+ // this update actually reported on.
220
+ if (!sleepy) failures++;
221
+ console.warn(`Failed to refresh network data of node ${nodeId}:`, error);
222
+ });
223
+ (sleepy ? litReads : reads).push(read);
224
+ }
145
225
 
146
- const paths = this._getAttributePathsForNode(nodeIdStr);
147
- if (paths.length === 0) return;
226
+ // Return values are discarded; refreshed data arrives via attribute_updated events.
227
+ await Promise.all(reads);
148
228
 
149
- // fabric_filtered must match the node subscription's filter (true), else matter.js
150
- // discards the read and no attribute_updated fires, leaving the store stale.
151
- await this.client.readAttribute(node.node_id, paths, undefined, true);
152
- });
229
+ if (reads.length > 0 && failures === reads.length) {
230
+ console.error(`Refreshing network data failed for all ${failures} nodes`);
231
+ }
153
232
 
154
- // Return values are discarded; refreshed data arrives via attribute_updated events.
155
- await Promise.all(updatePromises);
233
+ // Only worth a grace period when other nodes were waited for anyway; a selection of LIT
234
+ // nodes alone would just spin for the full budget, which is what the dialog says it won't do.
235
+ if (litReads.length > 0 && reads.length > 0) {
236
+ await Promise.race([Promise.all(litReads), this._longIdleTimeGrace(startedAt)]);
237
+ }
156
238
 
157
239
  // Close dialog on success
158
240
  this._closeDialog();
@@ -166,6 +248,7 @@ export class UpdateConnectionsDialog extends LitElement {
166
248
  clearTimeout(this._timeoutId);
167
249
  this._timeoutId = null;
168
250
  }
251
+ this._endLongIdleTimeGrace();
169
252
  this._isUpdating = false;
170
253
  }
171
254
  }
@@ -192,9 +275,20 @@ export class UpdateConnectionsDialog extends LitElement {
192
275
  }
193
276
 
194
277
  private _renderOnlineContent(): unknown {
278
+ const sleepy = this._selectedIsLongIdleTime;
279
+ const neighborCount = this.onlineNeighborIds.length;
280
+ const plural = neighborCount !== 1 ? "s" : "";
281
+
195
282
  return html`
196
- <p>Refresh network information for "<strong>${this.selectedNodeName}</strong>".</p>
197
- ${this.onlineNeighborIds.length > 0
283
+ ${sleepy
284
+ ? html`
285
+ <p>
286
+ "<strong>${this.selectedNodeName}</strong>" is a sleepy device (Matter LIT). It answers only
287
+ when it next wakes, so its own network data arrives later.
288
+ </p>
289
+ `
290
+ : html`<p>Refresh network information for "<strong>${this.selectedNodeName}</strong>".</p>`}
291
+ ${neighborCount > 0
198
292
  ? html`
199
293
  <label class="checkbox-row">
200
294
  <md-checkbox
@@ -203,12 +297,14 @@ export class UpdateConnectionsDialog extends LitElement {
203
297
  ?disabled=${this._isUpdating}
204
298
  ></md-checkbox>
205
299
  <span
206
- >Include ${this.onlineNeighborIds.length} connected online
207
- neighbor${this.onlineNeighborIds.length !== 1 ? "s" : ""}</span
300
+ >${sleepy ? "Refresh" : "Include"} ${neighborCount} connected online
301
+ neighbor${plural}${sleepy ? " for current link data" : ""}</span
208
302
  >
209
303
  </label>
210
304
  `
211
- : nothing}
305
+ : sleepy
306
+ ? html`<p class="note">No online neighbor can report its current link data either.</p>`
307
+ : nothing}
212
308
  `;
213
309
  }
214
310
 
@@ -241,6 +337,23 @@ export class UpdateConnectionsDialog extends LitElement {
241
337
  `;
242
338
  }
243
339
 
340
+ private _renderLongIdleTimeNote(): unknown {
341
+ // The selected node's own sleep state is already spelled out by _renderOnlineContent.
342
+ const selectedId = String(this.selectedNodeId);
343
+ const count = this._longIdleTimeNodeIds.filter(
344
+ nodeId => !(this._selectedIsLongIdleTime && nodeId === selectedId),
345
+ ).length;
346
+ if (count === 0) return nothing;
347
+
348
+ return html`
349
+ <p class="note">
350
+ ${count === 1 ? "One of them is" : `${count} of them are`} a sleepy device (Matter LIT), so the update
351
+ does not wait for ${count === 1 ? "it" : "them"} — ${count === 1 ? "its" : "their"} data appears once
352
+ ${count === 1 ? "it wakes" : "they wake"} up.
353
+ </p>
354
+ `;
355
+ }
356
+
244
357
  override render() {
245
358
  const buttonText =
246
359
  this._updateCount === 0
@@ -256,6 +369,7 @@ export class UpdateConnectionsDialog extends LitElement {
256
369
  : this.selectedNodeType === "offline"
257
370
  ? this._renderOfflineContent()
258
371
  : this._renderUnknownContent()}
372
+ ${this._renderLongIdleTimeNote()}
259
373
  </div>
260
374
  <div slot="actions">
261
375
  <md-text-button @click=${this._closeDialog} ?disabled=${this._isUpdating}>Cancel</md-text-button>
@@ -296,6 +410,12 @@ export class UpdateConnectionsDialog extends LitElement {
296
410
  margin-bottom: 0;
297
411
  }
298
412
 
413
+ [slot="content"] p.note {
414
+ margin-top: 12px;
415
+ font-size: 0.8125rem;
416
+ color: var(--text-color, rgba(0, 0, 0, 0.6));
417
+ }
418
+
299
419
  .checkbox-row {
300
420
  display: flex;
301
421
  align-items: center;
package/src/util/icd.ts CHANGED
@@ -4,19 +4,12 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import { isLongIdleTimeCapable, isLongIdleTimeDevice } from "@matter-server/ws-client";
7
8
  import { attributeArray } from "./access-control.js";
8
9
  import { formatDuration } from "./duration.js";
9
10
 
10
11
  export const ICD_CLUSTER_ID = 70;
11
12
 
12
- /** BasicInformation SpecificationVersion is encoded 0xMMmmpprr; matter.js only treats LIT as usable at >= 1.4.0. */
13
- export const MIN_LIT_SPECIFICATION_VERSION = 0x01040000;
14
-
15
- export function litSpecVersionOk(attributes: Record<string, unknown>): boolean {
16
- const value = attributes["0/40/21"];
17
- return typeof value === "number" && value >= MIN_LIT_SPECIFICATION_VERSION;
18
- }
19
-
20
13
  export interface IcdFeatures {
21
14
  checkInProtocolSupport: boolean;
22
15
  userActiveModeTrigger: boolean;
@@ -147,13 +140,12 @@ export interface IcdBadge {
147
140
  }
148
141
 
149
142
  /**
150
- * Tri-state "ICD" badge for LIT-capable nodes (cluster present, LongIdleTimeSupport feature, spec >= 1.4 —
151
- * below that the controller does not track check-ins, so offline is not "normal sleeping").
152
- * Returns undefined for nodes that aren't LIT-capable, since neither SIT-only nor unsupported nodes get a badge.
143
+ * Tri-state "ICD" badge for LIT-capable nodes. Returns undefined for nodes that aren't LIT-capable,
144
+ * since neither SIT-only nor unsupported nodes get a badge.
153
145
  */
154
146
  export function icdBadge(attributes: Record<string, unknown>, available: boolean): IcdBadge | undefined {
147
+ if (!isLongIdleTimeCapable(attributes)) return undefined;
155
148
  const info = icdInfo(attributes);
156
- if (!info.supported || !info.features.longIdleTimeSupport || !litSpecVersionOk(attributes)) return undefined;
157
149
 
158
150
  if (info.operatingMode === "SIT") {
159
151
  return {
@@ -162,7 +154,7 @@ export function icdBadge(attributes: Record<string, unknown>, available: boolean
162
154
  };
163
155
  }
164
156
 
165
- if (info.operatingMode === "LIT") {
157
+ if (isLongIdleTimeDevice(attributes)) {
166
158
  if (!available) {
167
159
  const offlineInterval =
168
160
  info.idleModeDuration !== undefined ? formatDuration(info.idleModeDuration) : "its check-in interval";