Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic nodes list & node metadata to OZW config panel #6719

Merged
merged 16 commits into from
Sep 4, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ class OZWNetworkRouter extends HassRouterPage {
};

protected updatePageEl(el): void {
el.route = this.routeTail;
el.route = computeTail(this.routeTail);
el.hass = this.hass;
el.isWide = this.isWide;
el.narrow = this.narrow;
el.configEntryId = this._configEntry;
el.ozwInstance = this.ozwInstance;
if (this._currentPage === "node") {
const path = this.routeTail.path.split("/");
el.nodeId = path[1];
el.route = computeTail(this.routeTail);
el.nodeId = this.routeTail.path.split("/")[1];
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ class OZWNodeDashboard extends LitElement {

@property() public configEntryId?: string;

@property() public ozwInstance = 0;
@property() public ozwInstance?;

@property() public nodeId = 0;
@property() public nodeId?;

@internalProperty() private _node?: OZWDevice;

@internalProperty() private _metadata?: OZWDeviceMetaDataResponse;

protected firstUpdated() {
if (this.ozwInstance <= 0) {
if (!this.ozwInstance) {
navigate(this, "/config/ozw/dashboard", true);
} else if (this.nodeId <= 0) {
} else if (!this.nodeId) {
navigate(this, `/config/ozw/network/${this.ozwInstance}/nodes`, true);
} else if (this.hass) {
this._fetchData();
Expand Down Expand Up @@ -135,6 +135,8 @@ class OZWNodeDashboard extends LitElement {
}

private async _fetchData() {
if (!this.ozwInstance || !this.nodeId) return;
cgarwood marked this conversation as resolved.
Show resolved Hide resolved

this._node = await fetchOZWNodeStatus(
this.hass!,
this.ozwInstance,
Expand Down