diff --git a/package.json b/package.json index c067e53d7c..47bf3b8ec9 100644 --- a/package.json +++ b/package.json @@ -25,22 +25,22 @@ "@formatjs/intl-pluralrules": "^1.5.8", "@fullcalendar/core": "^5.0.0-beta.2", "@fullcalendar/daygrid": "^5.0.0-beta.2", - "@material/chips": "=8.0.0-canary.a78ceb112.0", + "@material/chips": "=8.0.0-canary.096a7a066.0", "@material/circular-progress": "=8.0.0-canary.a78ceb112.0", - "@material/mwc-button": "^0.17.2", - "@material/mwc-checkbox": "^0.17.2", - "@material/mwc-dialog": "^0.17.2", - "@material/mwc-fab": "^0.17.2", - "@material/mwc-formfield": "^0.17.2", - "@material/mwc-icon-button": "^0.17.2", - "@material/mwc-list": "^0.17.2", - "@material/mwc-menu": "^0.17.2", - "@material/mwc-radio": "^0.17.2", - "@material/mwc-ripple": "^0.17.2", - "@material/mwc-switch": "^0.17.2", - "@material/mwc-tab": "^0.17.2", - "@material/mwc-tab-bar": "^0.17.2", - "@material/top-app-bar": "=8.0.0-canary.a78ceb112.0", + "@material/mwc-button": "^0.18.0", + "@material/mwc-checkbox": "^0.18.0", + "@material/mwc-dialog": "^0.18.0", + "@material/mwc-fab": "^0.18.0", + "@material/mwc-formfield": "^0.18.0", + "@material/mwc-icon-button": "^0.18.0", + "@material/mwc-list": "^0.18.0", + "@material/mwc-menu": "^0.18.0", + "@material/mwc-radio": "^0.18.0", + "@material/mwc-ripple": "^0.18.0", + "@material/mwc-switch": "^0.18.0", + "@material/mwc-tab": "^0.18.0", + "@material/mwc-tab-bar": "^0.18.0", + "@material/top-app-bar": "=8.0.0-canary.096a7a066.0", "@mdi/js": "5.4.55", "@mdi/svg": "5.4.55", "@polymer/app-layout": "^3.0.2", @@ -106,6 +106,7 @@ "memoize-one": "^5.0.2", "node-vibrant": "^3.1.5", "proxy-polyfill": "^0.3.1", + "punycode": "^2.1.1", "regenerator-runtime": "^0.13.2", "resize-observer-polyfill": "^1.5.1", "roboto-fontface": "^0.10.0", @@ -212,7 +213,11 @@ "@webcomponents/webcomponentsjs": "^2.2.10", "@polymer/polymer": "3.1.0", "lit-html": "1.2.1", - "lit-element": "2.3.1" + "lit-element": "2.3.1", + "@material/animation": "8.0.0-canary.096a7a066.0", + "@material/base": "8.0.0-canary.096a7a066.0", + "@material/feature-targeting": "8.0.0-canary.096a7a066.0", + "@material/theme": "8.0.0-canary.096a7a066.0" }, "main": "src/home-assistant.js", "husky": { diff --git a/setup.py b/setup.py index 4e6c716f17..e9d1a60254 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20200803.0", + version="20200805.0", description="The Home Assistant frontend", url="https://github.com/home-assistant/home-assistant-polymer", author="The Home Assistant Authors", diff --git a/src/auth/ha-authorize.ts b/src/auth/ha-authorize.ts index 989525cb23..72404d153e 100644 --- a/src/auth/ha-authorize.ts +++ b/src/auth/ha-authorize.ts @@ -16,6 +16,7 @@ import { litLocalizeLiteMixin } from "../mixins/lit-localize-lite-mixin"; import { registerServiceWorker } from "../util/register-service-worker"; import "./ha-auth-flow"; import { extractSearchParamsObject } from "../common/url/search-params"; +import punycode from "punycode"; import(/* webpackChunkName: "pick-auth-provider" */ "./ha-pick-auth-provider"); @@ -75,7 +76,7 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) { ${this.localize( "ui.panel.page-authorize.authorizing_client", "clientId", - this.clientId + this.clientId ? punycode.toASCII(this.clientId) : this.clientId )}

${loggingInWith} diff --git a/src/components/ha-related-items.ts b/src/components/ha-related-items.ts index 35a24a8479..4596b453b5 100644 --- a/src/components/ha-related-items.ts +++ b/src/components/ha-related-items.ts @@ -97,6 +97,7 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) { ${this.hass.localize(`component.${entry.domain}.title`)}: ${entry.title} @@ -116,7 +117,10 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {

${this.hass.localize("ui.components.related-items.device")}:

-
+ ${device.name_by_user || device.name} `; @@ -134,7 +138,10 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {

${this.hass.localize("ui.components.related-items.area")}:

- + ${area.name} `; @@ -278,6 +285,12 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) { `; } + private async _navigateAwayClose() { + // allow new page to open before closing dialog + await new Promise((resolve) => setTimeout(resolve, 0)); + fireEvent(this, "close-dialog"); + } + private async _findRelated() { this._related = await findRelated(this.hass, this.itemType, this.itemId); await this.updateComplete; diff --git a/src/components/map/ha-location-editor.ts b/src/components/map/ha-location-editor.ts index be72287b3e..a1775f1a58 100644 --- a/src/components/map/ha-location-editor.ts +++ b/src/components/map/ha-location-editor.ts @@ -107,7 +107,7 @@ class LocationEditor extends LitElement { if (changedProps.has("hass")) { const oldHass = changedProps.get("hass") as HomeAssistant | undefined; - if (!oldHass || oldHass.themes.darkMode === this.hass.themes.darkMode) { + if (!oldHass || oldHass.themes?.darkMode === this.hass.themes?.darkMode) { return; } if (!this._leafletMap || !this._tileLayer) { @@ -117,7 +117,7 @@ class LocationEditor extends LitElement { this.Leaflet, this._leafletMap, this._tileLayer, - this.hass.themes.darkMode + this.hass.themes?.darkMode ); } } @@ -129,7 +129,7 @@ class LocationEditor extends LitElement { private async _initMap(): Promise { [this._leafletMap, this.Leaflet, this._tileLayer] = await setupLeafletMap( this._mapEl, - this.hass.themes.darkMode, + this.hass.themes?.darkMode, Boolean(this.radius) ); this._leafletMap.addEventListener( diff --git a/src/data/ozw.ts b/src/data/ozw.ts new file mode 100644 index 0000000000..491b0168a2 --- /dev/null +++ b/src/data/ozw.ts @@ -0,0 +1,21 @@ +import { HomeAssistant } from "../types"; + +export interface OZWDevice { + node_id: number; + node_query_stage: string; + is_awake: boolean; + is_failed: boolean; + is_zwave_plus: boolean; + ozw_instance: number; +} + +export const fetchOZWNodeStatus = ( + hass: HomeAssistant, + ozw_instance: string, + node_id: string +): Promise => + hass.callWS({ + type: "ozw/node_status", + ozw_instance: ozw_instance, + node_id: node_id, + }); diff --git a/src/onboarding/integration-badge.ts b/src/onboarding/integration-badge.ts index 925440390d..5bf4267b56 100644 --- a/src/onboarding/integration-badge.ts +++ b/src/onboarding/integration-badge.ts @@ -62,9 +62,6 @@ class IntegrationBadge extends LitElement { justify-content: center; } - :host([clickable]) .icon { - } - .badge { position: absolute; color: white; @@ -72,9 +69,8 @@ class IntegrationBadge extends LitElement { right: -10px; background-color: var(--label-badge-green); border-radius: 50%; - width: 18px; display: block; - height: 18px; + --mdc-icon-size: 18px; border: 2px solid white; } diff --git a/src/panels/config/devices/device-detail/integration-elements/ozw/ha-device-info-ozw.ts b/src/panels/config/devices/device-detail/integration-elements/ozw/ha-device-info-ozw.ts new file mode 100644 index 0000000000..b82ba363f0 --- /dev/null +++ b/src/panels/config/devices/device-detail/integration-elements/ozw/ha-device-info-ozw.ts @@ -0,0 +1,89 @@ +import { + CSSResult, + customElement, + html, + LitElement, + property, + internalProperty, + TemplateResult, + css, + PropertyValues, +} from "lit-element"; +import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import { haStyle } from "../../../../../../resources/styles"; +import { HomeAssistant } from "../../../../../../types"; +import { OZWDevice, fetchOZWNodeStatus } from "../../../../../../data/ozw"; + +@customElement("ha-device-info-ozw") +export class HaDeviceInfoOzw extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + @property() public device!: DeviceRegistryEntry; + + @internalProperty() private _ozwDevice?: OZWDevice; + + protected updated(changedProperties: PropertyValues) { + if (changedProperties.has("device")) { + this._fetchNodeDetails(this.device); + } + } + + protected async _fetchNodeDetails(device) { + const ozwIdentifier = device.identifiers.find( + (identifier) => identifier[0] === "ozw" + ); + if (!ozwIdentifier) { + return; + } + const identifiers = ozwIdentifier[1].split("."); + this._ozwDevice = await fetchOZWNodeStatus( + this.hass, + identifiers[0], + identifiers[1] + ); + } + + protected render(): TemplateResult { + if (!this._ozwDevice) { + return html``; + } + return html` +

+ ${this.hass.localize("ui.panel.config.ozw.device_info.zwave_info")} +

+
+ ${this.hass.localize("ui.panel.config.ozw.common.node_id")}: + ${this._ozwDevice.node_id} +
+
+ ${this.hass.localize("ui.panel.config.ozw.device_info.stage")}: + ${this._ozwDevice.node_query_stage} +
+
+ ${this.hass.localize("ui.panel.config.ozw.common.ozw_instance")}: + ${this._ozwDevice.ozw_instance} +
+
+ ${this.hass.localize("ui.panel.config.ozw.device_info.node_failed")}: + ${this._ozwDevice.is_failed + ? this.hass.localize("ui.common.yes") + : this.hass.localize("ui.common.no")} +
+ `; + } + + static get styles(): CSSResult[] { + return [ + haStyle, + css` + h4 { + margin-bottom: 4px; + } + div { + word-break: break-all; + margin-top: 2px; + } + `, + ]; + } +} diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index bc96ae7215..ec2e67ea68 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -501,6 +501,15 @@ export class HaConfigDevicePage extends LitElement { `); } + if (integrations.includes("ozw")) { + import("./device-detail/integration-elements/ozw/ha-device-info-ozw"); + templates.push(html` + + `); + } if (integrations.includes("zha")) { import("./device-detail/integration-elements/zha/ha-device-actions-zha"); import("./device-detail/integration-elements/zha/ha-device-info-zha"); diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 58c9ac7a5c..5ac897dc78 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -73,7 +73,7 @@ export class EntityRegistrySettings extends LitElement { return html` ${!stateObj ? html` -
+
${this.hass!.localize( "ui.dialogs.entity_registry.editor.unavailable" )} @@ -81,7 +81,7 @@ export class EntityRegistrySettings extends LitElement { ` : ""} ${this._error ? html`
${this._error}
` : ""} -
+