Skip to content

Commit

Permalink
Add support for commissioning nodes to debug UI (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Jul 16, 2024
1 parent 43375dc commit 3a6bf9d
Show file tree
Hide file tree
Showing 16 changed files with 545 additions and 173 deletions.
9 changes: 9 additions & 0 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@lit/context": "^1.1.2",
"@material/web": "^1.2.0",
"@mdi/js": "^7.4.47",
"lit": "^3.1.2",
Expand Down
4 changes: 4 additions & 0 deletions dashboard/src/client/client-context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createContext } from "@lit/context";
import type { MatterClient } from "./client";

export const clientContext = createContext<MatterClient>('client');
108 changes: 63 additions & 45 deletions dashboard/src/client/models/descriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const device_types: Record<number, DeviceType> = {
"clusters": [
66,
67,
68,
28
28,
68
]
},
"22": {
Expand Down Expand Up @@ -96,8 +96,8 @@ export const device_types: Record<number, DeviceType> = {
"id": 14,
"label": "Aggregator",
"clusters": [
29,
37
37,
29
]
},
"19": {
Expand Down Expand Up @@ -190,14 +190,14 @@ export const device_types: Record<number, DeviceType> = {
"label": "Pump",
"clusters": [
512,
1026,
98,
3,
4,
1027,
1028,
6,
3,
1028,
8,
4,
1026,
29,
30
]
Expand Down Expand Up @@ -262,9 +262,9 @@ export const device_types: Record<number, DeviceType> = {
"id": 21,
"label": "Contact Sensor",
"clusters": [
29,
3,
69
69,
29
]
},
"262": {
Expand All @@ -283,8 +283,8 @@ export const device_types: Record<number, DeviceType> = {
"clusters": [
3,
29,
1030,
30
30,
1030
]
},
"770": {
Expand Down Expand Up @@ -354,10 +354,10 @@ export const device_types: Record<number, DeviceType> = {
"id": 514,
"label": "Window Covering",
"clusters": [
98,
3,
258,
3,
4,
98,
29
]
},
Expand All @@ -375,9 +375,9 @@ export const device_types: Record<number, DeviceType> = {
"label": "Heating/Cooling Unit",
"clusters": [
98,
514,
3,
4,
514,
6,
8,
29,
Expand All @@ -391,8 +391,8 @@ export const device_types: Record<number, DeviceType> = {
513,
98,
3,
516,
4,
516,
56,
29,
30
Expand All @@ -415,14 +415,14 @@ export const device_types: Record<number, DeviceType> = {
1283,
1284,
1285,
1286,
6,
1287,
1288,
1289,
1290,
1291,
6,
1292,
1286,
1294,
29
]
Expand All @@ -434,11 +434,11 @@ export const device_types: Record<number, DeviceType> = {
1283,
1284,
1285,
1286,
6,
1287,
1288,
1289,
6,
1286,
1291,
29
]
Expand All @@ -450,17 +450,17 @@ export const device_types: Record<number, DeviceType> = {
1283,
1284,
1285,
1286,
6,
1287,
1288,
8,
1289,
1290,
1291,
6,
1292,
1293,
1294,
8,
1292,
1288,
1286,
29,
30
]
Expand All @@ -472,16 +472,16 @@ export const device_types: Record<number, DeviceType> = {
1283,
1284,
1285,
1286,
6,
1287,
1288,
8,
1289,
1290,
1291,
6,
8,
1294,
1292,
1288,
1294,
1286,
29,
30
]
Expand Down Expand Up @@ -527,13 +527,13 @@ export const device_types: Record<number, DeviceType> = {
"clusters": [
513,
98,
514,
1026,
1029,
6,
3,
4,
1029,
6,
514,
516,
1026,
29
]
},
Expand Down Expand Up @@ -572,11 +572,11 @@ export const device_types: Record<number, DeviceType> = {
1029,
1066,
1067,
1036,
1069,
1068,
1037,
1069,
1071,
1068,
1036,
1070,
1043,
1045,
Expand Down Expand Up @@ -692,9 +692,9 @@ export const device_types: Record<number, DeviceType> = {
"label": "Water Freeze Detector",
"clusters": [
128,
29,
3,
69
69,
29
]
},
"66": {
Expand All @@ -711,19 +711,19 @@ export const device_types: Record<number, DeviceType> = {
"label": "Water Leak Detector",
"clusters": [
128,
29,
3,
69
69,
29
]
},
"68": {
"id": 68,
"label": "Rain Sensor",
"clusters": [
128,
29,
3,
69
69,
29
]
},
"4293984272": {
Expand All @@ -740,11 +740,11 @@ export const device_types: Record<number, DeviceType> = {
768,
257,
98,
1026,
259,
4,
3,
6,
4,
1026,
8,
29,
30
Expand Down Expand Up @@ -12633,5 +12633,23 @@ export const clusters: Record<number, ClusterDescription> = {
"type": "float32"
}
}
},
"319683586": {
"id": 319683586,
"label": "ThirdRealityMeteringCluster",
"attributes": {
"0": {
"id": 0,
"cluster_id": 319683586,
"label": "CurrentSummationDelivered",
"type": "uint"
},
"1024": {
"id": 1024,
"cluster_id": 319683586,
"label": "InstantaneousDemand",
"type": "uint"
}
}
}
}
24 changes: 17 additions & 7 deletions dashboard/src/components/dialog-box/dialog-box.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,55 @@
import "@material/web/dialog/dialog";
import "@material/web/button/text-button";
import "@material/web/dialog/dialog";
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
import { preventDefault } from "../../util/prevent_default";
import type { PromptDialogBoxParams } from "./show-dialog-box";
@customElement("dialox-box")
export class DialogBox extends LitElement {
@property() public params!: PromptDialogBoxParams;
@property({ attribute: false }) public params!: PromptDialogBoxParams;

@property() public dialogResult!: (result: boolean) => void;
@property({ attribute: false }) public dialogResult!: (
result: boolean
) => void;

@property() public type!: "alert" | "prompt";

protected render() {
const params = this.params;
return html`
<md-dialog open @cancel=${preventDefault} @close=${this._handleClose}>
<md-dialog open @cancel=${preventDefault} @closed=${this._handleClosed}>
${params.title ? html`<div slot="headline">${params.title}</div>` : ""}
${params.text ? html`<div slot="content">${params.text}</div>` : ""}
<div slot="actions">
${this.type === "prompt"
? html`
<md-text-button @click=${() => this._setResult(false)}>
<md-text-button @click=${this._cancel}>
${params.cancelText || "Cancel"}
</md-text-button>
`
: ""}
<md-text-button @click=${() => this._setResult(true)}>
<md-text-button @click=${this._confirm}>
${params.confirmText || "OK"}
</md-text-button>
</div>
</md-dialog>
`;
}

private _cancel() {
this._setResult(false);
}

private _confirm() {
this._setResult(true);
}

_setResult(result: boolean) {
this.dialogResult(result);
this.shadowRoot!.querySelector("md-dialog")!.close();
}

private _handleClose() {
private _handleClosed() {
this.parentElement!.removeChild(this);
}
}
Expand Down
Loading

0 comments on commit 3a6bf9d

Please sign in to comment.