From 5b7eeb6ac16a25c964ba228730c64c305910e32e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:58:59 +0100 Subject: [PATCH 01/10] Update dependency marked to v15.0.3 (#23088) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 920479bacc..7a3360c785 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "lit": "2.8.0", "lit-html": "2.8.0", "luxon": "3.5.0", - "marked": "15.0.2", + "marked": "15.0.3", "memoize-one": "6.0.0", "node-vibrant": "3.2.1-alpha.1", "proxy-polyfill": "0.3.2", diff --git a/yarn.lock b/yarn.lock index a973b9522c..b361b2778c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9646,7 +9646,7 @@ __metadata: luxon: "npm:3.5.0" magic-string: "npm:0.30.13" map-stream: "npm:0.0.7" - marked: "npm:15.0.2" + marked: "npm:15.0.3" memoize-one: "npm:6.0.0" node-vibrant: "npm:3.2.1-alpha.1" object-hash: "npm:3.0.0" @@ -11371,12 +11371,12 @@ __metadata: languageName: node linkType: hard -"marked@npm:15.0.2": - version: 15.0.2 - resolution: "marked@npm:15.0.2" +"marked@npm:15.0.3": + version: 15.0.3 + resolution: "marked@npm:15.0.3" bin: marked: bin/marked.js - checksum: 10/dde3d918bb3938906d7a874b990cbfb193514a5fef4b41bca102db3b63d50235afb517dd70429525b6e0a5cff43abd827e7bd2b18617f8bd4776db745e75e973 + checksum: 10/821c1af0e527b3f6f4684a68802a0fa5e91cd2b0887d0600ce9035896f8b0fbad180a3f8c5be91de25bdc20323abbd674351832c40d48820b6f0d888fd77cd59 languageName: node linkType: hard From f8d6f0fae4c3b5ff2b005f6b10097949735a4513 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Wed, 4 Dec 2024 09:52:48 +0100 Subject: [PATCH 02/10] Show in assist pipeline debug when intent is preferred and processed locally (#23115) --- src/data/assist_pipeline.ts | 2 ++ .../debug/assist-render-pipeline-run.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/data/assist_pipeline.ts b/src/data/assist_pipeline.ts index c0c8b4b788..0623049a0f 100644 --- a/src/data/assist_pipeline.ts +++ b/src/data/assist_pipeline.ts @@ -104,12 +104,14 @@ interface PipelineIntentStartEvent extends PipelineEventBase { data: { engine: string; language: string; + prefer_local_intents: boolean; intent_input: string; }; } interface PipelineIntentEndEvent extends PipelineEventBase { type: "intent-end"; data: { + processed_locally: boolean; intent_output: ConversationResult; }; } diff --git a/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts b/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts index b3c2a86296..9d3bbf81ea 100644 --- a/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts +++ b/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts @@ -307,6 +307,18 @@ export class AssistPipelineDebug extends LitElement { ` : ""}` : ""} +
+
Prefer handling locally
+
+ ${this.pipelineRun.intent.prefer_local_intents} +
+
+
+
Processed locally
+
+ ${this.pipelineRun.intent.processed_locally} +
+
${dataMinusKeysRender( this.pipelineRun.intent, INTENT_DATA From 5f6577a24ce8cd04770ca1ad4d56ad3c6d20f6ea Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:15:59 +0100 Subject: [PATCH 03/10] Remove static font from ha-badge (#23120) --- src/components/ha-badge.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ha-badge.ts b/src/components/ha-badge.ts index 8b2160f24e..46ab2a0dd1 100644 --- a/src/components/ha-badge.ts +++ b/src/components/ha-badge.ts @@ -98,7 +98,6 @@ export class HaBadge extends LitElement { align-items: flex-start; padding-inline-start: initial; text-align: center; - font-family: Roboto; } .label { font-size: 10px; From 257cab1061e0bb206090cee64af0ca03c689ddc3 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 3 Dec 2024 16:16:52 +0100 Subject: [PATCH 04/10] Fix create section on iOS (#23123) --- src/panels/lovelace/views/hui-sections-view.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index 944e3a1632..a5eea8f38c 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -246,7 +246,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
From 6c9cfed49fae5a0414c860ffbb4ca0e20c79d170 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Wed, 4 Dec 2024 07:52:53 +0100 Subject: [PATCH 05/10] Explicitly set file name for camera snapshot (#23124) * Explicitly set file name for camera snapshot * Process code review --- src/dialogs/more-info/controls/more-info-camera.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dialogs/more-info/controls/more-info-camera.ts b/src/dialogs/more-info/controls/more-info-camera.ts index 7b339db519..0a9a6e6339 100644 --- a/src/dialogs/more-info/controls/more-info-camera.ts +++ b/src/dialogs/more-info/controls/more-info-camera.ts @@ -8,6 +8,7 @@ import "../../../components/buttons/ha-progress-button"; import { UNAVAILABLE } from "../../../data/entity"; import { fileDownload } from "../../../util/file_download"; import { showToast } from "../../../util/toast"; +import { slugify } from "../../../common/string/slugify"; class MoreInfoCamera extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -69,9 +70,14 @@ class MoreInfoCamera extends LitElement { throw new Error("No response from API"); } + const contentType = result.headers.get("content-type"); + const ext = contentType === "image/png" ? "png" : "jpg"; + const date = new Date().toLocaleString(); + const filename = `snapshot_${slugify(this.stateObj!.entity_id)}_${date}.${ext}`; + const blob = await result.blob(); const url = window.URL.createObjectURL(blob); - fileDownload(url); + fileDownload(url, filename); } catch (err) { this._waiting = false; button.actionError(); From 3a2cb51f8d24d1348785b7bf471643783d5a2094 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 4 Dec 2024 09:40:41 +0100 Subject: [PATCH 06/10] Reduce button target zone in media player more info (#23130) --- src/dialogs/more-info/controls/more-info-media_player.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 694b190d04..93828334d4 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -207,12 +207,17 @@ class MoreInfoMediaPlayer extends LitElement { static get styles(): CSSResultGroup { return css` - ha-icon-button[action="turn_off"], - ha-icon-button[action="turn_on"], ha-slider { flex-grow: 1; } + ha-icon-button[action="turn_off"], + ha-icon-button[action="turn_on"] { + margin-inline-end: auto; + margin-right: auto; + margin-left: inherit; + } + .controls { display: flex; flex-wrap: wrap; From 8f4e65d392a80a922eea79b6a395e14bbe7ec1dc Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 4 Dec 2024 13:17:47 +0100 Subject: [PATCH 07/10] Don't use duration formatting for second unit (#23132) Don't use duration formatting for sec unit --- src/common/datetime/format_duration.ts | 19 +------------------ test/common/datetime/format_duration.test.ts | 5 ----- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/common/datetime/format_duration.ts b/src/common/datetime/format_duration.ts index e20f7e18af..c2c0c11d55 100644 --- a/src/common/datetime/format_duration.ts +++ b/src/common/datetime/format_duration.ts @@ -71,7 +71,7 @@ export const formatDurationDigital = ( duration: HaDurationData ) => formatDigitalDurationMem(locale).format(duration); -export const DURATION_UNITS = ["s", "min", "h", "d"] as const; +export const DURATION_UNITS = ["min", "h", "d"] as const; type DurationUnit = (typeof DURATION_UNITS)[number]; @@ -99,14 +99,6 @@ const formatDurationMinuteMem = memoizeOne( }) ); -const formatDurationSecondMem = memoizeOne( - (locale: FrontendLocaleData) => - new Intl.DurationFormat(locale.language, { - style: "narrow", - secondsDisplay: "always", - }) -); - export const formatDuration = ( locale: FrontendLocaleData, duration: string, @@ -146,15 +138,6 @@ export const formatDuration = ( }; return formatDurationMinuteMem(locale).format(input); } - case "s": { - const seconds = Math.floor(value); - const milliseconds = Math.floor((value - seconds) * 1000); - const input: DurationInput = { - seconds, - milliseconds, - }; - return formatDurationSecondMem(locale).format(input); - } default: throw new Error("Invalid duration unit"); } diff --git a/test/common/datetime/format_duration.test.ts b/test/common/datetime/format_duration.test.ts index cd62785320..c0fc46af4b 100644 --- a/test/common/datetime/format_duration.test.ts +++ b/test/common/datetime/format_duration.test.ts @@ -21,11 +21,6 @@ const LOCALE: FrontendLocaleData = { describe("formatDuration", () => { it("works", () => { - assert.strictEqual(formatDuration(LOCALE, "0.5", "s"), "0s 500ms"); - assert.strictEqual(formatDuration(LOCALE, "1", "s"), "1s"); - assert.strictEqual(formatDuration(LOCALE, "1.1", "s"), "1s 100ms"); - assert.strictEqual(formatDuration(LOCALE, "65", "s"), "65s"); - assert.strictEqual(formatDuration(LOCALE, "0.25", "min"), "0m 15s"); assert.strictEqual(formatDuration(LOCALE, "0.5", "min"), "0m 30s"); assert.strictEqual(formatDuration(LOCALE, "1", "min"), "1m"); From fbff95345c2caace85f85387ca02cac47e3130f9 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Dec 2024 13:57:55 +0100 Subject: [PATCH 08/10] Use action instead of selected for select entity row (#23135) --- .../voice-assistant-setup-step-local.ts | 7 ------- .../voice-assistant-setup-step-pipeline.ts | 4 ---- src/panels/lovelace/entity-rows/hui-select-entity-row.ts | 6 ++++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts index cd00187d5a..1926f83e1e 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-local.ts @@ -24,7 +24,6 @@ import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; -import { nextRender } from "../../common/util/render-status"; @customElement("ha-voice-assistant-setup-step-local") export class HaVoiceAssistantSetupStepLocal extends LitElement { @@ -253,9 +252,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement { this._localTts[0].entity_id, this._localStt[0].entity_id ); - - // wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action - await nextRender(); } await this.hass.callService( @@ -337,9 +333,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement { this._localStt[0].entity_id ); - // wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action - await nextRender(); - await this.hass.callService( "select", "select_option", diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts index 781802d348..d008d312f0 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts @@ -17,7 +17,6 @@ import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; import { documentationUrl } from "../../util/documentation-url"; -import { nextRender } from "../../common/util/render-status"; @customElement("ha-voice-assistant-setup-step-pipeline") export class HaVoiceAssistantSetupStepPipeline extends LitElement { @@ -241,9 +240,6 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement { wake_word_entity: null, wake_word_id: null, }); - - // wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action - await nextRender(); } await this.hass.callService( diff --git a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts index 55290d7210..cf6cfb73e8 100644 --- a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts @@ -63,7 +63,7 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow { .value=${stateObj.state} .disabled=${stateObj.state === UNAVAILABLE} naturalMenuWidth - @selected=${this._selectedChanged} + @action=${this._handleAction} @click=${stopPropagation} @closed=${stopPropagation} > @@ -94,11 +94,13 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow { `; } - private _selectedChanged(ev): void { + private _handleAction(ev): void { const stateObj = this.hass!.states[ this._config!.entity ] as InputSelectEntity; + const option = ev.target.value; + if ( option === stateObj.state || !stateObj.attributes.options.includes(option) From a9c25b49b90ec1f279552e65c477aa578e9456e9 Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:55:12 +0100 Subject: [PATCH 09/10] Add red delete button to delete zone confirmation dialog (#23136) --- src/panels/config/zone/ha-config-zone.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts index 25306721af..d0a8a36580 100644 --- a/src/panels/config/zone/ha-config-zone.ts +++ b/src/panels/config/zone/ha-config-zone.ts @@ -509,6 +509,7 @@ export class HaConfigZone extends SubscribeMixin(LitElement) { title: this.hass!.localize("ui.panel.config.zone.confirm_delete"), dismissText: this.hass!.localize("ui.common.cancel"), confirmText: this.hass!.localize("ui.common.delete"), + destructive: true, })) ) { return false; From dbda1d75f9aa08902c6a0a389e8c85d93ec4cb8c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 4 Dec 2024 14:12:49 +0100 Subject: [PATCH 10/10] Bumped version to 20241127.4 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 74cb9fd55e..e0d234d749 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20241127.3" +version = "20241127.4" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"