From aa155261f548c9ef2d1cfbc252e55ca5903fe516 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 May 2023 22:39:56 +0200 Subject: [PATCH 1/8] Update ha-integration-card.ts --- src/panels/config/integrations/ha-integration-card.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 12a13a6cc5..bea76ba7b8 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -1003,7 +1003,7 @@ export class HaIntegrationCard extends LitElement { @media (min-width: 563px) { ha-card.group { position: relative; - min-height: 195px; + min-height: 200px; } mwc-list { position: absolute; From da1df9d8cc20c465c04d7bcadd5461f60ac6a44d Mon Sep 17 00:00:00 2001 From: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com> Date: Wed, 3 May 2023 10:38:26 +0200 Subject: [PATCH 2/8] Fix minor typo on expose entities dialog (#16388) - slight rephrasing suggestion. --- src/translations/en.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/translations/en.json b/src/translations/en.json index 6bdbb08f21..2ec11f260d 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2838,7 +2838,7 @@ "access_is_being_prepared": "Remote control is being prepared. We will notify you when it's ready.", "cerificate_loading": "Your certificate is loading.", "cerificate_loaded": "Your certificate is loaded, waiting for validation.", - "cerificate_error": "There was an error generating the certficate, check your logs.", + "cerificate_error": "There was an error generating the certificate, check your logs.", "info": "Home Assistant Cloud provides a secure remote connection to your instance while away from home.", "instance_is_available": "Your instance is available at your", "instance_will_be_available": "Your instance will be available at your", @@ -2863,19 +2863,19 @@ "not_configured_text": "Before you can use Alexa, you need to activate the Home Assistant skill for Alexa in the Alexa app.", "link_learn_how_it_works": "[%key:ui::panel::config::cloud::account::remote::link_learn_how_it_works%]", "expose_new_entities": "[%key:ui::panel::config::cloud::account::google::expose_new_entities%]", - "expose_new_entities_info": "Should new entities, that are supported and have no security risks be exposed to Alexa automatically?" + "expose_new_entities_info": "Should new entities be exposed to Alexa automatically? Exposes supported devices that are not classified as security devices." }, "google": { "title": "Google Assistant", - "info": "With the Google Assistant integration for Home Assistant Cloud you'll be able to control all your Home Assistant devices via any Google Assistant-enabled device.", + "info": "With the Google Assistant integration for Home Assistant Cloud, you'll be able to control all your Home Assistant devices via any Google Assistant-enabled device.", "http_use_ssl_warning_title": "Local communication unavailable", - "http_use_ssl_warning_text": "Google devices will not be able to talk locally with Home Assistant because you have configured an SSL certificate for your HTTP integration.", + "http_use_ssl_warning_text": "Google devices will not be able to talk locally with Home Assistant, because you have configured an SSL certificate for your HTTP integration.", "enable_ha_skill": "Activate the Home Assistant Cloud skill for Google Assistant", "config_documentation": "Configuration documentation", - "enable_state_reporting": "Enable State Reporting", + "enable_state_reporting": "Enable state reporting", "info_state_reporting": "If you enable state reporting, Home Assistant will send all state changes of exposed entities to Google. This speeds up voice commands and allows you to always see the latest states in the Google app.", - "security_devices": "Security Devices", - "enter_pin_info": "Please enter a PIN to interact with security devices. Security devices are doors, garage doors and locks. You will be asked to say/enter this PIN when interacting with such devices via Google Assistant.", + "security_devices": "Security devices", + "enter_pin_info": "Please enter a PIN to interact with security devices. Security devices are doors, garage doors, and locks. You will be asked to say/enter this PIN when interacting with security devices via Google Assistant.", "devices_pin": "Security Devices PIN", "enter_pin_hint": "Enter a PIN to use security devices", "show_entities": "Show Entities", @@ -2886,7 +2886,7 @@ "not_configured_text": "Before you can use Google Assistant, you need to activate the Home Assistant Cloud skill for Google Assistant in the Google Home app.", "link_learn_how_it_works": "[%key:ui::panel::config::cloud::account::remote::link_learn_how_it_works%]", "expose_new_entities": "Expose new entities", - "expose_new_entities_info": "Should new entities, that are supported and have no security risks be exposed to Google Assistant automatically?" + "expose_new_entities_info": "Should new entities be exposed to Google Assistant automatically? Exposes supported devices that are not classified as security devices." }, "webhooks": { "title": "Webhooks", From 822f47143b235ae147438eab6ff67968b7c74e2f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 May 2023 10:59:36 +0200 Subject: [PATCH 3/8] keep expose entity dialog modal longer (#16389) --- .../config/voice-assistants/dialog-expose-entity.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/panels/config/voice-assistants/dialog-expose-entity.ts b/src/panels/config/voice-assistants/dialog-expose-entity.ts index 2f41470b49..17c56b2b85 100644 --- a/src/panels/config/voice-assistants/dialog-expose-entity.ts +++ b/src/panels/config/voice-assistants/dialog-expose-entity.ts @@ -176,7 +176,17 @@ class DialogExposeEntity extends LitElement { lit-virtualizer { height: 500px; } - @media all and (max-width: 500px), all and (max-height: 800px) { + @media all and (max-height: 800px) { + lit-virtualizer { + height: 334px; + } + } + @media all and (max-height: 600px) { + lit-virtualizer { + height: 238px; + } + } + @media all and (max-width: 500px), all and (max-height: 500px) { ha-dialog { --mdc-dialog-min-width: calc( 100vw - env(safe-area-inset-right) - env(safe-area-inset-left) From a3ec83a684c64aae456af21e3820faf4b58edf2d Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 May 2023 11:47:58 +0200 Subject: [PATCH 4/8] Only count exposed entities with a state (#16391) Only count entities with a state --- src/panels/config/voice-assistants/assist-pref.ts | 6 ++++-- src/panels/config/voice-assistants/cloud-alexa-pref.ts | 6 ++++-- src/panels/config/voice-assistants/cloud-google-pref.ts | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/panels/config/voice-assistants/assist-pref.ts b/src/panels/config/voice-assistants/assist-pref.ts index f16d13d11d..47149da4dd 100644 --- a/src/panels/config/voice-assistants/assist-pref.ts +++ b/src/panels/config/voice-assistants/assist-pref.ts @@ -51,8 +51,10 @@ export class AssistPref extends LitElement { private _exposedEntitiesCount = memoizeOne( (exposedEntities: Record) => - Object.values(exposedEntities).filter((expose) => expose.conversation) - .length + Object.entries(exposedEntities).filter( + ([entityId, expose]) => + expose.conversation && entityId in this.hass.states + ).length ); protected render() { diff --git a/src/panels/config/voice-assistants/cloud-alexa-pref.ts b/src/panels/config/voice-assistants/cloud-alexa-pref.ts index a071eba07f..4f4eeef1cf 100644 --- a/src/panels/config/voice-assistants/cloud-alexa-pref.ts +++ b/src/panels/config/voice-assistants/cloud-alexa-pref.ts @@ -33,8 +33,10 @@ export class CloudAlexaPref extends LitElement { private _exposedEntitiesCount = memoizeOne( (exposedEntities: Record) => - Object.values(exposedEntities).filter((expose) => expose["cloud.alexa"]) - .length + Object.entries(exposedEntities).filter( + ([entityId, expose]) => + expose["cloud.alexa"] && entityId in this.hass.states + ).length ); protected willUpdate() { diff --git a/src/panels/config/voice-assistants/cloud-google-pref.ts b/src/panels/config/voice-assistants/cloud-google-pref.ts index 409319ffc9..ebdcdef163 100644 --- a/src/panels/config/voice-assistants/cloud-google-pref.ts +++ b/src/panels/config/voice-assistants/cloud-google-pref.ts @@ -45,8 +45,9 @@ export class CloudGooglePref extends LitElement { private _exposedEntitiesCount = memoizeOne( (exposedEntities: Record) => - Object.values(exposedEntities).filter( - (expose) => expose["cloud.google_assistant"] + Object.entries(exposedEntities).filter( + ([entityId, expose]) => + expose["cloud.google_assistant"] && entityId in this.hass.states ).length ); From b550c67a9fde40f8247b28799ac92e6ea7026fec Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 May 2023 12:36:16 +0200 Subject: [PATCH 5/8] Fetch supported items when startup is done (#16390) --- .../ha-config-voice-assistants-expose.ts | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts index 23f337086c..c81fd18116 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts @@ -119,7 +119,17 @@ export class VoiceAssistantsExpose extends LitElement { ); private _columns = memoize( - (narrow, availableAssistants, _language): DataTableColumnContainer => ({ + ( + narrow: boolean, + availableAssistants: string[], + supportedEntities: + | Record< + "cloud.google_assistant" | "cloud.alexa" | "conversation", + string[] | undefined + > + | undefined, + _language: string + ): DataTableColumnContainer => ({ icon: { title: "", type: "icon", @@ -166,8 +176,8 @@ export class VoiceAssistantsExpose extends LitElement { template: (assistants, entry) => html`${availableAssistants.map((key) => { const supported = - !this._supportedEntities?.[key] || - this._supportedEntities[key].includes(entry.entity_id); + !supportedEntities?.[key] || + supportedEntities[key].includes(entry.entity_id); const manual = entry.manAssistants?.includes(key); return assistants.includes(key) ? html` @@ -450,6 +460,10 @@ export class VoiceAssistantsExpose extends LitElement { this.hass, Object.keys(this._entities) ); + this._fetchSupportedEntities(); + } + + private async _fetchSupportedEntities() { let alexaEntitiesProm: Promise | undefined; let googleEntitiesProm: Promise | undefined; if (this.cloudStatus?.logged_in && this.cloudStatus.prefs.alexa_enabled) { @@ -467,7 +481,7 @@ export class VoiceAssistantsExpose extends LitElement { "cloud.google_assistant": googleEntities?.map( (entity) => entity.entity_id ), - // TODO add supported entity for assit + // TODO add supported entity for assist conversation: undefined, }; } @@ -475,6 +489,14 @@ export class VoiceAssistantsExpose extends LitElement { public willUpdate(changedProperties: PropertyValues): void { if (changedProperties.has("_entities")) { this._fetchEntities(); + return; + } + if ( + changedProperties.has("hass") && + this.hass.config.state === "RUNNING" && + changedProperties.get("hass")?.config.state !== this.hass.config.state + ) { + this._fetchSupportedEntities(); } } @@ -505,6 +527,7 @@ export class VoiceAssistantsExpose extends LitElement { .columns=${this._columns( this.narrow, this._availableAssistants(this.cloudStatus), + this._supportedEntities, this.hass.language )} .data=${filteredEntities} From 4a0d84d2f661f15db68951fed46ba0fe1cbc0de7 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 3 May 2023 12:58:43 +0200 Subject: [PATCH 6/8] Open more info from voice settings (#16392) * Open more info from voice settings * review --- .../voice-assistants/dialog-voice-settings.ts | 51 +++++++++++++++---- src/translations/en.json | 3 +- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/panels/config/voice-assistants/dialog-voice-settings.ts b/src/panels/config/voice-assistants/dialog-voice-settings.ts index 1e3aac8da0..361b595390 100644 --- a/src/panels/config/voice-assistants/dialog-voice-settings.ts +++ b/src/panels/config/voice-assistants/dialog-voice-settings.ts @@ -1,9 +1,10 @@ import "@material/mwc-button/mwc-button"; +import { mdiClose, mdiTuneVertical } from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; -import { createCloseHeading } from "../../../components/ha-dialog"; +import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import { haStyle, haStyleDialog } from "../../../resources/styles"; import { HomeAssistant } from "../../../types"; import "./entity-voice-settings"; @@ -24,22 +25,41 @@ class DialogVoiceSettings extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } + private _viewMoreInfo(): void { + showMoreInfoDialog(this, { + entityId: this._params!.entityId, + }); + this.closeDialog(); + } + protected render() { if (!this._params) { return nothing; } + const title = + computeStateName(this.hass.states[this._params.entityId]) || + this.hass.localize("ui.panel.config.entities.picker.unnamed_entity"); + return html` - + + + +
${title}
+ +
Date: Wed, 3 May 2023 13:54:59 +0200 Subject: [PATCH 7/8] Add support for native names for other languages than HA has (#16393) * Add support for native names for other languages than HA has * catch unsupported locales --- src/components/ha-language-picker.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/ha-language-picker.ts b/src/components/ha-language-picker.ts index ac8a11579d..618709c980 100644 --- a/src/components/ha-language-picker.ts +++ b/src/components/ha-language-picker.ts @@ -68,10 +68,24 @@ export class HaLanguagePicker extends LitElement { if (nativeName) { const translations = this.hass.translationMetadata.translations; - options = languages.map((lang) => ({ - value: lang, - label: translations[lang]?.nativeName ?? lang, - })); + options = languages.map((lang) => { + let label = translations[lang]?.nativeName; + if (!label) { + try { + // this will not work if Intl.DisplayNames is polyfilled, it will return in the language of the user + label = new Intl.DisplayNames(lang, { + type: "language", + fallback: "code", + }).of(lang)!; + } catch (err) { + label = lang; + } + } + return { + value: lang, + label, + }; + }); } else { options = languages.map((lang) => ({ value: lang, From 02a94c04af0664ee037b4e01c4bc526f71527d07 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 May 2023 14:13:12 +0200 Subject: [PATCH 8/8] Bumped version to 20230503.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8966ef67eb..1f2a5dc343 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230502.0" +version = "20230503.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"