@matter-server/dashboard 1.2.8 → 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.
- package/dist/esm/client/models/descriptions.d.ts +8 -0
- package/dist/esm/client/models/descriptions.d.ts.map +1 -1
- package/dist/esm/client/models/descriptions.js +2049 -81
- package/dist/esm/client/models/descriptions.js.map +1 -1
- package/dist/esm/components/webrtc-stream-view.d.ts +35 -1
- package/dist/esm/components/webrtc-stream-view.d.ts.map +1 -1
- package/dist/esm/components/webrtc-stream-view.js +154 -90
- package/dist/esm/components/webrtc-stream-view.js.map +1 -1
- package/dist/esm/pages/camera-overlay.d.ts +1 -0
- package/dist/esm/pages/camera-overlay.d.ts.map +1 -1
- package/dist/esm/pages/camera-overlay.js +12 -14
- package/dist/esm/pages/camera-overlay.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.d.ts +35 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js +352 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/index.d.ts +1 -0
- package/dist/esm/pages/cluster-commands/index.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/index.js +1 -0
- package/dist/esm/pages/cluster-commands/index.js.map +1 -1
- package/dist/esm/pages/components/node-details.d.ts.map +1 -1
- package/dist/esm/pages/components/node-details.js +17 -8
- package/dist/esm/pages/components/node-details.js.map +1 -1
- package/dist/esm/pages/matter-cluster-view.d.ts +1 -0
- package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
- package/dist/esm/pages/matter-cluster-view.js +64 -0
- package/dist/esm/pages/matter-cluster-view.js.map +1 -1
- package/dist/esm/pages/matter-node-view.d.ts.map +1 -1
- package/dist/esm/pages/matter-node-view.js +10 -6
- package/dist/esm/pages/matter-node-view.js.map +1 -1
- package/dist/esm/util/camera.d.ts +22 -0
- package/dist/esm/util/camera.d.ts.map +1 -0
- package/dist/esm/util/camera.js +48 -0
- package/dist/esm/util/camera.js.map +6 -0
- package/dist/esm/util/closure-control.d.ts +57 -0
- package/dist/esm/util/closure-control.d.ts.map +1 -0
- package/dist/esm/util/closure-control.js +148 -0
- package/dist/esm/util/closure-control.js.map +6 -0
- package/dist/esm/util/cluster-features.d.ts +8 -0
- package/dist/esm/util/cluster-features.d.ts.map +1 -0
- package/dist/esm/util/cluster-features.js +14 -0
- package/dist/esm/util/cluster-features.js.map +6 -0
- package/dist/esm/util/device-icons.d.ts +0 -2
- package/dist/esm/util/device-icons.d.ts.map +1 -1
- package/dist/esm/util/device-icons.js +0 -6
- package/dist/esm/util/device-icons.js.map +1 -1
- package/dist/esm/util/endpoints.d.ts +11 -0
- package/dist/esm/util/endpoints.d.ts.map +1 -1
- package/dist/esm/util/endpoints.js +33 -1
- package/dist/esm/util/endpoints.js.map +1 -1
- package/dist/web/js/{attribute-write-dialog-CB7oucjt.js → attribute-write-dialog-UxEN5w8r.js} +1 -1
- package/dist/web/js/{command-invoke-dialog-C9rdQjTo.js → command-invoke-dialog-CVXU-ZoZ.js} +1 -1
- package/dist/web/js/{commission-node-dialog-BwkiZy8i.js → commission-node-dialog-D5HIBPy_.js} +5 -5
- package/dist/web/js/{commission-node-existing-BWTlMlwi.js → commission-node-existing-Bniw0yfY.js} +1 -1
- package/dist/web/js/{commission-node-thread-WDo3_tCy.js → commission-node-thread-D7w0p3f2.js} +1 -1
- package/dist/web/js/{commission-node-wifi-Drj7Z0rY.js → commission-node-wifi-DeTq4twp.js} +1 -1
- package/dist/web/js/{dialog-box-Dq6fTPQH.js → dialog-box-DkTPEszi.js} +1 -1
- package/dist/web/js/{fabric-label-dialog-FE4tGieS.js → fabric-label-dialog-8kIYOl4q.js} +1 -1
- package/dist/web/js/main.js +1 -1
- package/dist/web/js/{matter-dashboard-app-Ditf9BYC.js → matter-dashboard-app-BBGILOPg.js} +3303 -717
- package/dist/web/js/{node-acl-add-dialog-BA3u0qYj.js → node-acl-add-dialog-KiDTJk-M.js} +1 -1
- package/dist/web/js/{node-binding-dialog-BV_fMc0a.js → node-binding-dialog-DffAwr6H.js} +1 -1
- package/dist/web/js/{node-label-dialog-DG5CqG1e.js → node-label-dialog-DhRlTzGl.js} +1 -1
- package/dist/web/js/{settings-dialog-VafGbl7R.js → settings-dialog-BOy5I7JW.js} +1 -1
- package/package.json +4 -4
- package/src/client/models/descriptions.ts +2053 -78
- package/src/components/webrtc-stream-view.ts +216 -112
- package/src/pages/camera-overlay.ts +17 -18
- package/src/pages/cluster-commands/clusters/closure-control-commands.ts +393 -0
- package/src/pages/cluster-commands/index.ts +1 -0
- package/src/pages/components/node-details.ts +19 -9
- package/src/pages/matter-cluster-view.ts +73 -0
- package/src/pages/matter-node-view.ts +10 -6
- package/src/util/camera.ts +67 -0
- package/src/util/closure-control.ts +193 -0
- package/src/util/cluster-features.ts +17 -0
- package/src/util/device-icons.ts +0 -7
- package/src/util/endpoints.ts +50 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025-2026 Open Home Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import "@material/web/button/filled-button";
|
|
8
|
+
import "@material/web/button/outlined-button";
|
|
9
|
+
import "@material/web/select/outlined-select";
|
|
10
|
+
import "@material/web/select/select-option";
|
|
11
|
+
import { mdiAlertCircle, mdiCogRefresh, mdiStop } from "@mdi/js";
|
|
12
|
+
import { css, html, nothing } from "lit";
|
|
13
|
+
import { customElement, state } from "lit/decorators.js";
|
|
14
|
+
import "../../../components/ha-svg-icon.js";
|
|
15
|
+
import { handleAsync } from "../../../util/async-handler.js";
|
|
16
|
+
import {
|
|
17
|
+
CLOSURE_CONTROL_CLUSTER_ID,
|
|
18
|
+
CLOSURE_ERROR_LABELS,
|
|
19
|
+
CURRENT_POSITION_LABELS,
|
|
20
|
+
type ClosureCurrentState,
|
|
21
|
+
type ClosureFeatures,
|
|
22
|
+
type ClosureState,
|
|
23
|
+
MAIN_STATE_LABELS,
|
|
24
|
+
SPEED_LABELS,
|
|
25
|
+
TARGET_POSITION_LABELS,
|
|
26
|
+
calibrate,
|
|
27
|
+
moveTo,
|
|
28
|
+
readCountdownTime,
|
|
29
|
+
readCurrentErrorList,
|
|
30
|
+
readFeatures,
|
|
31
|
+
readLatchControlModes,
|
|
32
|
+
readMainState,
|
|
33
|
+
readOverallCurrentState,
|
|
34
|
+
readOverallTargetState,
|
|
35
|
+
stop,
|
|
36
|
+
} from "../../../util/closure-control.js";
|
|
37
|
+
import { BaseClusterCommands } from "../base-cluster-commands.js";
|
|
38
|
+
import { registerClusterCommands } from "../registry.js";
|
|
39
|
+
|
|
40
|
+
const MAIN_STATE_ERROR = 3;
|
|
41
|
+
|
|
42
|
+
@customElement("closure-control-cluster-commands")
|
|
43
|
+
class ClosureControlClusterCommands extends BaseClusterCommands {
|
|
44
|
+
@state() private _moveToPosition = "";
|
|
45
|
+
// "" = unchanged, "true" = latch, "false" = unlatch — kept as a select (not a plain switch) so an
|
|
46
|
+
// untouched control never implies an explicit latch/unlatch command in the MoveTo payload.
|
|
47
|
+
@state() private _moveToLatch = "";
|
|
48
|
+
@state() private _moveToSpeed = "";
|
|
49
|
+
private _unsubscribeNodes?: () => void;
|
|
50
|
+
private _moveToContext?: string;
|
|
51
|
+
|
|
52
|
+
override willUpdate(changedProperties: Map<string, unknown>) {
|
|
53
|
+
super.willUpdate(changedProperties);
|
|
54
|
+
if (!this.node) return;
|
|
55
|
+
const context = `${String(this.node.node_id)}/${this.endpoint}/${this.cluster}`;
|
|
56
|
+
if (this._moveToContext !== undefined && this._moveToContext !== context) {
|
|
57
|
+
this._moveToPosition = "";
|
|
58
|
+
this._moveToLatch = "";
|
|
59
|
+
this._moveToSpeed = "";
|
|
60
|
+
}
|
|
61
|
+
this._moveToContext = context;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override updated(changedProperties: Map<string, unknown>) {
|
|
65
|
+
super.updated(changedProperties);
|
|
66
|
+
if (changedProperties.has("client") && this.client && !this._unsubscribeNodes) {
|
|
67
|
+
this._unsubscribeNodes = this.client.addEventListener("nodes_changed", () => {
|
|
68
|
+
this.requestUpdate();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override disconnectedCallback() {
|
|
74
|
+
super.disconnectedCallback();
|
|
75
|
+
this._unsubscribeNodes?.();
|
|
76
|
+
this._unsubscribeNodes = undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override render() {
|
|
80
|
+
if (!this.node || this.cluster !== CLOSURE_CONTROL_CLUSTER_ID) return nothing;
|
|
81
|
+
const features = readFeatures(this.node, this.endpoint);
|
|
82
|
+
const mainState = readMainState(this.node, this.endpoint);
|
|
83
|
+
const errors = readCurrentErrorList(this.node, this.endpoint);
|
|
84
|
+
const countdownTime = readCountdownTime(this.node, this.endpoint);
|
|
85
|
+
const current = readOverallCurrentState(this.node, this.endpoint);
|
|
86
|
+
const target = readOverallTargetState(this.node, this.endpoint);
|
|
87
|
+
const latchControlModes = readLatchControlModes(this.node, this.endpoint);
|
|
88
|
+
|
|
89
|
+
return html`
|
|
90
|
+
<details class="command-panel" open>
|
|
91
|
+
<summary>Closure Control</summary>
|
|
92
|
+
<div class="command-content">
|
|
93
|
+
<div class="top-row">
|
|
94
|
+
<span class="state-badge ${mainState === MAIN_STATE_ERROR ? "error" : ""}">
|
|
95
|
+
${mainState !== null
|
|
96
|
+
? (MAIN_STATE_LABELS[mainState] ?? `Unknown (${mainState})`)
|
|
97
|
+
: "Unknown"}
|
|
98
|
+
</span>
|
|
99
|
+
${countdownTime !== null
|
|
100
|
+
? html`<span class="muted">~${countdownTime}s remaining</span>`
|
|
101
|
+
: nothing}
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
${errors.length > 0
|
|
105
|
+
? html`
|
|
106
|
+
<div class="errors">
|
|
107
|
+
${errors.map(
|
|
108
|
+
e => html`
|
|
109
|
+
<span class="error-chip">
|
|
110
|
+
<ha-svg-icon .path=${mdiAlertCircle}></ha-svg-icon>
|
|
111
|
+
${CLOSURE_ERROR_LABELS[e] ?? `Error ${e}`}
|
|
112
|
+
</span>
|
|
113
|
+
`,
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
`
|
|
117
|
+
: nothing}
|
|
118
|
+
|
|
119
|
+
<div class="states-grid">
|
|
120
|
+
<div class="state-block">
|
|
121
|
+
<div class="state-block-header">Current</div>
|
|
122
|
+
${this._renderState(current, features)}
|
|
123
|
+
</div>
|
|
124
|
+
<div class="state-block">
|
|
125
|
+
<div class="state-block-header">Target</div>
|
|
126
|
+
${this._renderState(target, features)}
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div class="actions">
|
|
131
|
+
${!features.instantaneous
|
|
132
|
+
? html`<md-outlined-button @click=${handleAsync(() => this._handleStop())}>
|
|
133
|
+
<ha-svg-icon slot="icon" .path=${mdiStop}></ha-svg-icon>
|
|
134
|
+
Stop
|
|
135
|
+
</md-outlined-button>`
|
|
136
|
+
: nothing}
|
|
137
|
+
${features.calibration
|
|
138
|
+
? html`<md-outlined-button @click=${handleAsync(() => this._handleCalibrate())}>
|
|
139
|
+
<ha-svg-icon slot="icon" .path=${mdiCogRefresh}></ha-svg-icon>
|
|
140
|
+
Calibrate
|
|
141
|
+
</md-outlined-button>`
|
|
142
|
+
: nothing}
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<div class="move-to">
|
|
146
|
+
<div class="move-to-header">Move to</div>
|
|
147
|
+
<div class="move-to-controls">
|
|
148
|
+
${features.positioning
|
|
149
|
+
? html`
|
|
150
|
+
<md-outlined-select
|
|
151
|
+
label="Position"
|
|
152
|
+
.value=${this._moveToPosition}
|
|
153
|
+
@change=${(e: Event) => {
|
|
154
|
+
this._moveToPosition = (e.target as HTMLSelectElement).value;
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<md-select-option value="">
|
|
158
|
+
<div slot="headline">(unchanged)</div>
|
|
159
|
+
</md-select-option>
|
|
160
|
+
${Object.entries(TARGET_POSITION_LABELS)
|
|
161
|
+
.filter(
|
|
162
|
+
([id]) =>
|
|
163
|
+
(id !== "2" || features.pedestrian) &&
|
|
164
|
+
(id !== "3" || features.ventilation),
|
|
165
|
+
)
|
|
166
|
+
.map(
|
|
167
|
+
([id, label]) => html`
|
|
168
|
+
<md-select-option value=${id}>
|
|
169
|
+
<div slot="headline">${label}</div>
|
|
170
|
+
</md-select-option>
|
|
171
|
+
`,
|
|
172
|
+
)}
|
|
173
|
+
</md-outlined-select>
|
|
174
|
+
`
|
|
175
|
+
: nothing}
|
|
176
|
+
${features.motionLatching &&
|
|
177
|
+
(latchControlModes.remoteLatching || latchControlModes.remoteUnlatching)
|
|
178
|
+
? html`
|
|
179
|
+
<md-outlined-select
|
|
180
|
+
label="Latch"
|
|
181
|
+
.value=${this._moveToLatch}
|
|
182
|
+
@change=${(e: Event) => {
|
|
183
|
+
this._moveToLatch = (e.target as HTMLSelectElement).value;
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<md-select-option value="">
|
|
187
|
+
<div slot="headline">(unchanged)</div>
|
|
188
|
+
</md-select-option>
|
|
189
|
+
${latchControlModes.remoteLatching
|
|
190
|
+
? html`<md-select-option value="true">
|
|
191
|
+
<div slot="headline">Latch</div>
|
|
192
|
+
</md-select-option>`
|
|
193
|
+
: nothing}
|
|
194
|
+
${latchControlModes.remoteUnlatching
|
|
195
|
+
? html`<md-select-option value="false">
|
|
196
|
+
<div slot="headline">Unlatch</div>
|
|
197
|
+
</md-select-option>`
|
|
198
|
+
: nothing}
|
|
199
|
+
</md-outlined-select>
|
|
200
|
+
`
|
|
201
|
+
: nothing}
|
|
202
|
+
${features.speed
|
|
203
|
+
? html`
|
|
204
|
+
<md-outlined-select
|
|
205
|
+
label="Speed"
|
|
206
|
+
.value=${this._moveToSpeed}
|
|
207
|
+
@change=${(e: Event) => {
|
|
208
|
+
this._moveToSpeed = (e.target as HTMLSelectElement).value;
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
211
|
+
<md-select-option value="">
|
|
212
|
+
<div slot="headline">(unchanged)</div>
|
|
213
|
+
</md-select-option>
|
|
214
|
+
${Object.entries(SPEED_LABELS).map(
|
|
215
|
+
([id, label]) => html`
|
|
216
|
+
<md-select-option value=${id}>
|
|
217
|
+
<div slot="headline">${label}</div>
|
|
218
|
+
</md-select-option>
|
|
219
|
+
`,
|
|
220
|
+
)}
|
|
221
|
+
</md-outlined-select>
|
|
222
|
+
`
|
|
223
|
+
: nothing}
|
|
224
|
+
<md-filled-button
|
|
225
|
+
?disabled=${this._moveToPosition === "" &&
|
|
226
|
+
this._moveToLatch === "" &&
|
|
227
|
+
this._moveToSpeed === ""}
|
|
228
|
+
@click=${handleAsync(() => this._handleMoveTo())}
|
|
229
|
+
>
|
|
230
|
+
Move
|
|
231
|
+
</md-filled-button>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</details>
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private _renderState(state: ClosureState | ClosureCurrentState | null, features: ClosureFeatures) {
|
|
240
|
+
if (!state) return html`<div class="muted empty">Unknown</div>`;
|
|
241
|
+
const positionLabels = "secureState" in state ? CURRENT_POSITION_LABELS : TARGET_POSITION_LABELS;
|
|
242
|
+
return html`
|
|
243
|
+
<div class="state-fields">
|
|
244
|
+
${features.positioning
|
|
245
|
+
? html`<div class="state-field">
|
|
246
|
+
<span class="muted">Position:</span>
|
|
247
|
+
<span>
|
|
248
|
+
${state.position !== null
|
|
249
|
+
? (positionLabels[state.position] ?? `#${state.position}`)
|
|
250
|
+
: "Unknown"}
|
|
251
|
+
</span>
|
|
252
|
+
</div>`
|
|
253
|
+
: nothing}
|
|
254
|
+
${features.motionLatching
|
|
255
|
+
? html`<div class="state-field">
|
|
256
|
+
<span class="muted">Latch:</span>
|
|
257
|
+
<span>${state.latch === null ? "Unknown" : state.latch ? "Latched" : "Unlatched"}</span>
|
|
258
|
+
</div>`
|
|
259
|
+
: nothing}
|
|
260
|
+
${features.speed
|
|
261
|
+
? html`<div class="state-field">
|
|
262
|
+
<span class="muted">Speed:</span>
|
|
263
|
+
<span
|
|
264
|
+
>${state.speed !== null
|
|
265
|
+
? (SPEED_LABELS[state.speed] ?? `#${state.speed}`)
|
|
266
|
+
: "Unknown"}</span
|
|
267
|
+
>
|
|
268
|
+
</div>`
|
|
269
|
+
: nothing}
|
|
270
|
+
${"secureState" in state
|
|
271
|
+
? html`<div class="state-field">
|
|
272
|
+
<span class="muted">Secure:</span>
|
|
273
|
+
<span>
|
|
274
|
+
${state.secureState === null ? "Unknown" : state.secureState ? "Secure" : "Not secure"}
|
|
275
|
+
</span>
|
|
276
|
+
</div>`
|
|
277
|
+
: nothing}
|
|
278
|
+
</div>
|
|
279
|
+
`;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
private async _handleStop() {
|
|
283
|
+
await stop(this.client, this.node.node_id, this.endpoint);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private async _handleCalibrate() {
|
|
287
|
+
await calibrate(this.client, this.node.node_id, this.endpoint);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
private async _handleMoveTo() {
|
|
291
|
+
await moveTo(this.client, this.node.node_id, this.endpoint, {
|
|
292
|
+
position: this._moveToPosition !== "" ? Number(this._moveToPosition) : undefined,
|
|
293
|
+
latch: this._moveToLatch !== "" ? this._moveToLatch === "true" : undefined,
|
|
294
|
+
speed: this._moveToSpeed !== "" ? Number(this._moveToSpeed) : undefined,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
static override styles = [
|
|
299
|
+
...(Array.isArray(BaseClusterCommands.styles) ? BaseClusterCommands.styles : [BaseClusterCommands.styles]),
|
|
300
|
+
css`
|
|
301
|
+
.top-row {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
gap: 16px;
|
|
305
|
+
flex-wrap: wrap;
|
|
306
|
+
padding-bottom: 12px;
|
|
307
|
+
}
|
|
308
|
+
.state-badge {
|
|
309
|
+
font-weight: 500;
|
|
310
|
+
padding: 4px 10px;
|
|
311
|
+
border-radius: 8px;
|
|
312
|
+
background: var(--md-sys-color-secondary-container);
|
|
313
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
314
|
+
}
|
|
315
|
+
.state-badge.error {
|
|
316
|
+
background: var(--md-sys-color-error-container);
|
|
317
|
+
color: var(--md-sys-color-on-error-container);
|
|
318
|
+
}
|
|
319
|
+
.muted {
|
|
320
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
321
|
+
}
|
|
322
|
+
.errors {
|
|
323
|
+
display: flex;
|
|
324
|
+
flex-wrap: wrap;
|
|
325
|
+
gap: 8px;
|
|
326
|
+
padding-bottom: 12px;
|
|
327
|
+
}
|
|
328
|
+
.error-chip {
|
|
329
|
+
display: inline-flex;
|
|
330
|
+
align-items: center;
|
|
331
|
+
gap: 4px;
|
|
332
|
+
padding: 4px 10px;
|
|
333
|
+
border-radius: 8px;
|
|
334
|
+
background: var(--md-sys-color-error-container);
|
|
335
|
+
color: var(--md-sys-color-on-error-container);
|
|
336
|
+
font-size: 0.85rem;
|
|
337
|
+
}
|
|
338
|
+
.error-chip ha-svg-icon {
|
|
339
|
+
--mdc-icon-size: 16px;
|
|
340
|
+
}
|
|
341
|
+
.states-grid {
|
|
342
|
+
display: grid;
|
|
343
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
344
|
+
gap: 16px;
|
|
345
|
+
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
346
|
+
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
347
|
+
padding: 12px 0;
|
|
348
|
+
margin-bottom: 12px;
|
|
349
|
+
}
|
|
350
|
+
.state-block-header {
|
|
351
|
+
font-weight: 500;
|
|
352
|
+
margin-bottom: 6px;
|
|
353
|
+
}
|
|
354
|
+
.state-fields {
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-direction: column;
|
|
357
|
+
gap: 4px;
|
|
358
|
+
}
|
|
359
|
+
.state-field {
|
|
360
|
+
display: flex;
|
|
361
|
+
gap: 6px;
|
|
362
|
+
}
|
|
363
|
+
.actions {
|
|
364
|
+
display: flex;
|
|
365
|
+
gap: 8px;
|
|
366
|
+
flex-wrap: wrap;
|
|
367
|
+
padding-bottom: 12px;
|
|
368
|
+
}
|
|
369
|
+
.move-to {
|
|
370
|
+
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
371
|
+
padding-top: 12px;
|
|
372
|
+
}
|
|
373
|
+
.move-to-header {
|
|
374
|
+
font-weight: 500;
|
|
375
|
+
margin-bottom: 8px;
|
|
376
|
+
}
|
|
377
|
+
.move-to-controls {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
gap: 12px;
|
|
381
|
+
flex-wrap: wrap;
|
|
382
|
+
}
|
|
383
|
+
`,
|
|
384
|
+
];
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
registerClusterCommands(CLOSURE_CONTROL_CLUSTER_ID, "closure-control-cluster-commands");
|
|
388
|
+
|
|
389
|
+
declare global {
|
|
390
|
+
interface HTMLElementTagNameMap {
|
|
391
|
+
"closure-control-cluster-commands": ClosureControlClusterCommands;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
@@ -21,6 +21,7 @@ import "./clusters/avsum-commands.js";
|
|
|
21
21
|
import "./clusters/basic-information-commands.js";
|
|
22
22
|
import "./clusters/binding-commands.js";
|
|
23
23
|
import "./clusters/chime-commands.js";
|
|
24
|
+
import "./clusters/closure-control-commands.js";
|
|
24
25
|
import "./clusters/icd-management-commands.js";
|
|
25
26
|
import "./clusters/level-control-commands.js";
|
|
26
27
|
import "./clusters/on-off-commands.js";
|
|
@@ -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 {
|
|
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,14 +32,13 @@ 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 {
|
|
35
|
+
import { supportsAudioOnlyLiveView, supportsCameraOverlay, supportsLiveView } from "../../util/camera.js";
|
|
36
|
+
import { getDeviceIcon } from "../../util/device-icons.js";
|
|
27
37
|
import { getEndpointDeviceTypes } from "../../util/endpoints.js";
|
|
28
38
|
import { ICD_CLUSTER_ID, icdBadge } from "../../util/icd.js";
|
|
29
39
|
import { formatManualPairingCode, renderPairingQrCodeDataUri } from "../../util/pairing-code.js";
|
|
30
40
|
import { bindingContext } from "./context.js";
|
|
31
41
|
|
|
32
|
-
const CAMERA_DEVICE_TYPE_IDS: number[] = [...LIVE_VIEW_DEVICE_TYPE_IDS, DeviceTypes.SNAPSHOT_CAMERA];
|
|
33
|
-
|
|
34
42
|
/** Map updateState values to user-friendly labels */
|
|
35
43
|
const UPDATE_STATE_LABELS: Record<number, string> = {
|
|
36
44
|
1: "Idle",
|
|
@@ -82,9 +90,11 @@ export class NodeDetails extends LitElement {
|
|
|
82
90
|
protected override render() {
|
|
83
91
|
if (!this.node) return html``;
|
|
84
92
|
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
93
|
+
const isCamera = supportsCameraOverlay(this.node, this.endpoint);
|
|
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);
|
|
88
98
|
const badge = icdBadge(this.node.attributes, this.node.available);
|
|
89
99
|
|
|
90
100
|
return html`
|
|
@@ -166,10 +176,10 @@ export class NodeDetails extends LitElement {
|
|
|
166
176
|
@click=${() => this._openCameraOverlay()}
|
|
167
177
|
?disabled=${!this.node.available}
|
|
168
178
|
>
|
|
169
|
-
${isLiveViewCamera ? "Live View" : "Snapshot"}
|
|
179
|
+
${isAudioOnly ? "Listen" : isLiveViewCamera ? "Live View" : "Snapshot"}
|
|
170
180
|
<ha-svg-icon
|
|
171
181
|
slot="icon"
|
|
172
|
-
.path=${isLiveViewCamera ? mdiVideo : mdiCamera}
|
|
182
|
+
.path=${isAudioOnly ? mdiMicrophone : isLiveViewCamera ? mdiVideo : mdiCamera}
|
|
173
183
|
></ha-svg-icon>
|
|
174
184
|
</md-outlined-button>
|
|
175
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
|
}
|
|
@@ -18,7 +18,7 @@ import { guard } from "lit/directives/guard.js";
|
|
|
18
18
|
import { clientContext, tickContext } from "../client/client-context.js";
|
|
19
19
|
import "../components/ha-svg-icon";
|
|
20
20
|
import { getDeviceIcon, getEndpointIcon } from "../util/device-icons.js";
|
|
21
|
-
import { getEndpointDeviceTypes } from "../util/endpoints.js";
|
|
21
|
+
import { getEndpointDeviceTypes, getEndpointTree } from "../util/endpoints.js";
|
|
22
22
|
import { formatNodeAddress, getEffectiveFabricIndex } from "../util/format_hex.js";
|
|
23
23
|
import "./components/header";
|
|
24
24
|
import "./components/node-details";
|
|
@@ -104,18 +104,22 @@ class MatterNodeView extends LitElement {
|
|
|
104
104
|
</div>
|
|
105
105
|
</md-list-item>
|
|
106
106
|
${guard([this.node, this.node?.attributes], () =>
|
|
107
|
-
getUniqueEndpoints(this.node!).map(
|
|
107
|
+
getEndpointTree(this.node!, getUniqueEndpoints(this.node!)).map(({ endpointId, depth }) => {
|
|
108
108
|
return html`
|
|
109
|
-
<md-list-item
|
|
109
|
+
<md-list-item
|
|
110
|
+
type="link"
|
|
111
|
+
href=${`#node/${this.node!.node_id}/${endpointId}`}
|
|
112
|
+
style=${depth > 0 ? `--md-list-item-leading-space: ${16 + depth * 24}px` : ""}
|
|
113
|
+
>
|
|
110
114
|
<ha-svg-icon
|
|
111
115
|
slot="start"
|
|
112
116
|
class="endpoint-icon"
|
|
113
|
-
.path=${getEndpointIcon(this.node!,
|
|
117
|
+
.path=${getEndpointIcon(this.node!, endpointId)}
|
|
114
118
|
></ha-svg-icon>
|
|
115
|
-
<div slot="headline">Endpoint ${
|
|
119
|
+
<div slot="headline">Endpoint ${endpointId}</div>
|
|
116
120
|
<div slot="supporting-text">
|
|
117
121
|
Device Type(s):
|
|
118
|
-
${getEndpointDeviceTypes(this.node!,
|
|
122
|
+
${getEndpointDeviceTypes(this.node!, endpointId)
|
|
119
123
|
.map(deviceType => {
|
|
120
124
|
return deviceType.label;
|
|
121
125
|
})
|