@matter-server/dashboard 1.4.0 → 1.4.1-alpha.0-20261008-d619c2e
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/README.md +13 -13
- package/dist/esm/client/models/descriptions.d.ts.map +1 -1
- package/dist/esm/client/models/descriptions.js +479 -28
- package/dist/esm/client/models/descriptions.js.map +1 -1
- package/dist/esm/components/avsum-ptz-strip.d.ts.map +1 -1
- package/dist/esm/components/avsum-ptz-strip.js +6 -6
- package/dist/esm/components/avsum-ptz-strip.js.map +1 -1
- package/dist/esm/components/semantic-tag-chips.d.ts +16 -0
- package/dist/esm/components/semantic-tag-chips.d.ts.map +1 -0
- package/dist/esm/components/semantic-tag-chips.js +22 -0
- package/dist/esm/components/semantic-tag-chips.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/access-control-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/access-control-commands.js +3 -2
- package/dist/esm/pages/cluster-commands/clusters/access-control-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/avsum-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/avsum-commands.js +34 -34
- package/dist/esm/pages/cluster-commands/clusters/avsum-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.js +2 -1
- package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js +16 -4
- package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.d.ts +41 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.js +459 -0
- package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/commodity-tariff-commands.js +1 -1
- package/dist/esm/pages/cluster-commands/clusters/commodity-tariff-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.d.ts +34 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.js +324 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.d.ts +30 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.js +167 -0
- package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.d.ts +56 -0
- package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.js +1919 -0
- package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.d.ts +58 -0
- package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.js +886 -0
- package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js +2 -1
- package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.d.ts +25 -0
- package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.js +135 -0
- package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.d.ts +30 -0
- package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.js +266 -0
- package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.d.ts +27 -0
- package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.js +215 -0
- package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/service-area-commands.d.ts +47 -0
- package/dist/esm/pages/cluster-commands/clusters/service-area-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/service-area-commands.js +344 -0
- package/dist/esm/pages/cluster-commands/clusters/service-area-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.d.ts +24 -2
- package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.js +368 -6
- package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.js.map +1 -1
- package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.d.ts +29 -0
- package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.d.ts.map +1 -0
- package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.js +262 -0
- package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.js.map +6 -0
- package/dist/esm/pages/cluster-commands/index.d.ts +10 -0
- package/dist/esm/pages/cluster-commands/index.d.ts.map +1 -1
- package/dist/esm/pages/cluster-commands/index.js +10 -0
- package/dist/esm/pages/cluster-commands/index.js.map +1 -1
- package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
- package/dist/esm/pages/matter-cluster-view.js +6 -24
- package/dist/esm/pages/matter-cluster-view.js.map +1 -1
- package/dist/esm/pages/matter-endpoint-view.d.ts.map +1 -1
- package/dist/esm/pages/matter-endpoint-view.js +20 -2
- package/dist/esm/pages/matter-endpoint-view.js.map +1 -1
- package/dist/esm/pages/matter-network-view.d.ts +16 -0
- package/dist/esm/pages/matter-network-view.d.ts.map +1 -1
- package/dist/esm/pages/matter-network-view.js +55 -6
- package/dist/esm/pages/matter-network-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 +33 -4
- package/dist/esm/pages/matter-node-view.js.map +1 -1
- package/dist/esm/pages/network/border-router-store.d.ts +19 -0
- package/dist/esm/pages/network/border-router-store.d.ts.map +1 -1
- package/dist/esm/pages/network/border-router-store.js +61 -3
- package/dist/esm/pages/network/border-router-store.js.map +1 -1
- package/dist/esm/pages/network/network-details.d.ts +0 -3
- package/dist/esm/pages/network/network-details.d.ts.map +1 -1
- package/dist/esm/pages/network/network-details.js +15 -22
- package/dist/esm/pages/network/network-details.js.map +1 -1
- package/dist/esm/pages/network/network-utils.d.ts +4 -6
- package/dist/esm/pages/network/network-utils.d.ts.map +1 -1
- package/dist/esm/pages/network/network-utils.js +19 -13
- package/dist/esm/pages/network/network-utils.js.map +1 -1
- package/dist/esm/pages/network/thread-graph.d.ts +0 -5
- package/dist/esm/pages/network/thread-graph.d.ts.map +1 -1
- package/dist/esm/pages/network/thread-graph.js +21 -38
- package/dist/esm/pages/network/thread-graph.js.map +1 -1
- package/dist/esm/util/closure-control.d.ts +1 -0
- package/dist/esm/util/closure-control.d.ts.map +1 -1
- package/dist/esm/util/closure-control.js +5 -0
- package/dist/esm/util/closure-control.js.map +1 -1
- package/dist/esm/util/closure-dimension.d.ts +83 -0
- package/dist/esm/util/closure-dimension.d.ts.map +1 -0
- package/dist/esm/util/closure-dimension.js +238 -0
- package/dist/esm/util/closure-dimension.js.map +6 -0
- package/dist/esm/util/commodity-tariff.d.ts +1 -2
- package/dist/esm/util/commodity-tariff.d.ts.map +1 -1
- package/dist/esm/util/commodity-tariff.js +9 -17
- package/dist/esm/util/commodity-tariff.js.map +1 -1
- package/dist/esm/util/device-energy-management-mode.d.ts +35 -0
- package/dist/esm/util/device-energy-management-mode.d.ts.map +1 -0
- package/dist/esm/util/device-energy-management-mode.js +80 -0
- package/dist/esm/util/device-energy-management-mode.js.map +6 -0
- package/dist/esm/util/device-energy-management.d.ts +90 -0
- package/dist/esm/util/device-energy-management.d.ts.map +1 -0
- package/dist/esm/util/device-energy-management.js +230 -0
- package/dist/esm/util/device-energy-management.js.map +6 -0
- package/dist/esm/util/device-icons.d.ts.map +1 -1
- package/dist/esm/util/device-icons.js +3 -3
- package/dist/esm/util/device-icons.js.map +1 -1
- package/dist/esm/util/door-lock.d.ts +249 -0
- package/dist/esm/util/door-lock.d.ts.map +1 -0
- package/dist/esm/util/door-lock.js +724 -0
- package/dist/esm/util/door-lock.js.map +6 -0
- package/dist/esm/util/endpoint-label.d.ts +13 -0
- package/dist/esm/util/endpoint-label.d.ts.map +1 -0
- package/dist/esm/util/endpoint-label.js +41 -0
- package/dist/esm/util/endpoint-label.js.map +6 -0
- package/dist/esm/util/energy-evse.d.ts +116 -0
- package/dist/esm/util/energy-evse.d.ts.map +1 -0
- package/dist/esm/util/energy-evse.js +308 -0
- package/dist/esm/util/energy-evse.js.map +6 -0
- package/dist/esm/util/enum-label.d.ts +24 -0
- package/dist/esm/util/enum-label.d.ts.map +1 -0
- package/dist/esm/util/enum-label.js +24 -0
- package/dist/esm/util/enum-label.js.map +6 -0
- package/dist/esm/util/error-text.d.ts +8 -0
- package/dist/esm/util/error-text.d.ts.map +1 -0
- package/dist/esm/util/error-text.js +12 -0
- package/dist/esm/util/error-text.js.map +6 -0
- package/dist/esm/util/ikea-valve-calibration.d.ts +21 -0
- package/dist/esm/util/ikea-valve-calibration.d.ts.map +1 -0
- package/dist/esm/util/ikea-valve-calibration.js +43 -0
- package/dist/esm/util/ikea-valve-calibration.js.map +6 -0
- package/dist/esm/util/media-playback.d.ts +47 -0
- package/dist/esm/util/media-playback.d.ts.map +1 -0
- package/dist/esm/util/media-playback.js +119 -0
- package/dist/esm/util/media-playback.js.map +6 -0
- package/dist/esm/util/operational-state.d.ts +102 -0
- package/dist/esm/util/operational-state.d.ts.map +1 -0
- package/dist/esm/util/operational-state.js +212 -0
- package/dist/esm/util/operational-state.js.map +6 -0
- package/dist/esm/util/semantic-tags.d.ts +3 -0
- package/dist/esm/util/semantic-tags.d.ts.map +1 -1
- package/dist/esm/util/semantic-tags.js +5 -1
- package/dist/esm/util/semantic-tags.js.map +1 -1
- package/dist/esm/util/service-area.d.ts +88 -0
- package/dist/esm/util/service-area.d.ts.map +1 -0
- package/dist/esm/util/service-area.js +185 -0
- package/dist/esm/util/service-area.js.map +6 -0
- package/dist/esm/util/shared-styles.d.ts +1 -0
- package/dist/esm/util/shared-styles.d.ts.map +1 -1
- package/dist/esm/util/shared-styles.js +37 -17
- package/dist/esm/util/shared-styles.js.map +1 -1
- package/dist/esm/util/thermostat-schedule.d.ts +10 -4
- package/dist/esm/util/thermostat-schedule.d.ts.map +1 -1
- package/dist/esm/util/thermostat-schedule.js +34 -10
- package/dist/esm/util/thermostat-schedule.js.map +1 -1
- package/dist/esm/util/thermostat-suggestions.d.ts +31 -0
- package/dist/esm/util/thermostat-suggestions.d.ts.map +1 -0
- package/dist/esm/util/thermostat-suggestions.js +74 -0
- package/dist/esm/util/thermostat-suggestions.js.map +6 -0
- package/dist/esm/util/time.d.ts +24 -0
- package/dist/esm/util/time.d.ts.map +1 -0
- package/dist/esm/util/time.js +42 -0
- package/dist/esm/util/time.js.map +6 -0
- package/dist/esm/util/water-heater-management.d.ts +56 -0
- package/dist/esm/util/water-heater-management.d.ts.map +1 -0
- package/dist/esm/util/water-heater-management.js +147 -0
- package/dist/esm/util/water-heater-management.js.map +6 -0
- package/dist/web/index.html +4 -0
- package/dist/web/js/{attribute-write-dialog-Dj2vnLR_.js → attribute-write-dialog-DrJZQaXy.js} +1 -1
- package/dist/web/js/{command-invoke-dialog-DJY2HePu.js → command-invoke-dialog-D_zf390T.js} +1 -1
- package/dist/web/js/{commission-node-dialog-BAzJcdYg.js → commission-node-dialog-DIBv_ihK.js} +5 -5
- package/dist/web/js/{commission-node-existing-DDtYs7R-.js → commission-node-existing-ApIugQzz.js} +1 -1
- package/dist/web/js/{commission-node-thread-Bf0XhUqn.js → commission-node-thread-DdEySLrf.js} +1 -1
- package/dist/web/js/{commission-node-wifi-DL4q7kzh.js → commission-node-wifi-BIhsmTCV.js} +1 -1
- package/dist/web/js/{dialog-box-BquhCceT.js → dialog-box-Df4y4onO.js} +1 -1
- package/dist/web/js/{fabric-label-dialog-iLm9DGea.js → fabric-label-dialog-BFs_iHTp.js} +1 -1
- package/dist/web/js/main.js +61 -28
- package/dist/web/js/{matter-dashboard-app-RcyNZLl_.js → matter-dashboard-app-DfcntGqC.js} +17911 -10233
- package/dist/web/js/{node-acl-add-dialog-CyWYXa6M.js → node-acl-add-dialog-DPG7FkNs.js} +1 -1
- package/dist/web/js/{node-binding-dialog-BjQ0KYzx.js → node-binding-dialog-CvQuClGz.js} +1 -1
- package/dist/web/js/{node-label-dialog-BNUn3Joo.js → node-label-dialog-DNEWL6Ku.js} +1 -1
- package/dist/web/js/{settings-dialog-DvAq6gKo.js → settings-dialog-BvAdX2Jo.js} +1 -1
- package/package.json +7 -7
- package/src/client/models/descriptions.ts +479 -28
- package/src/components/avsum-ptz-strip.ts +10 -9
- package/src/components/semantic-tag-chips.ts +30 -0
- package/src/pages/cluster-commands/AGENTS.md +1 -0
- package/src/pages/cluster-commands/clusters/access-control-commands.ts +3 -2
- package/src/pages/cluster-commands/clusters/avsum-commands.ts +44 -42
- package/src/pages/cluster-commands/clusters/basic-information-commands.ts +2 -1
- package/src/pages/cluster-commands/clusters/closure-control-commands.ts +16 -4
- package/src/pages/cluster-commands/clusters/closure-dimension-commands.ts +512 -0
- package/src/pages/cluster-commands/clusters/commodity-tariff-commands.ts +1 -1
- package/src/pages/cluster-commands/clusters/device-energy-management-commands.ts +426 -0
- package/src/pages/cluster-commands/clusters/device-energy-management-mode-commands.ts +172 -0
- package/src/pages/cluster-commands/clusters/door-lock-commands.ts +2120 -0
- package/src/pages/cluster-commands/clusters/energy-evse-commands.ts +1048 -0
- package/src/pages/cluster-commands/clusters/icd-management-commands.ts +2 -1
- package/src/pages/cluster-commands/clusters/ikea-valve-calibration-commands.ts +129 -0
- package/src/pages/cluster-commands/clusters/media-playback-commands.ts +313 -0
- package/src/pages/cluster-commands/clusters/operational-state-commands.ts +234 -0
- package/src/pages/cluster-commands/clusters/service-area-commands.ts +395 -0
- package/src/pages/cluster-commands/clusters/thermostat-commands.ts +418 -7
- package/src/pages/cluster-commands/clusters/water-heater-management-commands.ts +275 -0
- package/src/pages/cluster-commands/index.ts +10 -0
- package/src/pages/matter-cluster-view.ts +6 -28
- package/src/pages/matter-endpoint-view.ts +24 -2
- package/src/pages/matter-network-view.ts +67 -6
- package/src/pages/matter-node-view.ts +35 -4
- package/src/pages/network/border-router-store.ts +77 -2
- package/src/pages/network/network-details.ts +15 -26
- package/src/pages/network/network-utils.ts +15 -15
- package/src/pages/network/thread-graph.ts +32 -48
- package/src/util/closure-control.ts +5 -0
- package/src/util/closure-dimension.ts +307 -0
- package/src/util/commodity-tariff.ts +9 -23
- package/src/util/device-energy-management-mode.ts +132 -0
- package/src/util/device-energy-management.ts +378 -0
- package/src/util/device-icons.ts +4 -6
- package/src/util/door-lock.ts +1076 -0
- package/src/util/endpoint-label.ts +70 -0
- package/src/util/energy-evse.ts +472 -0
- package/src/util/enum-label.ts +39 -0
- package/src/util/error-text.ts +10 -0
- package/src/util/ikea-valve-calibration.ts +54 -0
- package/src/util/media-playback.ts +132 -0
- package/src/util/operational-state.ts +251 -0
- package/src/util/semantic-tags.ts +6 -0
- package/src/util/service-area.ts +313 -0
- package/src/util/shared-styles.ts +37 -17
- package/src/util/thermostat-schedule.ts +39 -11
- package/src/util/thermostat-suggestions.ts +93 -0
- package/src/util/time.ts +54 -0
- package/src/util/water-heater-management.ts +217 -0
|
@@ -20,6 +20,7 @@ import { customElement, state } from "lit/decorators.js";
|
|
|
20
20
|
import { showAlertDialog, showPromptDialog } from "../../../components/dialog-box/show-dialog-box.js";
|
|
21
21
|
import { handleAsync } from "../../../util/async-handler.js";
|
|
22
22
|
import { formatDuration } from "../../../util/duration.js";
|
|
23
|
+
import { errorText } from "../../../util/error-text.js";
|
|
23
24
|
import {
|
|
24
25
|
decodeRegisteredClients,
|
|
25
26
|
ICD_CLUSTER_ID,
|
|
@@ -489,7 +490,7 @@ export class IcdManagementClusterCommands extends BaseClusterCommands {
|
|
|
489
490
|
try {
|
|
490
491
|
await action();
|
|
491
492
|
} catch (error) {
|
|
492
|
-
const message =
|
|
493
|
+
const message = errorText(error);
|
|
493
494
|
if (this.isSameContext(node, endpoint)) {
|
|
494
495
|
await showAlertDialog({ title: "ICD operation failed", text: message });
|
|
495
496
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025-2026 Open Home Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import "@material/web/button/outlined-button";
|
|
8
|
+
import { css, type CSSResultGroup, html, nothing } from "lit";
|
|
9
|
+
import { customElement, state } from "lit/decorators.js";
|
|
10
|
+
import { handleAsync } from "../../../util/async-handler.js";
|
|
11
|
+
import { errorText } from "../../../util/error-text.js";
|
|
12
|
+
import {
|
|
13
|
+
CALIBRATION_IN_PROGRESS,
|
|
14
|
+
IKEA_VALVE_CALIBRATION_CLUSTER_ID,
|
|
15
|
+
valveCalibrationInfo,
|
|
16
|
+
} from "../../../util/ikea-valve-calibration.js";
|
|
17
|
+
import { BaseClusterCommands } from "../base-cluster-commands.js";
|
|
18
|
+
import { registerClusterCommands } from "../registry.js";
|
|
19
|
+
|
|
20
|
+
@customElement("ikea-valve-calibration-cluster-commands")
|
|
21
|
+
class IkeaValveCalibrationClusterCommands extends BaseClusterCommands {
|
|
22
|
+
@state() private _busy = false;
|
|
23
|
+
@state() private _error?: string;
|
|
24
|
+
private _context?: string;
|
|
25
|
+
private _invokeGeneration = 0;
|
|
26
|
+
|
|
27
|
+
override willUpdate(changedProperties: Map<string, unknown>) {
|
|
28
|
+
super.willUpdate(changedProperties);
|
|
29
|
+
if (!this.node) return;
|
|
30
|
+
const context = `${String(this.node.node_id)}/${this.endpoint}`;
|
|
31
|
+
if (this._context !== undefined && this._context !== context) {
|
|
32
|
+
this._error = undefined;
|
|
33
|
+
this._busy = false;
|
|
34
|
+
this._invokeGeneration++;
|
|
35
|
+
}
|
|
36
|
+
this._context = context;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override render() {
|
|
40
|
+
if (!this.node || this.cluster !== IKEA_VALVE_CALIBRATION_CLUSTER_ID) return nothing;
|
|
41
|
+
const { status, lastError } = valveCalibrationInfo(this.node.attributes, this.endpoint);
|
|
42
|
+
const inProgress = status?.value === CALIBRATION_IN_PROGRESS;
|
|
43
|
+
|
|
44
|
+
return html`
|
|
45
|
+
<details class="command-panel" open>
|
|
46
|
+
<summary>Valve Calibration</summary>
|
|
47
|
+
<div class="command-content">
|
|
48
|
+
<dl class="info-grid">
|
|
49
|
+
<dt>Status</dt>
|
|
50
|
+
<dd>${status?.label ?? "—"}</dd>
|
|
51
|
+
<dt>Last error</dt>
|
|
52
|
+
<dd class=${lastError?.isError ? "error" : ""}>${lastError?.label ?? "—"}</dd>
|
|
53
|
+
</dl>
|
|
54
|
+
<div class="command-row">
|
|
55
|
+
<md-outlined-button
|
|
56
|
+
?disabled=${this._busy || inProgress || !this.node.available}
|
|
57
|
+
@click=${handleAsync(() => this._triggerCalibration())}
|
|
58
|
+
>
|
|
59
|
+
Start calibration
|
|
60
|
+
</md-outlined-button>
|
|
61
|
+
</div>
|
|
62
|
+
${this._error ? html`<div class="result-error" role="alert">${this._error}</div>` : nothing}
|
|
63
|
+
</div>
|
|
64
|
+
</details>
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private async _triggerCalibration() {
|
|
69
|
+
const node = this.node;
|
|
70
|
+
const endpoint = this.endpoint;
|
|
71
|
+
const generation = ++this._invokeGeneration;
|
|
72
|
+
const isCurrent = () => this._invokeGeneration === generation && this.isSameContext(node, endpoint);
|
|
73
|
+
this._busy = true;
|
|
74
|
+
this._error = undefined;
|
|
75
|
+
try {
|
|
76
|
+
await this.client.deviceCommand(
|
|
77
|
+
node.node_id,
|
|
78
|
+
endpoint,
|
|
79
|
+
IKEA_VALVE_CALIBRATION_CLUSTER_ID,
|
|
80
|
+
"TriggerCalibration",
|
|
81
|
+
{},
|
|
82
|
+
);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
if (isCurrent()) this._error = `Start calibration: ${errorText(err)}`;
|
|
85
|
+
} finally {
|
|
86
|
+
if (isCurrent()) this._busy = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static override styles: CSSResultGroup = [
|
|
91
|
+
BaseClusterCommands.styles,
|
|
92
|
+
css`
|
|
93
|
+
.info-grid {
|
|
94
|
+
display: grid;
|
|
95
|
+
grid-template-columns: auto 1fr;
|
|
96
|
+
gap: 6px 16px;
|
|
97
|
+
margin: 0 0 12px 0;
|
|
98
|
+
}
|
|
99
|
+
.info-grid dt {
|
|
100
|
+
color: var(--text-color, rgba(0, 0, 0, 0.6));
|
|
101
|
+
font-size: 13px;
|
|
102
|
+
}
|
|
103
|
+
.info-grid dd {
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
}
|
|
107
|
+
.info-grid dd.error {
|
|
108
|
+
color: var(--md-sys-color-error);
|
|
109
|
+
}
|
|
110
|
+
.result-error {
|
|
111
|
+
margin-top: 8px;
|
|
112
|
+
padding: 8px 10px;
|
|
113
|
+
border-radius: 6px;
|
|
114
|
+
background: var(--md-sys-color-error-container);
|
|
115
|
+
color: var(--md-sys-color-on-error-container);
|
|
116
|
+
}
|
|
117
|
+
`,
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
registerClusterCommands(IKEA_VALVE_CALIBRATION_CLUSTER_ID, "ikea-valve-calibration-cluster-commands", {
|
|
122
|
+
renderWhenOffline: true,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
declare global {
|
|
126
|
+
interface HTMLElementTagNameMap {
|
|
127
|
+
"ikea-valve-calibration-cluster-commands": IkeaValveCalibrationClusterCommands;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025-2026 Open Home Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import "@material/web/button/outlined-button";
|
|
8
|
+
import "@material/web/iconbutton/outlined-icon-button";
|
|
9
|
+
import {
|
|
10
|
+
mdiFastForward,
|
|
11
|
+
mdiPause,
|
|
12
|
+
mdiPlay,
|
|
13
|
+
mdiRestart,
|
|
14
|
+
mdiRewind,
|
|
15
|
+
mdiSkipBackward,
|
|
16
|
+
mdiSkipForward,
|
|
17
|
+
mdiSkipNext,
|
|
18
|
+
mdiSkipPrevious,
|
|
19
|
+
mdiStop,
|
|
20
|
+
} from "@mdi/js";
|
|
21
|
+
import { css, html, nothing } from "lit";
|
|
22
|
+
import { customElement, state } from "lit/decorators.js";
|
|
23
|
+
import "../../../components/ha-svg-icon.js";
|
|
24
|
+
import { showAlertDialog } from "../../../components/dialog-box/show-dialog-box.js";
|
|
25
|
+
import { handleAsync } from "../../../util/async-handler.js";
|
|
26
|
+
import {
|
|
27
|
+
FAST_FORWARD_COMMAND_ID,
|
|
28
|
+
formatDurationMs,
|
|
29
|
+
formatPlaybackState,
|
|
30
|
+
invokeTransportCommand,
|
|
31
|
+
MEDIA_PLAYBACK_CLUSTER_ID,
|
|
32
|
+
NEXT_COMMAND_ID,
|
|
33
|
+
parseSkipMs,
|
|
34
|
+
PAUSE_COMMAND_ID,
|
|
35
|
+
PlaybackState,
|
|
36
|
+
PLAY_COMMAND_ID,
|
|
37
|
+
PREVIOUS_COMMAND_ID,
|
|
38
|
+
readCurrentState,
|
|
39
|
+
readDurationMs,
|
|
40
|
+
readPlaybackSpeed,
|
|
41
|
+
readPositionMs,
|
|
42
|
+
REWIND_COMMAND_ID,
|
|
43
|
+
SKIP_BACKWARD_COMMAND_ID,
|
|
44
|
+
SKIP_FORWARD_COMMAND_ID,
|
|
45
|
+
START_OVER_COMMAND_ID,
|
|
46
|
+
STOP_COMMAND_ID,
|
|
47
|
+
supportsCommand,
|
|
48
|
+
} from "../../../util/media-playback.js";
|
|
49
|
+
import { BaseClusterCommands } from "../base-cluster-commands.js";
|
|
50
|
+
import { registerClusterCommands } from "../registry.js";
|
|
51
|
+
|
|
52
|
+
const DEFAULT_SKIP_MS = "10000";
|
|
53
|
+
|
|
54
|
+
@customElement("media-playback-cluster-commands")
|
|
55
|
+
class MediaPlaybackClusterCommands extends BaseClusterCommands {
|
|
56
|
+
@state() private _skipMs = DEFAULT_SKIP_MS;
|
|
57
|
+
private _formContext?: string;
|
|
58
|
+
|
|
59
|
+
override willUpdate(changedProperties: Map<string, unknown>) {
|
|
60
|
+
super.willUpdate(changedProperties);
|
|
61
|
+
if (!this.node) return;
|
|
62
|
+
const context = `${String(this.node.node_id)}/${this.endpoint}/${this.cluster}`;
|
|
63
|
+
if (this._formContext !== undefined && this._formContext !== context) {
|
|
64
|
+
this._skipMs = DEFAULT_SKIP_MS;
|
|
65
|
+
}
|
|
66
|
+
this._formContext = context;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override render() {
|
|
70
|
+
if (!this.node || this.cluster !== MEDIA_PLAYBACK_CLUSTER_ID) return nothing;
|
|
71
|
+
|
|
72
|
+
const playbackState = readCurrentState(this.node, this.endpoint);
|
|
73
|
+
const positionMs = readPositionMs(this.node, this.endpoint);
|
|
74
|
+
const durationMs = readDurationMs(this.node, this.endpoint);
|
|
75
|
+
const speed = readPlaybackSpeed(this.node, this.endpoint);
|
|
76
|
+
const online = this.node.available === true;
|
|
77
|
+
const has = (commandId: number) => supportsCommand(this.node, this.endpoint, commandId);
|
|
78
|
+
const skipMs = parseSkipMs(this._skipMs);
|
|
79
|
+
const anyCommandAdvertised = [
|
|
80
|
+
PREVIOUS_COMMAND_ID,
|
|
81
|
+
REWIND_COMMAND_ID,
|
|
82
|
+
PLAY_COMMAND_ID,
|
|
83
|
+
PAUSE_COMMAND_ID,
|
|
84
|
+
STOP_COMMAND_ID,
|
|
85
|
+
FAST_FORWARD_COMMAND_ID,
|
|
86
|
+
NEXT_COMMAND_ID,
|
|
87
|
+
START_OVER_COMMAND_ID,
|
|
88
|
+
SKIP_BACKWARD_COMMAND_ID,
|
|
89
|
+
SKIP_FORWARD_COMMAND_ID,
|
|
90
|
+
].some(has);
|
|
91
|
+
|
|
92
|
+
return html`
|
|
93
|
+
<details class="command-panel" open>
|
|
94
|
+
<summary>Media Playback Controls</summary>
|
|
95
|
+
<div class="command-content">
|
|
96
|
+
<div class="readout">
|
|
97
|
+
<span class="state-chip ${playbackState === PlaybackState.Playing ? "playing" : ""}"
|
|
98
|
+
>${formatPlaybackState(playbackState)}</span
|
|
99
|
+
>
|
|
100
|
+
${
|
|
101
|
+
positionMs !== null || durationMs !== null
|
|
102
|
+
? html`<span
|
|
103
|
+
>${positionMs !== null ? formatDurationMs(positionMs) : "—"}${
|
|
104
|
+
durationMs !== null ? html` / ${formatDurationMs(durationMs)}` : nothing
|
|
105
|
+
}</span
|
|
106
|
+
>`
|
|
107
|
+
: nothing
|
|
108
|
+
}
|
|
109
|
+
${speed !== null && speed !== 1 ? html`<span class="meta">${speed}×</span>` : nothing}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
${
|
|
113
|
+
anyCommandAdvertised
|
|
114
|
+
? nothing
|
|
115
|
+
: html`<div class="meta">
|
|
116
|
+
This device advertises none of the transport commands this panel offers. Its
|
|
117
|
+
AcceptedCommandList may not have been read yet, or it may support only commands
|
|
118
|
+
handled elsewhere, such as Seek or track selection.
|
|
119
|
+
</div>`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
<div class="transport-row">
|
|
123
|
+
${
|
|
124
|
+
has(PREVIOUS_COMMAND_ID)
|
|
125
|
+
? this._transportButton("Previous", mdiSkipPrevious, online, () =>
|
|
126
|
+
this._invoke("Previous"),
|
|
127
|
+
)
|
|
128
|
+
: nothing
|
|
129
|
+
}
|
|
130
|
+
${
|
|
131
|
+
has(REWIND_COMMAND_ID)
|
|
132
|
+
? this._transportButton("Rewind", mdiRewind, online, () => this._invoke("Rewind"))
|
|
133
|
+
: nothing
|
|
134
|
+
}
|
|
135
|
+
${
|
|
136
|
+
has(PLAY_COMMAND_ID)
|
|
137
|
+
? this._transportButton("Play", mdiPlay, online, () => this._invoke("Play"))
|
|
138
|
+
: nothing
|
|
139
|
+
}
|
|
140
|
+
${
|
|
141
|
+
has(PAUSE_COMMAND_ID)
|
|
142
|
+
? this._transportButton("Pause", mdiPause, online, () => this._invoke("Pause"))
|
|
143
|
+
: nothing
|
|
144
|
+
}
|
|
145
|
+
${
|
|
146
|
+
has(STOP_COMMAND_ID)
|
|
147
|
+
? this._transportButton("Stop", mdiStop, online, () => this._invoke("Stop"))
|
|
148
|
+
: nothing
|
|
149
|
+
}
|
|
150
|
+
${
|
|
151
|
+
has(FAST_FORWARD_COMMAND_ID)
|
|
152
|
+
? this._transportButton("Fast forward", mdiFastForward, online, () =>
|
|
153
|
+
this._invoke("FastForward"),
|
|
154
|
+
)
|
|
155
|
+
: nothing
|
|
156
|
+
}
|
|
157
|
+
${
|
|
158
|
+
has(NEXT_COMMAND_ID)
|
|
159
|
+
? this._transportButton("Next", mdiSkipNext, online, () => this._invoke("Next"))
|
|
160
|
+
: nothing
|
|
161
|
+
}
|
|
162
|
+
${
|
|
163
|
+
has(START_OVER_COMMAND_ID)
|
|
164
|
+
? this._transportButton("Start over", mdiRestart, online, () =>
|
|
165
|
+
this._invoke("StartOver"),
|
|
166
|
+
)
|
|
167
|
+
: nothing
|
|
168
|
+
}
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
${
|
|
172
|
+
has(SKIP_BACKWARD_COMMAND_ID) || has(SKIP_FORWARD_COMMAND_ID)
|
|
173
|
+
? html`
|
|
174
|
+
<div class="command-row">
|
|
175
|
+
<label for="skipMs">Skip (ms):</label>
|
|
176
|
+
<input
|
|
177
|
+
id="skipMs"
|
|
178
|
+
type="number"
|
|
179
|
+
min="1"
|
|
180
|
+
.value=${this._skipMs}
|
|
181
|
+
@input=${(event: Event) => {
|
|
182
|
+
this._skipMs = (event.target as HTMLInputElement).value;
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
${
|
|
186
|
+
has(SKIP_BACKWARD_COMMAND_ID)
|
|
187
|
+
? html`<md-outlined-button
|
|
188
|
+
?disabled=${!online || skipMs === null}
|
|
189
|
+
@click=${handleAsync(
|
|
190
|
+
() => this._skipBackward(),
|
|
191
|
+
this._failureReporter(),
|
|
192
|
+
)}
|
|
193
|
+
>
|
|
194
|
+
<ha-svg-icon slot="icon" .path=${mdiSkipBackward}></ha-svg-icon>
|
|
195
|
+
Skip backward
|
|
196
|
+
</md-outlined-button>`
|
|
197
|
+
: nothing
|
|
198
|
+
}
|
|
199
|
+
${
|
|
200
|
+
has(SKIP_FORWARD_COMMAND_ID)
|
|
201
|
+
? html`<md-outlined-button
|
|
202
|
+
?disabled=${!online || skipMs === null}
|
|
203
|
+
@click=${handleAsync(
|
|
204
|
+
() => this._skipForward(),
|
|
205
|
+
this._failureReporter(),
|
|
206
|
+
)}
|
|
207
|
+
>
|
|
208
|
+
<ha-svg-icon slot="icon" .path=${mdiSkipForward}></ha-svg-icon>
|
|
209
|
+
Skip forward
|
|
210
|
+
</md-outlined-button>`
|
|
211
|
+
: nothing
|
|
212
|
+
}
|
|
213
|
+
</div>
|
|
214
|
+
`
|
|
215
|
+
: nothing
|
|
216
|
+
}
|
|
217
|
+
</div>
|
|
218
|
+
</details>
|
|
219
|
+
`;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private _transportButton(label: string, icon: string, online: boolean, onClick: () => Promise<void>) {
|
|
223
|
+
return html`
|
|
224
|
+
<md-outlined-icon-button
|
|
225
|
+
title=${label}
|
|
226
|
+
aria-label=${label}
|
|
227
|
+
?disabled=${!online}
|
|
228
|
+
@click=${handleAsync(onClick, this._failureReporter())}
|
|
229
|
+
>
|
|
230
|
+
<ha-svg-icon .path=${icon}></ha-svg-icon>
|
|
231
|
+
</md-outlined-icon-button>
|
|
232
|
+
`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private async _invoke(command: string, payload?: Record<string, unknown>) {
|
|
236
|
+
await invokeTransportCommand(this.client, this.node.node_id, this.endpoint, command, payload);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private async _skipForward() {
|
|
240
|
+
const deltaPositionMilliseconds = parseSkipMs(this._skipMs);
|
|
241
|
+
if (deltaPositionMilliseconds === null) return;
|
|
242
|
+
await this._invoke("SkipForward", { deltaPositionMilliseconds });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private async _skipBackward() {
|
|
246
|
+
const deltaPositionMilliseconds = parseSkipMs(this._skipMs);
|
|
247
|
+
if (deltaPositionMilliseconds === null) return;
|
|
248
|
+
await this._invoke("SkipBackward", { deltaPositionMilliseconds });
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Captures the panel's context at render time; a reused panel must not raise the old device's error. */
|
|
252
|
+
private _failureReporter() {
|
|
253
|
+
const node = this.node;
|
|
254
|
+
const endpoint = this.endpoint;
|
|
255
|
+
return (err: Error) => {
|
|
256
|
+
if (!this.isSameContext(node, endpoint)) return;
|
|
257
|
+
showAlertDialog({ title: "Media Playback command failed", text: err.message }).catch(dialogErr =>
|
|
258
|
+
console.error("Failed to show the MediaPlayback command error", dialogErr),
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
static override styles = [
|
|
264
|
+
...(Array.isArray(BaseClusterCommands.styles) ? BaseClusterCommands.styles : [BaseClusterCommands.styles]),
|
|
265
|
+
css`
|
|
266
|
+
.readout {
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
gap: 16px;
|
|
270
|
+
flex-wrap: wrap;
|
|
271
|
+
font-family: var(--monospace-font, monospace);
|
|
272
|
+
font-size: 0.85rem;
|
|
273
|
+
padding: 4px 0 12px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.state-chip {
|
|
277
|
+
padding: 2px 8px;
|
|
278
|
+
border-radius: 4px;
|
|
279
|
+
background: var(--md-sys-color-secondary-container);
|
|
280
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
281
|
+
font-size: 0.75rem;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.state-chip.playing {
|
|
285
|
+
background: var(--md-sys-color-primary-container);
|
|
286
|
+
color: var(--md-sys-color-on-primary-container);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.meta {
|
|
290
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.transport-row {
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: flex-start;
|
|
297
|
+
gap: 12px;
|
|
298
|
+
padding: 4px 0 16px;
|
|
299
|
+
flex-wrap: wrap;
|
|
300
|
+
}
|
|
301
|
+
`,
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
registerClusterCommands(MEDIA_PLAYBACK_CLUSTER_ID, "media-playback-cluster-commands", {
|
|
306
|
+
renderWhenOffline: true,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
declare global {
|
|
310
|
+
interface HTMLElementTagNameMap {
|
|
311
|
+
"media-playback-cluster-commands": MediaPlaybackClusterCommands;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025-2026 Open Home Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import "@material/web/button/outlined-button";
|
|
8
|
+
import { css, type CSSResultGroup, html, nothing } from "lit";
|
|
9
|
+
import { customElement, state } from "lit/decorators.js";
|
|
10
|
+
import { handleAsync } from "../../../util/async-handler.js";
|
|
11
|
+
import { errorText } from "../../../util/error-text.js";
|
|
12
|
+
import {
|
|
13
|
+
ACCEPTED_COMMAND_LIST_ATTR,
|
|
14
|
+
decodeAcceptedCommands,
|
|
15
|
+
decodeOperationalCommandResponse,
|
|
16
|
+
decodeOperationalError,
|
|
17
|
+
describeOperationalState,
|
|
18
|
+
OPERATIONAL_ERROR_ATTR,
|
|
19
|
+
OPERATIONAL_STATE_ATTR,
|
|
20
|
+
OPERATIONAL_STATE_LIST_ATTR,
|
|
21
|
+
OPERATIONAL_STATE_VARIANTS,
|
|
22
|
+
type OperationalStateVariant,
|
|
23
|
+
} from "../../../util/operational-state.js";
|
|
24
|
+
import { BaseClusterCommands } from "../base-cluster-commands.js";
|
|
25
|
+
import { registerClusterCommands } from "../registry.js";
|
|
26
|
+
|
|
27
|
+
@customElement("operational-state-cluster-commands")
|
|
28
|
+
class OperationalStateClusterCommands extends BaseClusterCommands {
|
|
29
|
+
@state() private _busy = false;
|
|
30
|
+
@state() private _result?: { commandLabel: string; label: string; isError: boolean; details?: string };
|
|
31
|
+
@state() private _error?: string;
|
|
32
|
+
private _formContext?: string;
|
|
33
|
+
private _invokeGeneration = 0;
|
|
34
|
+
|
|
35
|
+
override willUpdate(changedProperties: Map<string, unknown>) {
|
|
36
|
+
super.willUpdate(changedProperties);
|
|
37
|
+
if (!this.node) return;
|
|
38
|
+
const context = `${String(this.node.node_id)}/${this.endpoint}/${this.cluster}`;
|
|
39
|
+
if (this._formContext !== undefined && this._formContext !== context) {
|
|
40
|
+
this._result = undefined;
|
|
41
|
+
this._error = undefined;
|
|
42
|
+
this._busy = false;
|
|
43
|
+
this._invokeGeneration++;
|
|
44
|
+
}
|
|
45
|
+
this._formContext = context;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override render() {
|
|
49
|
+
const variant = OPERATIONAL_STATE_VARIANTS[this.cluster];
|
|
50
|
+
if (!this.node || variant === undefined) return nothing;
|
|
51
|
+
const attribute = (attributeId: number) =>
|
|
52
|
+
this.node.attributes[`${this.endpoint}/${variant.clusterId}/${attributeId}`];
|
|
53
|
+
|
|
54
|
+
const operationalState = describeOperationalState(
|
|
55
|
+
variant,
|
|
56
|
+
attribute(OPERATIONAL_STATE_ATTR),
|
|
57
|
+
attribute(OPERATIONAL_STATE_LIST_ATTR),
|
|
58
|
+
);
|
|
59
|
+
const operationalError = decodeOperationalError(variant, attribute(OPERATIONAL_ERROR_ATTR));
|
|
60
|
+
|
|
61
|
+
const acceptedCommands = decodeAcceptedCommands(attribute(ACCEPTED_COMMAND_LIST_ATTR));
|
|
62
|
+
const commands = variant.commands.filter(command => acceptedCommands?.has(command.id) ?? true);
|
|
63
|
+
|
|
64
|
+
const disabled = this._busy || !this.node.available;
|
|
65
|
+
|
|
66
|
+
return html`
|
|
67
|
+
<details class="command-panel">
|
|
68
|
+
<summary>${variant.title} Commands</summary>
|
|
69
|
+
<div class="command-content">
|
|
70
|
+
${this._renderStateInfo(operationalState, operationalError)}
|
|
71
|
+
<div class="command-row">
|
|
72
|
+
${commands.map(
|
|
73
|
+
command =>
|
|
74
|
+
html`<md-outlined-button
|
|
75
|
+
?disabled=${disabled}
|
|
76
|
+
@click=${handleAsync(() => this._invoke(variant, command.name, command.label))}
|
|
77
|
+
>
|
|
78
|
+
${command.label}
|
|
79
|
+
</md-outlined-button>`,
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
${
|
|
83
|
+
this._result
|
|
84
|
+
? html`<div
|
|
85
|
+
class="result ${this._result.isError ? "result-error" : ""}"
|
|
86
|
+
role=${this._result.isError ? "alert" : "status"}
|
|
87
|
+
>
|
|
88
|
+
${this._result.commandLabel} →
|
|
89
|
+
${this._result.label}${
|
|
90
|
+
this._result.details ? html`: ${this._result.details}` : nothing
|
|
91
|
+
}
|
|
92
|
+
</div>`
|
|
93
|
+
: nothing
|
|
94
|
+
}
|
|
95
|
+
${this._error ? html`<div class="result result-error" role="alert">${this._error}</div>` : nothing}
|
|
96
|
+
</div>
|
|
97
|
+
</details>
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private _renderStateInfo(
|
|
102
|
+
operationalState: string | null,
|
|
103
|
+
operationalError: ReturnType<typeof decodeOperationalError>,
|
|
104
|
+
) {
|
|
105
|
+
if (!operationalState && !operationalError) return nothing;
|
|
106
|
+
|
|
107
|
+
return html`
|
|
108
|
+
<div class="state-info">
|
|
109
|
+
${
|
|
110
|
+
operationalState
|
|
111
|
+
? html`
|
|
112
|
+
<div class="state-item">
|
|
113
|
+
<span class="label">State:</span>
|
|
114
|
+
<span class="value">${operationalState}</span>
|
|
115
|
+
</div>
|
|
116
|
+
`
|
|
117
|
+
: nothing
|
|
118
|
+
}
|
|
119
|
+
${
|
|
120
|
+
operationalError
|
|
121
|
+
? html`
|
|
122
|
+
<div class="state-item ${operationalError.isError ? "error" : ""}">
|
|
123
|
+
<span class="label">Error:</span>
|
|
124
|
+
<span class="value"
|
|
125
|
+
>${operationalError.label}${
|
|
126
|
+
operationalError.details ? html` (${operationalError.details})` : nothing
|
|
127
|
+
}</span
|
|
128
|
+
>
|
|
129
|
+
</div>
|
|
130
|
+
`
|
|
131
|
+
: nothing
|
|
132
|
+
}
|
|
133
|
+
</div>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private async _invoke(variant: OperationalStateVariant, command: string, label: string) {
|
|
138
|
+
const node = this.node;
|
|
139
|
+
const endpoint = this.endpoint;
|
|
140
|
+
const generation = ++this._invokeGeneration;
|
|
141
|
+
const isCurrent = () => this._invokeGeneration === generation && this.isSameContext(node, endpoint);
|
|
142
|
+
this._busy = true;
|
|
143
|
+
this._error = undefined;
|
|
144
|
+
this._result = undefined;
|
|
145
|
+
try {
|
|
146
|
+
const response = await this.client.deviceCommand(node.node_id, endpoint, variant.clusterId, command, {});
|
|
147
|
+
if (!isCurrent()) return;
|
|
148
|
+
const outcome = decodeOperationalCommandResponse(variant, response);
|
|
149
|
+
this._result = {
|
|
150
|
+
commandLabel: label,
|
|
151
|
+
label: outcome.label,
|
|
152
|
+
isError: outcome.isError,
|
|
153
|
+
details: outcome.details,
|
|
154
|
+
};
|
|
155
|
+
} catch (err) {
|
|
156
|
+
if (isCurrent()) this._error = `${label}: ${errorText(err)}`;
|
|
157
|
+
} finally {
|
|
158
|
+
if (isCurrent()) this._busy = false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static override styles: CSSResultGroup = [
|
|
163
|
+
BaseClusterCommands.styles,
|
|
164
|
+
css`
|
|
165
|
+
.state-info {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
gap: 12px;
|
|
169
|
+
margin-bottom: 16px;
|
|
170
|
+
padding: 12px;
|
|
171
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
172
|
+
border-radius: 8px;
|
|
173
|
+
border-left: 4px solid var(--md-sys-color-primary);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.state-item {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: 12px;
|
|
180
|
+
font-size: 14px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.state-item.error {
|
|
184
|
+
border-left: 4px solid var(--md-sys-color-error);
|
|
185
|
+
padding-left: 12px;
|
|
186
|
+
margin-left: -12px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.state-item .label {
|
|
190
|
+
font-weight: 500;
|
|
191
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
192
|
+
min-width: 60px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.state-item .value {
|
|
196
|
+
color: var(--md-sys-color-on-surface);
|
|
197
|
+
font-family: var(--monospace-font, monospace);
|
|
198
|
+
padding: 4px 8px;
|
|
199
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
200
|
+
border-radius: 4px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.state-item.error .value {
|
|
204
|
+
background-color: color-mix(in srgb, var(--md-sys-color-error) 12%, transparent);
|
|
205
|
+
color: var(--md-sys-color-error);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.result {
|
|
209
|
+
margin-top: 8px;
|
|
210
|
+
padding: 8px 10px;
|
|
211
|
+
border-radius: 6px;
|
|
212
|
+
background: color-mix(in srgb, var(--success-color) 18%, transparent);
|
|
213
|
+
color: var(--success-color);
|
|
214
|
+
border: 1px solid color-mix(in srgb, var(--success-color) 40%, transparent);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.result-error {
|
|
218
|
+
background: var(--md-sys-color-error-container);
|
|
219
|
+
color: var(--md-sys-color-on-error-container);
|
|
220
|
+
border: none;
|
|
221
|
+
}
|
|
222
|
+
`,
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
for (const clusterId of Object.keys(OPERATIONAL_STATE_VARIANTS)) {
|
|
227
|
+
registerClusterCommands(Number(clusterId), "operational-state-cluster-commands");
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
declare global {
|
|
231
|
+
interface HTMLElementTagNameMap {
|
|
232
|
+
"operational-state-cluster-commands": OperationalStateClusterCommands;
|
|
233
|
+
}
|
|
234
|
+
}
|