From d94223a61e29defb95cc64f5b81a8681c627b223 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 08:41:32 -0700 Subject: [PATCH 1/6] Dynamic update panels (#3227) --- src/data/ws-panels.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/data/ws-panels.ts b/src/data/ws-panels.ts index 88ec490d06..a38c4ed252 100644 --- a/src/data/ws-panels.ts +++ b/src/data/ws-panels.ts @@ -1,14 +1,25 @@ import { createCollection, Connection } from "home-assistant-js-websocket"; import { Panels } from "../types"; +const fetchPanels = (conn) => + conn.sendMessagePromise({ + type: "get_panels", + }); + +const subscribeUpdates = (conn, store) => + conn.subscribeEvents( + () => fetchPanels(conn).then((panels) => store.setState(panels, true)), + "panels_updated" + ); + export const subscribePanels = ( conn: Connection, onChange: (panels: Panels) => void ) => createCollection( "_pnl", - () => conn.sendMessagePromise({ type: "get_panels" }), - undefined, + fetchPanels, + subscribeUpdates, conn, onChange ); From ab157fdbff27e17fe00f2504fe69352aa3039229 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 08:41:44 -0700 Subject: [PATCH 2/6] Correctly warn if Google entities defined in YAML (#3230) --- src/panels/config/cloud/ha-config-cloud-google-assistant.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/config/cloud/ha-config-cloud-google-assistant.ts b/src/panels/config/cloud/ha-config-cloud-google-assistant.ts index eee1464fde..9856be59f1 100644 --- a/src/panels/config/cloud/ha-config-cloud-google-assistant.ts +++ b/src/panels/config/cloud/ha-config-cloud-google-assistant.ts @@ -60,7 +60,7 @@ class CloudGoogleAssistant extends LitElement { `; } - const emptyFilter = true || isEmptyFilter(this.cloudStatus.google_entities); + const emptyFilter = isEmptyFilter(this.cloudStatus.google_entities); const filterFunc = this._getEntityFilterFunc( this.cloudStatus.google_entities ); From bdacd05fab246b66691589b737d618694d2db013 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 08:41:52 -0700 Subject: [PATCH 3/6] Pass connection instead of hass (#3228) --- src/panels/config/integrations/ha-device-card.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/panels/config/integrations/ha-device-card.js b/src/panels/config/integrations/ha-device-card.js index 345274d0cd..52a96e0199 100644 --- a/src/panels/config/integrations/ha-device-card.js +++ b/src/panels/config/integrations/ha-device-card.js @@ -169,13 +169,16 @@ class HaDeviceCard extends EventsMixin(LocalizeMixin(PolymerElement)) { connectedCallback() { super.connectedCallback(); - this._unsubAreas = subscribeAreaRegistry(this.hass, (areas) => { + this._unsubAreas = subscribeAreaRegistry(this.hass.connection, (areas) => { this._areas = areas; }); - this._unsubDevices = subscribeDeviceRegistry(this.hass, (devices) => { - this.devices = devices; - this.device = devices.find((device) => device.id === this.device.id); - }); + this._unsubDevices = subscribeDeviceRegistry( + this.hass.connection, + (devices) => { + this.devices = devices; + this.device = devices.find((device) => device.id === this.device.id); + } + ); } disconnectedCallback() { From 4cc812c1bf32bd0281c6521a4f6f6b2f753f758e Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 08:42:02 -0700 Subject: [PATCH 4/6] Always have a gauge base unit (#3229) --- src/panels/lovelace/cards/hui-gauge-card.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 677d8378d0..0c8bf158ab 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -42,6 +42,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { @property() public hass?: HomeAssistant; + @property() private _baseUnit = "50px"; @property() private _config?: GaugeCardConfig; private _updated?: boolean; @@ -99,16 +100,21 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { } return html` - +
@@ -154,12 +160,9 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { return; } const baseUnit = this._computeBaseUnit(); - if (baseUnit === "0px") { - return; + if (baseUnit !== "0px") { + this._baseUnit = baseUnit; } - (this.shadowRoot!.querySelector( - "ha-card" - )! as HTMLElement).style.setProperty("--base-unit", baseUnit); } private _computeSeverity(numberValue: number): string { @@ -211,7 +214,6 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { static get styles(): CSSResult { return css` ha-card { - --base-unit: 50px; height: calc(var(--base-unit) * 3); position: relative; cursor: pointer; From 03735f05397d1cbcb2ddc2acaf1b2ebd9d05768d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 09:31:23 -0700 Subject: [PATCH 5/6] Update translations --- translations/ca.json | 15 ++++++++++----- translations/en.json | 7 ++++++- translations/hu.json | 7 ++++++- translations/ko.json | 9 +++++++-- translations/nb.json | 7 ++++++- translations/nn.json | 2 +- translations/ru.json | 7 ++++++- 7 files changed, 42 insertions(+), 12 deletions(-) diff --git a/translations/ca.json b/translations/ca.json index f9a678e38a..09d16c1002 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -345,10 +345,10 @@ "reloading": { "heading": "Recàrrega de la configuració", "introduction": "Algunes parts de la configuració de Home Assistant es poden recarregar sense necessitat de reiniciar-les. Les opcions de sota esborraran la configuració antiga i carregaran la nova.", - "core": "Recarregar el nucli", - "group": "Recarregar grups", - "automation": "Recarregar automatismes", - "script": "Recarregar programes" + "core": "Recarrega el nucli", + "group": "Recarrega grups", + "automation": "Recarrega automatismes", + "script": "Recarrega programes" }, "server_management": { "heading": "Gestió del servidor", @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "Entitat no disponible: {entity}", "entity_non_numeric": "Entitat no numèrica: {entity}" - } + }, + "changed_toast": { + "message": "S'ha actualitzat la configuració de Lovelace, vols refrescar-ho?", + "refresh": "Actualitza" + }, + "reload_lovelace": "Recarrega Lovelace" } }, "sidebar": { diff --git a/translations/en.json b/translations/en.json index d7470342c0..e8135dead9 100644 --- a/translations/en.json +++ b/translations/en.json @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "Entity not available: {entity}", "entity_non_numeric": "Entity is non-numeric: {entity}" - } + }, + "changed_toast": { + "message": "The Lovelace config was updated, would you like to refresh?", + "refresh": "Refresh" + }, + "reload_lovelace": "Reload Lovelace" } }, "sidebar": { diff --git a/translations/hu.json b/translations/hu.json index 1bca7ef353..2b47a56306 100644 --- a/translations/hu.json +++ b/translations/hu.json @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "Entitás nem elérhető: {entity}", "entity_non_numeric": "Entitás nem numerikus: {entity}" - } + }, + "changed_toast": { + "message": "A Lovelace config módosult, szeretnéd frissíteni?", + "refresh": "Frissítés" + }, + "reload_lovelace": "Lovelace Újratöltése" } }, "sidebar": { diff --git a/translations/ko.json b/translations/ko.json index ab3995acba..a1380780f0 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -358,7 +358,7 @@ }, "core_config": { "edit_requires_storage": "구성내용이 configuration.yaml 에 저장되어있기 때문에 편집기가 비활성화 되었습니다.", - "location_name": "Home Assistant 설치 이름", + "location_name": "Home Assistant 설치 위치명", "latitude": "위도", "longitude": "경도", "elevation": "고도", @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "구성요소를 사용할 수 없습니다: {entity}", "entity_non_numeric": "구성요소가 숫자형식이 아닙니다: {entity}" - } + }, + "changed_toast": { + "message": "Lovelace 구성이 업데이트되었습니다. 새로고침 하시겠습니까?", + "refresh": "새로고침" + }, + "reload_lovelace": "Lovelace 새로고침" } }, "sidebar": { diff --git a/translations/nb.json b/translations/nb.json index 7d0a256434..0ff86065c1 100644 --- a/translations/nb.json +++ b/translations/nb.json @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "Enhet ikke tilgjengelig: {entity}", "entity_non_numeric": "Enheten er ikke-numerisk: {entity}" - } + }, + "changed_toast": { + "message": "Lovelace-konfigurasjonen ble oppdatert, ønsker du å oppdatere?", + "refresh": "Oppdatere" + }, + "reload_lovelace": "Laste Lovelace på nytt" } }, "sidebar": { diff --git a/translations/nn.json b/translations/nn.json index 04fcb4151d..c045e6057d 100644 --- a/translations/nn.json +++ b/translations/nn.json @@ -617,7 +617,7 @@ } }, "area_registry": { - "caption": "Oppføringsregister", + "caption": "Områderegister", "description": "Oversikt over områda i heimen din.", "picker": { "header": "Områderegister", diff --git a/translations/ru.json b/translations/ru.json index d5e12c9193..b65261557d 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -964,7 +964,12 @@ "warning": { "entity_not_found": "Объект недоступен: {entity}", "entity_non_numeric": "Объект не является числом: {entity}" - } + }, + "changed_toast": { + "message": "Конфигурация Lovelace была изменена, обновить эту страницу?", + "refresh": "Обновить" + }, + "reload_lovelace": "Перезагрузить Lovelace" } }, "sidebar": { From 35e82a8e2682b4c4390d8383afa11940d1382a0d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2019 09:31:29 -0700 Subject: [PATCH 6/6] Bumped version to 20190530.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 73f2acd8f4..ad76c7f36a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20190529.0", + version="20190530.0", description="The Home Assistant frontend", url="https://github.com/home-assistant/home-assistant-polymer", author="The Home Assistant Authors",