From 48c9c89e3dc28b632cd9f337f9edc6f2e0226017 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Fri, 8 Oct 2021 17:16:44 +0200 Subject: [PATCH 1/6] Add "gas" device_class to customize (and sort existing ones) (#10196) --- src/common/const.ts | 11 ++++++----- src/util/hass-attributes-util.ts | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/common/const.ts b/src/common/const.ts index 75413b8044..dbc9ba4aac 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -57,28 +57,29 @@ export const FIXED_DOMAIN_ICONS = { export const FIXED_DEVICE_CLASS_ICONS = { aqi: "hass:air-filter", - current: "hass:current-ac", + battery: "hass:battery", carbon_dioxide: "mdi:molecule-co2", carbon_monoxide: "mdi:molecule-co", + current: "hass:current-ac", date: "hass:calendar", energy: "hass:lightning-bolt", gas: "hass:gas-cylinder", humidity: "hass:water-percent", illuminance: "hass:brightness-5", + monetary: "mdi:cash", nitrogen_dioxide: "mdi:molecule", nitrogen_monoxide: "mdi:molecule", nitrous_oxide: "mdi:molecule", ozone: "mdi:molecule", - temperature: "hass:thermometer", - monetary: "mdi:cash", - pm25: "mdi:molecule", pm1: "mdi:molecule", pm10: "mdi:molecule", - pressure: "hass:gauge", + pm25: "mdi:molecule", power: "hass:flash", power_factor: "hass:angle-acute", + pressure: "hass:gauge", signal_strength: "hass:wifi", sulphur_dioxide: "mdi:molecule", + temperature: "hass:thermometer", timestamp: "hass:clock", volatile_organic_compounds: "mdi:molecule", voltage: "hass:sine-wave", diff --git a/src/util/hass-attributes-util.ts b/src/util/hass-attributes-util.ts index 5025aa1766..f237e082ce 100644 --- a/src/util/hass-attributes-util.ts +++ b/src/util/hass-attributes-util.ts @@ -58,19 +58,20 @@ const hassAttributeUtil = { "current", "date", "energy", + "gas", "humidity", "illuminance", + "monetary", "nitrogen_dioxide", "nitrogen_monoxide", "nitrous_oxide", "ozone", - "pm25", "pm1", "pm10", + "pm25", "power", "power_factor", "pressure", - "monetary", "signal_strength", "sulphur_dioxide", "temperature", From b157cf5294949a6a8c4f05fd2373365335e609ae Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Fri, 8 Oct 2021 17:17:41 +0200 Subject: [PATCH 2/6] Make zone names readable on map in dark mode (#10195) --- src/components/map/ha-map.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/map/ha-map.ts b/src/components/map/ha-map.ts index c34a819d51..2835ebb2fc 100644 --- a/src/components/map/ha-map.ts +++ b/src/components/map/ha-map.ts @@ -484,6 +484,7 @@ export class HaMap extends ReactiveElement { justify-content: center; flex-direction: column; text-align: center; + color: var(--primary-text-color); } `; } From 5be475ea17ab9603f2bf8b8224bfa365d3219ce3 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 8 Oct 2021 20:32:13 +0200 Subject: [PATCH 3/6] Fix dirty check/leaving automation editor (#10211) --- src/panels/config/automation/ha-automation-editor.ts | 4 +++- src/panels/config/automation/manual-automation-editor.ts | 5 ++++- .../config/automation/trigger/ha-automation-trigger-row.ts | 2 +- src/panels/config/scene/ha-scene-editor.ts | 5 +++-- src/panels/config/script/ha-script-editor.ts | 4 +++- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index 8ab69fa05f..e25751c3ef 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -443,7 +443,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { ), confirmText: this.hass!.localize("ui.common.leave"), dismissText: this.hass!.localize("ui.common.stay"), - confirm: () => history.back(), + confirm: () => { + setTimeout(() => history.back()); + }, }); } else { history.back(); diff --git a/src/panels/config/automation/manual-automation-editor.ts b/src/panels/config/automation/manual-automation-editor.ts index 97ea0d1d40..ff70b33195 100644 --- a/src/panels/config/automation/manual-automation-editor.ts +++ b/src/panels/config/automation/manual-automation-editor.ts @@ -267,7 +267,10 @@ export class HaManualAutomationEditor extends LitElement { const mode = ((ev.target as PaperListboxElement)?.selectedItem as any) ?.mode; - if (mode === this.config!.mode) { + if ( + mode === this.config!.mode || + (!this.config!.mode && mode === MODES[0]) + ) { return; } const value = { diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts index 5d4b88933d..6444b6aaef 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -263,7 +263,7 @@ export default class HaAutomationTriggerRow extends LitElement { private _idChanged(ev: CustomEvent) { const newId = ev.detail.value; - if (newId === this.trigger.id) { + if (newId === (this.trigger.id ?? "")) { return; } const value = { ...this.trigger }; diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 6c51a61af4..45bbf6740a 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -555,7 +555,7 @@ export class HaSceneEditor extends SubscribeMixin( try { config = await getSceneConfig(this.hass, this.sceneId!); } catch (err: any) { - showAlertDialog(this, { + await showAlertDialog(this, { text: err.status_code === 404 ? this.hass.localize( @@ -566,7 +566,8 @@ export class HaSceneEditor extends SubscribeMixin( "err_no", err.status_code ), - }).then(() => history.back()); + }); + history.back(); return; } diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts index ccba2b3ecd..315f2dc2f3 100644 --- a/src/panels/config/script/ha-script-editor.ts +++ b/src/panels/config/script/ha-script-editor.ts @@ -586,7 +586,9 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { ), confirmText: this.hass!.localize("ui.common.leave"), dismissText: this.hass!.localize("ui.common.stay"), - confirm: () => history.back(), + confirm: () => { + setTimeout(() => history.back()); + }, }); } else { history.back(); From 0056d75127510c66ac6640550013a03680a31c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 9 Oct 2021 12:30:51 +0200 Subject: [PATCH 4/6] Fix icon overlay for person badges (#10201) --- src/components/entity/ha-state-label-badge.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index b7001ab861..fa84be3fc2 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -73,6 +73,12 @@ export class HaStateLabelBadge extends LitElement { const value = this._computeValue(domain, entityState); const icon = this.icon ? this.icon : this._computeIcon(domain, entityState); + const image = this.icon + ? "" + : this.image + ? this.image + : entityState.attributes.entity_picture_local || + entityState.attributes.entity_picture; return html` - ${icon ? html`` : ""} + ${!image && icon ? html`` : ""} ${value && (this.icon || !this.image) ? html` 4 ? "big" : ""} >${value} Date: Sat, 9 Oct 2021 16:17:50 +0200 Subject: [PATCH 5/6] Fix alarm panel badge (#10221) --- src/panels/lovelace/cards/hui-alarm-panel-card.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index 00a3f61792..8565b47cdd 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -152,10 +152,11 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { > + > + +
${(stateObj.state === "disarmed" ? this._config.states! From cddf6ce1f4fb8cea53c2f901aa0c7e1ad2738e49 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sat, 9 Oct 2021 17:39:08 +0200 Subject: [PATCH 6/6] Bumped version to 20211007.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 589990ec84..21bd283ba7 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20211007.0", + version="20211007.1", description="The Home Assistant frontend", url="https://github.com/home-assistant/frontend", author="The Home Assistant Authors",