Show error if no OZW instances are detected (#7176)

This commit is contained in:
Charles Garwood 2020-09-30 17:09:48 -04:00 committed by GitHub
parent 0f59496778
commit cd32ef60da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -28,6 +28,8 @@ import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../../../resources/styles";
import type { HomeAssistant, Route } from "../../../../../types";
import "../../../ha-config-section";
import "../../../../../layouts/hass-error-screen";
import "../../../../../layouts/hass-loading-screen";
export const ozwTabs: PageNavigation[] = [];
@ -43,13 +45,25 @@ class OZWConfigDashboard extends LitElement {
@property() public configEntryId?: string;
@internalProperty() private _instances: OZWInstance[] = [];
@internalProperty() private _instances?: OZWInstance[];
protected firstUpdated() {
this._fetchData();
}
protected render(): TemplateResult {
if (!this._instances) {
return html`<hass-loading-screen></hass-loading-screen>`;
}
if (this._instances.length === 0) {
return html`<hass-error-screen
.error="${this.hass.localize(
"ui.panel.config.ozw.select_instance.none_found"
)}"
></hass-error-screen>`;
}
return html`
<hass-tabs-subpage
.hass=${this.hass}

View File

@ -1894,7 +1894,8 @@
},
"select_instance": {
"header": "Select an OpenZWave Instance",
"introduction": "You have more than one OpenZWave instance running. Which instance would you like to manage?"
"introduction": "You have more than one OpenZWave instance running. Which instance would you like to manage?",
"none_found": "We couldn't find an OpenZWave instance. If you believe this is incorrect, check your OpenZWave and MQTT setups and ensure that Home Assistant can communicate with your MQTT broker."
},
"network": {
"header": "Network Management",