From f0c4b92dbbef6a3bc08fa391a1b6f7ee3d229762 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 24 Feb 2022 21:48:54 -0800 Subject: [PATCH 1/8] Small fixes for actions (#11850) --- .../automation/action/types/ha-automation-action-device_id.ts | 2 +- .../automation/action/types/ha-automation-action-event.ts | 2 +- .../automation/action/types/ha-automation-action-repeat.ts | 4 ++-- .../action/types/ha-automation-action-wait_for_trigger.ts | 1 - src/translations/en.json | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts index c837304ea9..96bfd08fc5 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts @@ -145,7 +145,7 @@ export class HaDeviceAction extends LitElement { static styles = css` ha-device-picker { display: block; - margin-bottom: 24px; + margin-bottom: 16px; } ha-device-action-picker { display: block; diff --git a/src/panels/config/automation/action/types/ha-automation-action-event.ts b/src/panels/config/automation/action/types/ha-automation-action-event.ts index ee133fa7da..e022bb5f50 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-event.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-event.ts @@ -50,7 +50,7 @@ export class HaEventAction extends LitElement implements ActionElement { -
Date: Thu, 24 Feb 2022 23:31:59 -0800 Subject: [PATCH 2/8] Guard controls in more info media player (#11851) --- .../controls/more-info-media_player.ts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-media_player.ts b/src/dialogs/more-info/controls/more-info-media_player.ts index 521ea4499a..916257695a 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -52,19 +52,21 @@ class MoreInfoMediaPlayer extends LitElement { return html`
- ${controls!.map( - (control) => html` - - - ` - )} + ${!controls + ? "" + : controls.map( + (control) => html` + + + ` + )}
${supportsFeature(stateObj, SUPPORT_BROWSE_MEDIA) ? html` From 4031009c26b1d16d57917daeed34435044d947a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 25 Feb 2022 17:03:55 +0100 Subject: [PATCH 3/8] Only set tip once (#11853) --- src/panels/config/dashboard/ha-config-dashboard.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 8c77470c7f..2f67454a9c 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -17,7 +17,7 @@ import { PropertyValues, TemplateResult, } from "lit"; -import { customElement, property } from "lit/decorators"; +import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-card"; import "../../../components/ha-icon-next"; @@ -118,6 +118,8 @@ class HaConfigDashboard extends LitElement { @property() public showAdvanced!: boolean; + @state() private _tip?: string; + private _notifyUpdates = false; protected render(): TemplateResult { @@ -204,7 +206,7 @@ class HaConfigDashboard extends LitElement {
Tip! - ${randomTip(this.hass)} + ${this._tip}
@@ -214,6 +216,10 @@ class HaConfigDashboard extends LitElement { protected override updated(changedProps: PropertyValues): void { super.updated(changedProps); + if (!this._tip && changedProps.has("hass")) { + this._tip = randomTip(this.hass); + } + if (!changedProps.has("supervisorUpdates") || !this._notifyUpdates) { return; } From 546461b70f2ce09a9a2613812e11ff247796f35d Mon Sep 17 00:00:00 2001 From: Zack Barett Date: Fri, 25 Feb 2022 13:51:55 -0600 Subject: [PATCH 4/8] Fix Render Pane on Mobile (#11856) --- .../developer-tools/template/developer-tools-template.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panels/developer-tools/template/developer-tools-template.ts b/src/panels/developer-tools/template/developer-tools-template.ts index 74a5b8027d..97fa25cc84 100644 --- a/src/panels/developer-tools/template/developer-tools-template.ts +++ b/src/panels/developer-tools/template/developer-tools-template.ts @@ -289,6 +289,12 @@ class HaPanelDevTemplate extends LitElement { .rendered.error { color: var(--error-color); } + + @media all and (max-width: 870px) { + .render-pane { + max-width: 100%; + } + } `, ]; } From 6907fa5c8e4041e6dcf169c2b093cf739e196b73 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 26 Feb 2022 22:03:12 +0100 Subject: [PATCH 5/8] Add py.typed (#11865) --- public/__init__.py | 2 +- public/py.typed | 0 setup.cfg | 5 +++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 public/py.typed diff --git a/public/__init__.py b/public/__init__.py index 1debde5485..493110db57 100644 --- a/public/__init__.py +++ b/public/__init__.py @@ -2,6 +2,6 @@ from pathlib import Path -def where(): +def where() -> Path: """Return path to the frontend.""" return Path(__file__).parent diff --git a/public/py.typed b/public/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup.cfg b/setup.cfg index f3efcd2597..3690791245 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,3 +19,8 @@ python_requires = >= 3.4.0 [options.packages.find] include = hass_frontend* + +[mypy] +python_version = 3.4 +show_error_codes = True +strict = True From 298296a81f0bebf3efdd39a9efca5d34e76e6140 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 26 Feb 2022 13:08:42 -0800 Subject: [PATCH 6/8] Fix iOS audio (#11863) --- src/panels/media-browser/browser-media-player.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/panels/media-browser/browser-media-player.ts b/src/panels/media-browser/browser-media-player.ts index 182f944e3f..bc88414a98 100644 --- a/src/panels/media-browser/browser-media-player.ts +++ b/src/panels/media-browser/browser-media-player.ts @@ -25,6 +25,7 @@ export class BrowserMediaPlayer { private onChange: () => void ) { const player = new Audio(this.resolved.url); + player.autoplay = true; player.volume = volume; player.addEventListener("play", this._handleChange); player.addEventListener("playing", () => { @@ -33,15 +34,7 @@ export class BrowserMediaPlayer { }); player.addEventListener("pause", this._handleChange); player.addEventListener("ended", this._handleChange); - player.addEventListener("canplaythrough", () => { - if (this._removed) { - return; - } - if (this.buffering) { - player.play(); - } - this.onChange(); - }); + player.addEventListener("canplaythrough", this._handleChange); this.player = player; } From 7abf9c24736878912560b3210281de2484212b98 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sat, 26 Feb 2022 22:18:33 +0100 Subject: [PATCH 7/8] Fix condition time (#11866) Co-authored-by: Paulus Schoutsen Co-authored-by: Zack Barett --- .../types/ha-automation-condition-time.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-time.ts b/src/panels/config/automation/condition/types/ha-automation-condition-time.ts index fca4616a7e..88277292d8 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-time.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-time.ts @@ -117,8 +117,8 @@ export class HaTimeCondition extends LitElement implements ConditionElement { ); const data = { - mode_before: "value", - mode_after: "value", + mode_before: inputModeBefore ? "input" : "value", + mode_after: inputModeAfter ? "input" : "value", ...this.condition, }; @@ -137,18 +137,11 @@ export class HaTimeCondition extends LitElement implements ConditionElement { ev.stopPropagation(); const newValue = ev.detail.value; - const newModeAfter = newValue.mode_after === "input"; - const newModeBefore = newValue.mode_before === "input"; + this._inputModeAfter = newValue.mode_after === "input"; + this._inputModeBefore = newValue.mode_before === "input"; - if (newModeAfter !== this._inputModeAfter) { - this._inputModeAfter = newModeAfter; - newValue.after = undefined; - } - - if (newModeBefore !== this._inputModeBefore) { - this._inputModeBefore = newModeBefore; - newValue.before = undefined; - } + delete newValue.mode_after; + delete newValue.mode_before; Object.keys(newValue).forEach((key) => newValue[key] === undefined || newValue[key] === "" From a769f84755fef73e7b7d87f691fcd6a7de2e7ba4 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 26 Feb 2022 13:28:52 -0800 Subject: [PATCH 8/8] Bumped version to 20220226.0 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3690791245..f1b3450973 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = home-assistant-frontend -version = 20220224.0 +version = 20220226.0 author = The Home Assistant Authors author_email = hello@home-assistant.io license = Apache-2.0