@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
|
@@ -0,0 +1,395 @@
|
|
|
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 { MdCheckbox } from "@material/web/checkbox/checkbox.js";
|
|
9
|
+
import { css, html, nothing, type CSSResultGroup } from "lit";
|
|
10
|
+
import { customElement, state } from "lit/decorators.js";
|
|
11
|
+
import { handleAsync } from "../../../util/async-handler.js";
|
|
12
|
+
import { formatDuration } from "../../../util/duration.js";
|
|
13
|
+
import { errorText } from "../../../util/error-text.js";
|
|
14
|
+
import {
|
|
15
|
+
SERVICE_AREA_CLUSTER_ID,
|
|
16
|
+
areaLabel,
|
|
17
|
+
decodeSelectAreasResult,
|
|
18
|
+
decodeSkipAreaResult,
|
|
19
|
+
describeOperationalStatus,
|
|
20
|
+
isSkippable,
|
|
21
|
+
OperationalStatus,
|
|
22
|
+
remainingSeconds,
|
|
23
|
+
remainingTimeLabel,
|
|
24
|
+
serviceAreaInfo,
|
|
25
|
+
type AreaInfo,
|
|
26
|
+
type CommandResult,
|
|
27
|
+
type MapInfo,
|
|
28
|
+
type ProgressInfo,
|
|
29
|
+
type ServiceAreaInfo,
|
|
30
|
+
} from "../../../util/service-area.js";
|
|
31
|
+
import { formatEpochTime } from "../../../util/time.js";
|
|
32
|
+
import { BaseClusterCommands } from "../base-cluster-commands.js";
|
|
33
|
+
import { registerClusterCommands } from "../registry.js";
|
|
34
|
+
|
|
35
|
+
const CLUSTER_ID = SERVICE_AREA_CLUSTER_ID;
|
|
36
|
+
|
|
37
|
+
const COUNTDOWN_INTERVAL_MS = 1000;
|
|
38
|
+
|
|
39
|
+
@customElement("service-area-cluster-commands")
|
|
40
|
+
class ServiceAreaClusterCommands extends BaseClusterCommands {
|
|
41
|
+
@state() private _selectedAreaIds = new Set<number>();
|
|
42
|
+
@state() private _busy = false;
|
|
43
|
+
@state() private _result?: { command: "SelectAreas" | "SkipArea"; result: CommandResult };
|
|
44
|
+
@state() private _error?: string;
|
|
45
|
+
private _formContext?: string;
|
|
46
|
+
/** An invoke started before a reset must not write its outcome into the panel that replaced it. */
|
|
47
|
+
private _invokeGeneration = 0;
|
|
48
|
+
/** Until the user picks areas, the checkboxes follow the device's own SelectedAreas. */
|
|
49
|
+
private _selectionEdited = false;
|
|
50
|
+
private _info?: ServiceAreaInfo;
|
|
51
|
+
private _countdownTimer?: ReturnType<typeof setInterval>;
|
|
52
|
+
|
|
53
|
+
override connectedCallback() {
|
|
54
|
+
super.connectedCallback();
|
|
55
|
+
// A reconnected element gets no property change, so nothing else would restart the countdown.
|
|
56
|
+
if (this._info !== undefined) this._syncCountdown(this._info);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override disconnectedCallback() {
|
|
60
|
+
super.disconnectedCallback();
|
|
61
|
+
this._stopCountdown();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
override willUpdate(changedProperties: Map<string, unknown>) {
|
|
65
|
+
super.willUpdate(changedProperties);
|
|
66
|
+
if (!this.node) {
|
|
67
|
+
this._stopCountdown();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const context = `${String(this.node.node_id)}/${this.endpoint}/${this.cluster}`;
|
|
71
|
+
if (this._formContext !== undefined && this._formContext !== context) {
|
|
72
|
+
this._selectedAreaIds = new Set();
|
|
73
|
+
this._selectionEdited = false;
|
|
74
|
+
this._result = undefined;
|
|
75
|
+
this._error = undefined;
|
|
76
|
+
this._busy = false;
|
|
77
|
+
this._invokeGeneration++;
|
|
78
|
+
}
|
|
79
|
+
this._formContext = context;
|
|
80
|
+
|
|
81
|
+
if (this.cluster !== CLUSTER_ID) {
|
|
82
|
+
this._info = undefined;
|
|
83
|
+
this._stopCountdown();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const info = serviceAreaInfo(this.node.attributes, this.endpoint);
|
|
88
|
+
this._info = info;
|
|
89
|
+
this._syncSelection(info);
|
|
90
|
+
this._syncCountdown(info);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* SelectAreas replaces the device's whole selection, so a panel that starts empty would cancel
|
|
95
|
+
* whatever is running the moment the user submits. An edited selection still drops areas the
|
|
96
|
+
* device no longer supports, which it would only reject as UnsupportedArea.
|
|
97
|
+
*/
|
|
98
|
+
private _syncSelection(info: ServiceAreaInfo) {
|
|
99
|
+
const supported = new Set(info.supportedAreas.map(area => area.areaId));
|
|
100
|
+
const next = new Set(
|
|
101
|
+
(this._selectionEdited ? [...this._selectedAreaIds] : info.selectedAreas).filter(areaId =>
|
|
102
|
+
supported.has(areaId),
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
if (next.size !== this._selectedAreaIds.size || [...next].some(id => !this._selectedAreaIds.has(id))) {
|
|
106
|
+
this._selectedAreaIds = next;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private _syncCountdown(info: ServiceAreaInfo) {
|
|
111
|
+
const needed = typeof info.estimatedEndTime === "number" && remainingSeconds(info.estimatedEndTime) > 0;
|
|
112
|
+
if (needed && this._countdownTimer === undefined) {
|
|
113
|
+
this._countdownTimer = setInterval(() => this.requestUpdate(), COUNTDOWN_INTERVAL_MS);
|
|
114
|
+
} else if (!needed) {
|
|
115
|
+
this._stopCountdown();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private _stopCountdown() {
|
|
120
|
+
if (this._countdownTimer !== undefined) {
|
|
121
|
+
clearInterval(this._countdownTimer);
|
|
122
|
+
this._countdownTimer = undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private _toggleArea(areaId: number, checked: boolean) {
|
|
127
|
+
const next = new Set(this._selectedAreaIds);
|
|
128
|
+
if (checked) next.add(areaId);
|
|
129
|
+
else next.delete(areaId);
|
|
130
|
+
this._selectionEdited = true;
|
|
131
|
+
this._selectedAreaIds = next;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private async _selectAreas() {
|
|
135
|
+
const node = this.node;
|
|
136
|
+
const endpoint = this.endpoint;
|
|
137
|
+
const generation = ++this._invokeGeneration;
|
|
138
|
+
const isCurrent = () => this._invokeGeneration === generation && this.isSameContext(node, endpoint);
|
|
139
|
+
this._busy = true;
|
|
140
|
+
this._error = undefined;
|
|
141
|
+
this._result = undefined;
|
|
142
|
+
try {
|
|
143
|
+
const response = await this.client.deviceCommand(node.node_id, endpoint, CLUSTER_ID, "SelectAreas", {
|
|
144
|
+
newAreas: [...this._selectedAreaIds],
|
|
145
|
+
});
|
|
146
|
+
if (!isCurrent()) return;
|
|
147
|
+
const result = decodeSelectAreasResult(response);
|
|
148
|
+
this._result = { command: "SelectAreas", result };
|
|
149
|
+
// The device now owns the selection again, so let SelectedAreas drive the checkboxes.
|
|
150
|
+
if (result.success) this._selectionEdited = false;
|
|
151
|
+
} catch (err) {
|
|
152
|
+
if (isCurrent()) this._error = errorText(err);
|
|
153
|
+
} finally {
|
|
154
|
+
if (isCurrent()) this._busy = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private async _skipArea(areaId: number) {
|
|
159
|
+
const node = this.node;
|
|
160
|
+
const endpoint = this.endpoint;
|
|
161
|
+
const generation = ++this._invokeGeneration;
|
|
162
|
+
const isCurrent = () => this._invokeGeneration === generation && this.isSameContext(node, endpoint);
|
|
163
|
+
this._busy = true;
|
|
164
|
+
this._error = undefined;
|
|
165
|
+
this._result = undefined;
|
|
166
|
+
try {
|
|
167
|
+
const response = await this.client.deviceCommand(node.node_id, endpoint, CLUSTER_ID, "SkipArea", {
|
|
168
|
+
skippedArea: areaId,
|
|
169
|
+
});
|
|
170
|
+
if (!isCurrent()) return;
|
|
171
|
+
this._result = { command: "SkipArea", result: decodeSkipAreaResult(response) };
|
|
172
|
+
} catch (err) {
|
|
173
|
+
if (isCurrent()) this._error = errorText(err);
|
|
174
|
+
} finally {
|
|
175
|
+
if (isCurrent()) this._busy = false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private _renderArea(area: AreaInfo, info: ServiceAreaInfo) {
|
|
180
|
+
const isCurrent = info.currentArea === area.areaId;
|
|
181
|
+
const progress = info.progress.find(entry => entry.areaId === area.areaId);
|
|
182
|
+
|
|
183
|
+
return html`
|
|
184
|
+
<li class="area-row ${isCurrent ? "area-row-current" : ""}">
|
|
185
|
+
<label>
|
|
186
|
+
<md-checkbox
|
|
187
|
+
.checked=${this._selectedAreaIds.has(area.areaId)}
|
|
188
|
+
?disabled=${this._busy || !this.node.available || !info.commands.selectAreas}
|
|
189
|
+
@change=${(e: Event) => {
|
|
190
|
+
if (e.target instanceof MdCheckbox) this._toggleArea(area.areaId, e.target.checked);
|
|
191
|
+
}}
|
|
192
|
+
></md-checkbox>
|
|
193
|
+
<span
|
|
194
|
+
>${areaLabel(area)}${
|
|
195
|
+
// The map header already conveys the floor once maps group the list; a
|
|
196
|
+
// per-row number is only informative in the flat, ungrouped fallback.
|
|
197
|
+
area.floorNumber !== undefined && !info.features.maps
|
|
198
|
+
? html` <span>floor ${area.floorNumber}</span>`
|
|
199
|
+
: nothing
|
|
200
|
+
}${isCurrent ? html` <strong>(current)</strong>` : nothing}</span
|
|
201
|
+
>
|
|
202
|
+
</label>
|
|
203
|
+
${progress ? this._renderProgressBadge(progress) : nothing}
|
|
204
|
+
${
|
|
205
|
+
isSkippable(info, area.areaId)
|
|
206
|
+
? html`<md-outlined-button
|
|
207
|
+
?disabled=${this._busy || !this.node.available}
|
|
208
|
+
@click=${handleAsync(() => this._skipArea(area.areaId))}
|
|
209
|
+
>Skip</md-outlined-button
|
|
210
|
+
>`
|
|
211
|
+
: nothing
|
|
212
|
+
}
|
|
213
|
+
</li>
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private _renderProgressBadge(progress: ProgressInfo) {
|
|
218
|
+
const status = describeOperationalStatus(progress.status);
|
|
219
|
+
const times = new Array<string>();
|
|
220
|
+
if (progress.totalOperationalTime !== undefined) {
|
|
221
|
+
times.push(`ran ${formatDuration(progress.totalOperationalTime)}`);
|
|
222
|
+
}
|
|
223
|
+
if (progress.estimatedTime !== undefined) times.push(`~${formatDuration(progress.estimatedTime)} estimated`);
|
|
224
|
+
|
|
225
|
+
return html`<span class="progress-badge progress-${status.key}"
|
|
226
|
+
>${status.label}${times.length > 0 ? html` <span class="area-detail">${times.join(", ")}</span>` : nothing}</span
|
|
227
|
+
>`;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private _renderMapGroup(map: MapInfo | undefined, areas: AreaInfo[], info: ServiceAreaInfo) {
|
|
231
|
+
return html`
|
|
232
|
+
${map ? html`<h4 class="map-name">${map.name}</h4>` : nothing}
|
|
233
|
+
<ul class="area-list">
|
|
234
|
+
${areas.map(area => this._renderArea(area, info))}
|
|
235
|
+
</ul>
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
override render() {
|
|
240
|
+
const info = this._info;
|
|
241
|
+
if (!this.node || info === undefined) return nothing;
|
|
242
|
+
|
|
243
|
+
const knownMapIds = new Set(info.supportedMaps.map(map => map.mapId));
|
|
244
|
+
const groups: { map: MapInfo | undefined; areas: AreaInfo[] }[] = info.features.maps
|
|
245
|
+
? [
|
|
246
|
+
...info.supportedMaps.map(map => ({
|
|
247
|
+
map,
|
|
248
|
+
areas: info.supportedAreas.filter(a => a.mapId === map.mapId),
|
|
249
|
+
})),
|
|
250
|
+
{
|
|
251
|
+
map: undefined,
|
|
252
|
+
areas: info.supportedAreas.filter(a => a.mapId === undefined || !knownMapIds.has(a.mapId)),
|
|
253
|
+
},
|
|
254
|
+
].filter(group => group.areas.length > 0)
|
|
255
|
+
: [{ map: undefined, areas: info.supportedAreas }];
|
|
256
|
+
|
|
257
|
+
const running = info.progress.some(entry => entry.status === OperationalStatus.Operating);
|
|
258
|
+
|
|
259
|
+
return html`
|
|
260
|
+
<details class="command-panel">
|
|
261
|
+
<summary>Service Area</summary>
|
|
262
|
+
<div class="command-content">
|
|
263
|
+
${
|
|
264
|
+
typeof info.estimatedEndTime === "number"
|
|
265
|
+
? html`<div class="command-row">
|
|
266
|
+
<span
|
|
267
|
+
>Estimated end:
|
|
268
|
+
<strong>${formatEpochTime(info.estimatedEndTime)}</strong>
|
|
269
|
+
<span class="area-detail">${remainingTimeLabel(info.estimatedEndTime)}</span>
|
|
270
|
+
</span>
|
|
271
|
+
</div>`
|
|
272
|
+
: nothing
|
|
273
|
+
}
|
|
274
|
+
${
|
|
275
|
+
info.supportedAreas.length === 0
|
|
276
|
+
? html`<div class="command-row">No supported areas reported.</div>`
|
|
277
|
+
: groups.map(group => this._renderMapGroup(group.map, group.areas, info))
|
|
278
|
+
}
|
|
279
|
+
<div class="command-row">
|
|
280
|
+
<md-outlined-button
|
|
281
|
+
?disabled=${
|
|
282
|
+
this._busy ||
|
|
283
|
+
!this.node.available ||
|
|
284
|
+
!info.commands.selectAreas ||
|
|
285
|
+
(running && !info.features.selectWhileRunning)
|
|
286
|
+
}
|
|
287
|
+
@click=${handleAsync(() => this._selectAreas())}
|
|
288
|
+
>Select Areas (${this._selectedAreaIds.size})</md-outlined-button
|
|
289
|
+
>
|
|
290
|
+
${
|
|
291
|
+
running && !info.features.selectWhileRunning
|
|
292
|
+
? html`<span class="area-detail"
|
|
293
|
+
>The device rejects a new selection while it is running.</span
|
|
294
|
+
>`
|
|
295
|
+
: nothing
|
|
296
|
+
}
|
|
297
|
+
</div>
|
|
298
|
+
${
|
|
299
|
+
this._result
|
|
300
|
+
? html`<div
|
|
301
|
+
class="result ${this._result.result.success ? "" : "result-error"}"
|
|
302
|
+
role=${this._result.result.success ? "status" : "alert"}
|
|
303
|
+
>
|
|
304
|
+
${this._result.command} → ${this._result.result.statusName}
|
|
305
|
+
(${this._result.result.status})${
|
|
306
|
+
this._result.result.statusText
|
|
307
|
+
? html`: ${this._result.result.statusText}`
|
|
308
|
+
: nothing
|
|
309
|
+
}
|
|
310
|
+
</div>`
|
|
311
|
+
: nothing
|
|
312
|
+
}
|
|
313
|
+
${this._error ? html`<div class="result result-error" role="alert">${this._error}</div>` : nothing}
|
|
314
|
+
</div>
|
|
315
|
+
</details>
|
|
316
|
+
`;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
static override styles: CSSResultGroup = [
|
|
320
|
+
BaseClusterCommands.styles,
|
|
321
|
+
css`
|
|
322
|
+
.map-name {
|
|
323
|
+
margin: 12px 0 4px 0;
|
|
324
|
+
font-size: 13px;
|
|
325
|
+
font-weight: 500;
|
|
326
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
327
|
+
}
|
|
328
|
+
.area-list {
|
|
329
|
+
list-style: none;
|
|
330
|
+
margin: 0 0 12px 0;
|
|
331
|
+
padding: 0;
|
|
332
|
+
display: flex;
|
|
333
|
+
flex-direction: column;
|
|
334
|
+
gap: 4px;
|
|
335
|
+
}
|
|
336
|
+
.area-row {
|
|
337
|
+
display: flex;
|
|
338
|
+
align-items: center;
|
|
339
|
+
gap: 12px;
|
|
340
|
+
padding: 4px 0;
|
|
341
|
+
font-size: 14px;
|
|
342
|
+
}
|
|
343
|
+
.area-row label {
|
|
344
|
+
display: flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
gap: 8px;
|
|
347
|
+
cursor: pointer;
|
|
348
|
+
}
|
|
349
|
+
.area-row-current {
|
|
350
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
351
|
+
border-radius: 8px;
|
|
352
|
+
}
|
|
353
|
+
.area-detail {
|
|
354
|
+
font-size: 12px;
|
|
355
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
356
|
+
}
|
|
357
|
+
.progress-badge {
|
|
358
|
+
font-size: 12px;
|
|
359
|
+
padding: 2px 8px;
|
|
360
|
+
border-radius: 8px;
|
|
361
|
+
background-color: var(--md-sys-color-surface-container-highest);
|
|
362
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
363
|
+
}
|
|
364
|
+
.progress-operating {
|
|
365
|
+
background-color: var(--md-sys-color-tertiary-container);
|
|
366
|
+
color: var(--md-sys-color-on-tertiary-container);
|
|
367
|
+
}
|
|
368
|
+
.progress-completed {
|
|
369
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
370
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
371
|
+
}
|
|
372
|
+
.result {
|
|
373
|
+
margin-top: 8px;
|
|
374
|
+
padding: 8px 10px;
|
|
375
|
+
border-radius: 6px;
|
|
376
|
+
background: color-mix(in srgb, var(--success-color) 18%, transparent);
|
|
377
|
+
color: var(--success-color);
|
|
378
|
+
border: 1px solid color-mix(in srgb, var(--success-color) 40%, transparent);
|
|
379
|
+
}
|
|
380
|
+
.result-error {
|
|
381
|
+
background: var(--md-sys-color-error-container);
|
|
382
|
+
color: var(--md-sys-color-on-error-container);
|
|
383
|
+
border: none;
|
|
384
|
+
}
|
|
385
|
+
`,
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
registerClusterCommands(CLUSTER_ID, "service-area-cluster-commands");
|
|
390
|
+
|
|
391
|
+
declare global {
|
|
392
|
+
interface HTMLElementTagNameMap {
|
|
393
|
+
"service-area-cluster-commands": ServiceAreaClusterCommands;
|
|
394
|
+
}
|
|
395
|
+
}
|