From 2add88ccc23d87a92329b3ee07128389ef1c0ed4 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:07:34 -0800 Subject: [PATCH 001/356] Localize a device action string (#19203) --- src/data/script_i18n.ts | 4 +++- src/translations/en.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 1ba30198bd3e..4b07b84f0ed5 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -404,7 +404,9 @@ const tryDescribeAction = ( if (actionType === "device_action") { const config = action as DeviceAction; if (!config.device_id) { - return "Device action"; + return hass.localize( + `${actionTranslationBaseKey}.device_id.description.no_device` + ); } const localized = localizeDeviceAutomationAction( hass, diff --git a/src/translations/en.json b/src/translations/en.json index 0039d9926f56..a3070c0787b1 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2990,7 +2990,8 @@ "flash": "Flash" }, "description": { - "picker": "Do something on a device. Great way to start." + "picker": "Do something on a device. Great way to start.", + "no_device": "Device action" } }, "activate_scene": { From 4fcf99faa7b6735aee1550b785a76df8e633dcca Mon Sep 17 00:00:00 2001 From: JLo Date: Tue, 2 Jan 2024 12:08:05 +0100 Subject: [PATCH 002/356] Review on automation editor text (#19223) - Added `.` to bloc descriptions - Changed "Other" into "OTher triggers" "Other conditions" and "Other actions" - Adapted a few descriptions --- src/translations/en.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/translations/en.json b/src/translations/en.json index a3070c0787b1..c176cf65c96a 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2492,13 +2492,13 @@ "groups": { "entity": { "label": "Entity", - "description": "When something happens to an entity" + "description": "When something happens to an entity." }, "time_location": { "label": "Time and location", "description": "When someone enters or leaves a zone, or at a specific time." }, - "other": { "label": "Other" } + "other": { "label": "Other triggers" } }, "type": { "calendar": { @@ -2534,7 +2534,7 @@ "context_user_picked": "User firing event", "context_user_pick": "Select user", "description": { - "picker": "When an event is being received (event is an advanced concept in Home Assistant)", + "picker": "When an event is being received (event is an advanced concept in Home Assistant).", "full": "When {eventTypes} event is fired" } }, @@ -2546,7 +2546,7 @@ "enter": "Enter", "leave": "Leave", "description": { - "picker": "When an entity created by a geolocation platform appears in or disappears from a zone", + "picker": "When an entity created by a geolocation platform appears in or disappears from a zone.", "full": "When {source} {event, select, \n enter {enters}\n leave {leaves} other {} \n} {zone} {numberOfZones, plural,\n one {zone}\n other {zones}\n}" } }, @@ -2608,7 +2608,7 @@ "updated": "updated" }, "description": { - "picker": "When a persistent notification is added or removed", + "picker": "When a persistent notification is added or removed.", "full": "When a persistent notification is updated" } }, @@ -2619,7 +2619,7 @@ "sunset": "Sunset", "offset": "Offset (optional)", "description": { - "picker": "When the sun sets or rises", + "picker": "When the sun sets or rises.", "sets": "When the sun sets{hasDuration, select, \n true { offset by {duration}} \n other {}\n }", "rises": "When the sun rises{hasDuration, select, \n true { offset by {duration}} \n other {}\n }" } @@ -2648,7 +2648,7 @@ "value_template": "Value template", "for": "For", "description": { - "picker": "When a template is evaluated to true.", + "picker": "When a template evaluates to true.", "full": "When a template changes from false to true{hasDuration, select, \n true { for {duration}} \n other {}\n }" } }, @@ -2669,7 +2669,7 @@ "minutes": "Minutes", "seconds": "Seconds", "description": { - "picker": "Periodically, every defined interval of time." + "picker": "Periodically, at a defined interval." } }, "webhook": { @@ -2692,7 +2692,7 @@ "enter": "Enter", "leave": "Leave", "description": { - "picker": "When someone (or something) enters or leaves a zone", + "picker": "When someone (or something) enters or leaves a zone.", "full": "When {entity} {event, select, \n enter {enters}\n leave {leaves} other {} \n} {zone} {numberOfZones, plural,\n one {zone} \n other {zones}\n}" } } @@ -2734,7 +2734,7 @@ "label": "Time and location", "description": "If someone is in a zone or if the current time is before or after a specified time." }, - "other": { "label": "Other" }, + "other": { "label": "Other conditions" }, "building_blocks": { "label": "Building blocks", "description": "Build more complex conditions." @@ -2766,7 +2766,7 @@ "not": { "label": "Not", "description": { - "picker": "Test if a condition is not true", + "picker": "Test if a condition is not true.", "no_conditions": "Test if no condition matches", "one_condition": "Test if 1 condition does not match", "full": "Test if none of {count} conditions match" @@ -2800,7 +2800,7 @@ "label": "[%key:ui::panel::config::automation::editor::triggers::type::state::label%]", "state": "[%key:ui::panel::config::automation::editor::triggers::type::state::label%]", "description": { - "picker": "If an entity (or attribute) is in a specific state", + "picker": "If an entity (or attribute) is in a specific state.", "no_entity": "Confirm state", "full": "Confirm{hasAttribute, select, \n true { {attribute} of}\n other {}\n} {numberOfEntities, plural,\n zero {an entity is}\n one {{entities} is}\n other {{entities} are}\n} {numberOfStates, plural,\n zero {a state}\n other {{states}}\n}{hasDuration, select, \n true { for {duration}} \n other {}\n }" } @@ -2821,7 +2821,7 @@ "label": "[%key:ui::panel::config::automation::editor::triggers::type::template::label%]", "value_template": "[%key:ui::panel::config::automation::editor::triggers::type::template::value_template%]", "description": { - "picker": "If a template is evaluated to true.", + "picker": "If a template evaluates to true.", "full": "Test if template renders a value equal to true" } }, @@ -2844,7 +2844,7 @@ "sun": "Sunday" }, "description": { - "picker": "If the current time is before or after a specified time", + "picker": "If the current time is before or after a specified time.", "full": "Confirm the {hasTime, select, \n after {time is after {time_after}}\n before {time is before {time_before}}\n after_before {time is after {time_after} and before {time_before}} \n other {}\n }{hasTimeAndDay, select, \n true { and the }\n other {}\n}{hasDay, select, \n true { day is {day}}\n other {}\n}" } }, @@ -2862,7 +2862,7 @@ "entity": "[%key:ui::panel::config::automation::editor::triggers::type::zone::entity%]", "zone": "[%key:ui::panel::config::automation::editor::triggers::type::zone::label%]", "description": { - "picker": "If someone (or something) is in a zone", + "picker": "If someone (or something) is in a zone.", "full": "Confirm {entity} {numberOfEntities, plural,\n one {is}\n other {are}\n} in {zone} {numberOfZones, plural,\n one {zone} \n other {zones}\n} " } } @@ -2899,7 +2899,7 @@ "continue_on_error": "Continue on error", "groups": { "helpers": { "label": "Helpers" }, - "other": { "label": "Other" }, + "other": { "label": "Other actions" }, "building_blocks": { "label": "Building blocks", "description": "Build more complex sequences of actions." @@ -3070,14 +3070,14 @@ "response_variable": "The name of the variable to use as response", "error": "Stop because of an unexpected error", "description": { - "picker": "Stop the sequence of actions", + "picker": "Stop the sequence of actions.", "full": "Stop {hasReason, select, \n true { because: {reason}} \n other {}\n }" } }, "parallel": { "label": "Run in parallel", "description": { - "picker": "perform a sequence of actions in parallel.", + "picker": "Perform a sequence of actions in parallel.", "full": "Run {number} {number, plural,\n one {action}\n other {actions}\n} in parallel" } }, From f099f66065ead07852d268773eecb468523550eb Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 13:36:06 +0100 Subject: [PATCH 003/356] Automation editor tweaks (#19225) * Automation editor tweaks * fix styling --- src/data/condition.ts | 1 - .../add-automation-element-dialog.ts | 145 +++++++++++++----- .../condition/ha-automation-condition.ts | 1 + .../types/ha-automation-condition-device.ts | 1 + .../show-add-automation-element-dialog.ts | 1 + .../types/ha-automation-trigger-device.ts | 1 + 6 files changed, 108 insertions(+), 42 deletions(-) diff --git a/src/data/condition.ts b/src/data/condition.ts index 44a0e218609c..d8c7af44fecc 100644 --- a/src/data/condition.ts +++ b/src/data/condition.ts @@ -46,7 +46,6 @@ export const CONDITION_GROUPS: AutomationElementGroup = { icon: mdiDotsHorizontal, members: { template: {}, - trigger: {}, }, }, } as const; diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index b96283a61dd8..31760dca1bc1 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -1,7 +1,14 @@ import "@material/mwc-list/mwc-list"; import { mdiClose, mdiContentPaste, mdiPlus } from "@mdi/js"; import Fuse, { IFuseOptions } from "fuse.js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import { + CSSResultGroup, + LitElement, + PropertyValues, + css, + html, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; @@ -42,6 +49,8 @@ import { AddAutomationElementDialogParams, PASTE_VALUE, } from "./show-add-automation-element-dialog"; +import { computeDomain } from "../../../common/entity/compute_domain"; +import { deepEqual } from "../../../common/util/deep-equal"; const TYPES = { trigger: { groups: TRIGGER_GROUPS, icons: TRIGGER_ICONS }, @@ -93,13 +102,15 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { @state() private _manifests?: DomainManifestLookup; + @state() private _domains?: Set; + @query("ha-dialog") private _dialog?: HaDialog; private _fullScreen = false; - private _width?: number; + @state() private _width?: number; - private _height?: number; + @state() private _height?: number; public showDialog(params): void { this._params = params; @@ -124,6 +135,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this._prev = undefined; this._filter = ""; this._manifests = undefined; + this._domains = undefined; } private _convertToItem = ( @@ -152,6 +164,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { private _getFilteredItems = memoizeOne( ( type: AddAutomationElementDialogParams["type"], + root: AddAutomationElementDialogParams["root"], group: string | undefined, filter: string, localize: LocalizeFunc, @@ -164,6 +177,10 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { : TYPES[type].groups[group].members! : TYPES[type].groups; + if (type === "condition" && group === "other" && !root) { + groups.trigger = {}; + } + const flattenGroups = (grp: AutomationElementGroup) => Object.entries(grp).map(([key, options]) => options.members @@ -191,7 +208,9 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { private _getGroupItems = memoizeOne( ( type: AddAutomationElementDialogParams["type"], + root: AddAutomationElementDialogParams["root"], group: string | undefined, + domains: Set | undefined, localize: LocalizeFunc, services: HomeAssistant["services"], manifests?: DomainManifestLookup @@ -208,6 +227,10 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { ? TYPES[type].groups[group].members! : TYPES[type].groups; + if (type === "condition" && group === "other" && !root) { + groups.trigger = {}; + } + const result = Object.entries(groups).map(([key, options]) => this._convertToItem(key, options, type, localize) ); @@ -215,15 +238,33 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { if (type === "action") { if (!this._group) { result.unshift( - ...this._serviceGroups(localize, services, manifests, undefined) + ...this._serviceGroups( + localize, + services, + manifests, + domains, + undefined + ) ); } else if (this._group === "helpers") { result.unshift( - ...this._serviceGroups(localize, services, manifests, "helper") + ...this._serviceGroups( + localize, + services, + manifests, + domains, + "helper" + ) ); } else if (this._group === "other") { result.unshift( - ...this._serviceGroups(localize, services, manifests, "other") + ...this._serviceGroups( + localize, + services, + manifests, + domains, + "other" + ) ); } } @@ -243,42 +284,44 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { } ); - private _serviceGroups = memoizeOne( - ( - localize: LocalizeFunc, - services: HomeAssistant["services"], - manifests: DomainManifestLookup | undefined, - type: "helper" | "other" | undefined - ): ListItem[] => { - if (!services || !manifests) { - return []; - } - const result: ListItem[] = []; - Object.keys(services).forEach((domain) => { - const manifest = manifests[domain]; - if ( - (type === undefined && - manifest?.integration_type === "entity" && - !ENTITY_DOMAINS_OTHER.has(domain)) || - (type === "helper" && manifest?.integration_type === "helper") || - (type === "other" && - (ENTITY_DOMAINS_OTHER.has(domain) || - !["helper", "entity"].includes(manifest?.integration_type || ""))) - ) { - result.push({ - group: true, - icon: domainIcon(domain), - key: `${SERVICE_PREFIX}${domain}`, - name: domainToName(localize, domain, manifest), - description: "", - }); - } - }); - return result.sort((a, b) => - stringCompare(a.name, b.name, this.hass.locale.language) - ); + private _serviceGroups = ( + localize: LocalizeFunc, + services: HomeAssistant["services"], + manifests: DomainManifestLookup | undefined, + domains: Set | undefined, + type: "helper" | "other" | undefined + ): ListItem[] => { + if (!services || !manifests) { + return []; } - ); + const result: ListItem[] = []; + Object.keys(services).forEach((domain) => { + const manifest = manifests[domain]; + const domainUsed = !domains ? true : domains.has(domain); + if ( + (type === undefined && + manifest?.integration_type === "entity" && + domainUsed && + !ENTITY_DOMAINS_OTHER.has(domain)) || + (type === "helper" && manifest?.integration_type === "helper") || + (type === "other" && + (ENTITY_DOMAINS_OTHER.has(domain) || + (!domainUsed && manifest?.integration_type === "entity") || + !["helper", "entity"].includes(manifest?.integration_type || ""))) + ) { + result.push({ + group: true, + icon: domainIcon(domain), + key: `${SERVICE_PREFIX}${domain}`, + name: domainToName(localize, domain, manifest), + description: "", + }); + } + }); + return result.sort((a, b) => + stringCompare(a.name, b.name, this.hass.locale.language) + ); + }; private _services = memoizeOne( ( @@ -368,6 +411,19 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this._height = boundingRect?.height; } + protected willUpdate(changedProperties: PropertyValues): void { + if ( + this._params?.type === "action" && + changedProperties.has("hass") && + changedProperties.get("hass")?.states !== this.hass.states + ) { + const domains = new Set(Object.keys(this.hass.states).map(computeDomain)); + if (!deepEqual(domains, this._domains)) { + this._domains = domains; + } + } + } + protected render() { if (!this._params) { return nothing; @@ -376,6 +432,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { const items = this._filter ? this._getFilteredItems( this._params.type, + this._params.root, this._group, this._filter, this.hass.localize, @@ -384,7 +441,9 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { ) : this._getGroupItems( this._params.type, + this._params.root, this._group, + this._domains, this.hass.localize, this.hass.services, this._manifests @@ -562,6 +621,10 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { ha-icon-next { width: 24px; } + mwc-list { + max-height: 468px; + max-width: 100vw; + } search-input { display: block; margin: 0 16px; diff --git a/src/panels/config/automation/condition/ha-automation-condition.ts b/src/panels/config/automation/condition/ha-automation-condition.ts index 27364b92a3ed..ecf4f8823770 100644 --- a/src/panels/config/automation/condition/ha-automation-condition.ts +++ b/src/panels/config/automation/condition/ha-automation-condition.ts @@ -203,6 +203,7 @@ export default class HaAutomationCondition extends LitElement { showAddAutomationElementDialog(this, { type: "condition", add: this._addCondition, + root: !this.nested, clipboardItem: this._clipboard?.condition?.condition, }); } diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts index 71568fe02c10..4593a5f70123 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts @@ -168,6 +168,7 @@ export class HaDeviceCondition extends LitElement { } ha-form { + display: block; margin-top: 24px; } `; diff --git a/src/panels/config/automation/show-add-automation-element-dialog.ts b/src/panels/config/automation/show-add-automation-element-dialog.ts index c497ca85c620..55453505121d 100644 --- a/src/panels/config/automation/show-add-automation-element-dialog.ts +++ b/src/panels/config/automation/show-add-automation-element-dialog.ts @@ -6,6 +6,7 @@ export interface AddAutomationElementDialogParams { type: "trigger" | "condition" | "action"; add: (key: string) => void; clipboardItem: string | undefined; + root?: boolean; group?: string; } const loadDialog = () => import("./add-automation-element-dialog"); diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts index 8b3a63575220..1b94ff6138b2 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts @@ -174,6 +174,7 @@ export class HaDeviceTrigger extends LitElement { } ha-form { + display: block; margin-top: 24px; } `; From c125ec087a11c0b584a85b10b6907cae764c9e73 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 16:08:26 +0100 Subject: [PATCH 004/356] Remove references to "service call" from actions (#19226) --- src/components/ha-service-control.ts | 28 ++++++++++++++----- src/data/script.ts | 2 ++ src/data/script_i18n.ts | 5 +++- .../action/ha-automation-action-row.ts | 10 ++++++- .../automation/action/ha-automation-action.ts | 1 + src/translations/en.json | 1 + 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index f1ae8ee54bac..119418355c64 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -4,7 +4,14 @@ import { HassServices, HassServiceTarget, } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../common/array/ensure-array"; @@ -83,6 +90,8 @@ export class HaServiceControl extends LitElement { @property({ type: Boolean }) public showAdvanced?: boolean; + @property({ type: Boolean, reflect: true }) public hidePicker?: boolean; + @state() private _value!: this["value"]; @state() private _checkedKeys = new Set(); @@ -363,12 +372,14 @@ export class HaServiceControl extends LitElement { )) || serviceData?.description; - return html` + return html`${this.hidePicker + ? nothing + : html``}
${description ? html`

${description}

` : ""} ${this._manifest @@ -735,6 +746,9 @@ export class HaServiceControl extends LitElement { margin: var(--service-control-padding, 0 16px); padding: 16px 0; } + :host([hidePicker]) p { + padding-top: 0; + } .checkbox-spacer { width: 32px; } diff --git a/src/data/script.ts b/src/data/script.ts index f0b5e7151b51..08910dc88fcb 100644 --- a/src/data/script.ts +++ b/src/data/script.ts @@ -52,6 +52,7 @@ export const serviceActionStruct: Describe = assign( target: optional(targetStruct), data: optional(object()), response_variable: optional(string()), + metadata: optional(object()), }) ); @@ -133,6 +134,7 @@ export interface ServiceAction extends BaseAction { target?: HassServiceTarget; data?: Record; response_variable?: string; + metadata?: Record; } export interface DeviceAction extends BaseAction { diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 4b07b84f0ed5..3d7d8c5a1da4 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -168,8 +168,11 @@ const tryDescribeAction = ( const service = hass.localize(`component.${domain}.services.${serviceName}.name`) || hass.services[domain][serviceName]?.name; + return hass.localize( - `${actionTranslationBaseKey}.service.description.service_based_on_name`, + `${actionTranslationBaseKey}.service.description.${ + config.metadata ? "service_name" : "service_based_on_name" + }`, { name: service ? `${domainToName(hass.localize, domain)}: ${service}` diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index f09c901c8e1a..0e58c0e8b2b5 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -29,6 +29,8 @@ import { classMap } from "lit/directives/class-map"; import { storage } from "../../../../common/decorators/storage"; import { dynamicElement } from "../../../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../../../common/dom/fire_event"; +import { computeDomain } from "../../../../common/entity/compute_domain"; +import { domainIconWithoutDefault } from "../../../../common/entity/domain_icon"; import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter"; import { handleStructError } from "../../../../common/structs/handle-errors"; import "../../../../components/ha-alert"; @@ -190,7 +192,13 @@ export default class HaAutomationActionRow extends LitElement {

${capitalizeFirstLetter( describeAction(this.hass, this._entityReg, this.action) diff --git a/src/panels/config/automation/action/ha-automation-action.ts b/src/panels/config/automation/action/ha-automation-action.ts index dca4bab6acde..ce312a7bd399 100644 --- a/src/panels/config/automation/action/ha-automation-action.ts +++ b/src/panels/config/automation/action/ha-automation-action.ts @@ -191,6 +191,7 @@ export default class HaAutomationAction extends LitElement { } else if (isService(action)) { actions = this.actions.concat({ service: getService(action), + metadata: {}, }); } else { const elClass = customElements.get( diff --git a/src/translations/en.json b/src/translations/en.json index c176cf65c96a..e771c8fe1910 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2914,6 +2914,7 @@ "description": { "service_based_on_template": "Call a service based on a template on {targets}", "service_based_on_name": "Call a service ''{name}'' on {targets}", + "service_name": "''{name}'' on {targets}", "service": "Call a service", "target_template": "templated {name}", "target_unknown_entity": "unknown entity", From f2226cdec24760fce2172978f97a07b609675372 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 18:11:34 +0100 Subject: [PATCH 005/356] Use brand icons in actions (#19227) --- src/common/const.ts | 4 ++ .../add-automation-element-dialog.ts | 39 ++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/common/const.ts b/src/common/const.ts index 66c14e64e140..68f4fa97b1c1 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -29,6 +29,7 @@ import { mdiFlash, mdiFlower, mdiFormatListBulleted, + mdiFormatListCheckbox, mdiFormTextbox, mdiGauge, mdiGoogleAssistant, @@ -64,6 +65,7 @@ import { mdiTransmissionTower, mdiWater, mdiWaterPercent, + mdiWeatherPartlyCloudy, mdiWeatherPouring, mdiWeatherRainy, mdiWeatherWindy, @@ -128,6 +130,7 @@ export const FIXED_DOMAIN_ICONS = { updater: mdiCloudUpload, vacuum: mdiRobotVacuum, wake_word: mdiChatSleep, + weather: mdiWeatherPartlyCloudy, zone: mdiMapMarkerRadius, }; @@ -166,6 +169,7 @@ export const FIXED_DEVICE_CLASS_ICONS = { precipitation_intensity: mdiWeatherPouring, pressure: mdiGauge, reactive_power: mdiFlash, + shopping_List: mdiFormatListCheckbox, signal_strength: mdiWifi, sound_pressure: mdiEarHearing, speed: mdiSpeedometer, diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 31760dca1bc1..0e930b7c9916 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -15,7 +15,7 @@ import { repeat } from "lit/directives/repeat"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; -import { domainIcon } from "../../../common/entity/domain_icon"; +import { domainIconWithoutDefault } from "../../../common/entity/domain_icon"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { stringCompare } from "../../../common/string/compare"; import { LocalizeFunc } from "../../../common/translations/localize"; @@ -45,6 +45,7 @@ import { TRIGGER_GROUPS, TRIGGER_ICONS } from "../../../data/trigger"; import { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../resources/styles"; import { HomeAssistant } from "../../../types"; +import { brandsUrl } from "../../../util/brands-url"; import { AddAutomationElementDialogParams, PASTE_VALUE, @@ -68,7 +69,8 @@ interface ListItem { key: string; name: string; description: string; - icon: string; + icon?: string; + image?: string; group: boolean; } @@ -309,9 +311,17 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { (!domainUsed && manifest?.integration_type === "entity") || !["helper", "entity"].includes(manifest?.integration_type || ""))) ) { + const icon = domainIconWithoutDefault(domain); result.push({ group: true, - icon: domainIcon(domain), + icon, + image: !icon + ? brandsUrl({ + domain, + type: "icon", + darkOptimized: this.hass.themes?.darkMode, + }) + : undefined, key: `${SERVICE_PREFIX}${domain}`, name: domainToName(localize, domain, manifest), description: "", @@ -345,9 +355,17 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { const services_keys = Object.keys(services[dmn]); for (const service of services_keys) { + const icon = domainIconWithoutDefault(dmn); result.push({ group: false, - icon: domainIcon(dmn), + icon, + image: !icon + ? brandsUrl({ + domain: dmn, + type: "icon", + darkOptimized: this.hass.themes?.darkMode, + }) + : undefined, key: `${SERVICE_PREFIX}${dmn}.${service}`, name: `${domain ? "" : `${domainToName(localize, dmn)}: `}${ this.hass.localize(`component.${dmn}.services.${service}.name`) || @@ -556,7 +574,18 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { > ${item.name} ${item.description} - + ${item.icon + ? html`` + : html``} ${item.group ? html`` : html` Date: Tue, 2 Jan 2024 18:31:18 +0100 Subject: [PATCH 006/356] Change format of service description (#19229) --- src/data/script_i18n.ts | 15 ++++++++++++--- src/translations/en.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 3d7d8c5a1da4..40c823bc862f 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -169,10 +169,19 @@ const tryDescribeAction = ( hass.localize(`component.${domain}.services.${serviceName}.name`) || hass.services[domain][serviceName]?.name; + if (config.metadata) { + return hass.localize( + `${actionTranslationBaseKey}.service.description.service_name`, + { + domain: domainToName(hass.localize, domain), + name: service || config.service, + targets: formatListWithAnds(hass.locale, targets), + } + ); + } + return hass.localize( - `${actionTranslationBaseKey}.service.description.${ - config.metadata ? "service_name" : "service_based_on_name" - }`, + `${actionTranslationBaseKey}.service.description.service_based_on_name`, { name: service ? `${domainToName(hass.localize, domain)}: ${service}` diff --git a/src/translations/en.json b/src/translations/en.json index e771c8fe1910..6ef41c81c129 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2914,7 +2914,7 @@ "description": { "service_based_on_template": "Call a service based on a template on {targets}", "service_based_on_name": "Call a service ''{name}'' on {targets}", - "service_name": "''{name}'' on {targets}", + "service_name": "{domain} ''{name}'' on {targets}", "service": "Call a service", "target_template": "templated {name}", "target_unknown_entity": "unknown entity", From 18b5fd59a629268bce2d5d7aa6e7fd390e1d6ab1 Mon Sep 17 00:00:00 2001 From: Josh McCarty Date: Tue, 2 Jan 2024 10:35:08 -0700 Subject: [PATCH 007/356] Add missing device classes for entity-registry-settings-editor (#19231) * Add connectivity device class for binary sensors * Add update device class * Separate connectivity and update --- src/panels/config/entities/entity-registry-settings-editor.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index 14d88e12afc7..9e7213e41475 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -118,6 +118,8 @@ const OVERRIDE_DEVICE_CLASSES = { "carbon_monoxide", "moisture", ], // Alarm + ["connectivity"], // Connectivity + ["update"], // Update ], }; From 01bd88ce101c1c0909c093d55afdaab1cd24073d Mon Sep 17 00:00:00 2001 From: JLo Date: Tue, 2 Jan 2024 18:39:55 +0100 Subject: [PATCH 008/356] New copy for device trigger in automation editor (#19232) New copy for device trigger in automation editor: "Set of conditions provided by your device. Great way to start." --- src/translations/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/translations/en.json b/src/translations/en.json index 6ef41c81c129..53306cd8b77d 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2760,7 +2760,7 @@ "preset_mode": "Preset mode" }, "description": { - "picker": "If a device is in a certain state. Great way to start." + "picker": "Set of conditions provided by your device. Great way to start." } }, "not": { From 8d496e1511c0ed56116da4829141239ef92e0423 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 18:47:39 +0100 Subject: [PATCH 009/356] Update add-automation-element-dialog.ts --- src/panels/config/automation/add-automation-element-dialog.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 0e930b7c9916..d498e8375cd8 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -528,7 +528,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { rootTabbable style=${styleMap({ width: this._width ? `${this._width}px` : "auto", - height: this._height ? `${Math.min(468, this._height)}px` : "auto", + height: this._height ? `${Math.min(670, this._height)}px` : "auto", })} > ${this._params.clipboardItem && @@ -651,7 +651,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { width: 24px; } mwc-list { - max-height: 468px; + max-height: 670px; max-width: 100vw; } search-input { From de3b9a5bb2a847cc7353ec9e960a83363b57ba25 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 18:48:34 +0100 Subject: [PATCH 010/356] Give todo and calendar edit static header (#19233) --- src/panels/calendar/dialog-calendar-event-editor.ts | 6 +++--- src/panels/todo/dialog-todo-item-editor.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index 7c06cac92cf1..e5925b1243e2 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -144,9 +144,9 @@ class DialogCalendarEventEditor extends LitElement { escapeKeyAction .heading=${createCloseHeading( this.hass, - isCreate - ? this.hass.localize("ui.components.calendar.event.add") - : this._summary + this.hass.localize( + `ui.components.calendar.event.${isCreate ? "add" : "edit"}` + ) )} >
diff --git a/src/panels/todo/dialog-todo-item-editor.ts b/src/panels/todo/dialog-todo-item-editor.ts index c81b9e4dbec3..cd26ad35fc28 100644 --- a/src/panels/todo/dialog-todo-item-editor.ts +++ b/src/panels/todo/dialog-todo-item-editor.ts @@ -101,9 +101,9 @@ class DialogTodoItemEditor extends LitElement { scrimClickAction .heading=${createCloseHeading( this.hass, - isCreate - ? this.hass.localize("ui.components.todo.item.add") - : this._summary + this.hass.localize( + `ui.components.todo.item.${isCreate ? "add" : "edit"}` + ) )} >
From 53dedc6c6587b2eeb9f76b53f55ccb5129e99612 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 18:49:31 +0100 Subject: [PATCH 011/356] Bumped version to 20240102.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d1e5abd3d1c4..7d09a1121ede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240101.0" +version = "20240102.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 7354988ec96e1abf1e96dc4df755cf4ea0c4e599 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Jan 2024 19:58:37 +0100 Subject: [PATCH 012/356] Move notification services to main list (#19235) --- .../config/automation/add-automation-element-dialog.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index d498e8375cd8..06a77884f1c6 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -90,6 +90,8 @@ const ENTITY_DOMAINS_OTHER = new Set([ "image_processing", ]); +const ENTITY_DOMAINS_MAIN = new Set(["notify"]); + @customElement("add-automation-element-dialog") class DialogAddAutomationElement extends LitElement implements HassDialog { @property({ attribute: false }) public hass!: HomeAssistant; @@ -302,11 +304,13 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { const domainUsed = !domains ? true : domains.has(domain); if ( (type === undefined && - manifest?.integration_type === "entity" && - domainUsed && - !ENTITY_DOMAINS_OTHER.has(domain)) || + (ENTITY_DOMAINS_MAIN.has(domain) || + (manifest?.integration_type === "entity" && + domainUsed && + !ENTITY_DOMAINS_OTHER.has(domain)))) || (type === "helper" && manifest?.integration_type === "helper") || (type === "other" && + !ENTITY_DOMAINS_MAIN.has(domain) && (ENTITY_DOMAINS_OTHER.has(domain) || (!domainUsed && manifest?.integration_type === "entity") || !["helper", "entity"].includes(manifest?.integration_type || ""))) From c2f3e43ee50fcabd26254ebd3412217b6f49a045 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:00:19 +0100 Subject: [PATCH 013/356] Set default values for required and disabled for labeled slider (#19246) Set default values --- src/components/ha-labeled-slider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ha-labeled-slider.ts b/src/components/ha-labeled-slider.ts index 366eb4f5555c..5faf7a8b96b2 100644 --- a/src/components/ha-labeled-slider.ts +++ b/src/components/ha-labeled-slider.ts @@ -10,9 +10,9 @@ class HaLabeledSlider extends LitElement { @property() public caption?: string; - @property() public disabled?: boolean; + @property({ type: Boolean }) public disabled = false; - @property() public required?: boolean; + @property({ type: Boolean }) public required = true; @property() public min: number = 0; From 8ee4aa9e634a2f391b4aa51f2a9cfeb116ce77d8 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 10:37:59 +0100 Subject: [PATCH 014/356] Bumped version to 20240103.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7d09a1121ede..f43e4cf0dc55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240102.0" +version = "20240103.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 6e7366bf690f500f9cfa4f81aefd002c822dc9ed Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 10:37:30 +0100 Subject: [PATCH 015/356] Calculate used domains on open of action dialog (#19255) --- .../automation/add-automation-element-dialog.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 06a77884f1c6..f8be65baf183 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -122,6 +122,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { if (this._params?.type === "action") { this.hass.loadBackendTranslation("services"); this._fetchManifests(); + this._calculateUsedDomains(); } this._fullScreen = matchMedia( "all and (max-width: 450px), all and (max-height: 500px)" @@ -425,6 +426,13 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this._manifests = manifests; } + private _calculateUsedDomains() { + const domains = new Set(Object.keys(this.hass.states).map(computeDomain)); + if (!deepEqual(domains, this._domains)) { + this._domains = domains; + } + } + protected _opened(): void { // Store the width and height so that when we search, box doesn't jump const boundingRect = @@ -439,10 +447,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { changedProperties.has("hass") && changedProperties.get("hass")?.states !== this.hass.states ) { - const domains = new Set(Object.keys(this.hass.states).map(computeDomain)); - if (!deepEqual(domains, this._domains)) { - this._domains = domains; - } + this._calculateUsedDomains(); } } From c9a0ae6e2d35488304c5ad0a62b528e4c64fe615 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 12:28:46 +0100 Subject: [PATCH 016/356] Bumped version to 20240103.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f43e4cf0dc55..570bc96eaf74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240103.0" +version = "20240103.1" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 336214d97f3715a866988a257edf939ec37b25d5 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 12:20:11 +0100 Subject: [PATCH 017/356] Revert conditional rendering of condition (#19257) * Fix conditionally showing `triggered by` * revert conditional rendering * Update add-automation-element-dialog.ts * Update add-automation-element-dialog.ts --- src/data/condition.ts | 1 + .../add-automation-element-dialog.ts | 43 ++++++++----------- .../condition/ha-automation-condition.ts | 1 - .../show-add-automation-element-dialog.ts | 1 - 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/data/condition.ts b/src/data/condition.ts index d8c7af44fecc..44a0e218609c 100644 --- a/src/data/condition.ts +++ b/src/data/condition.ts @@ -46,6 +46,7 @@ export const CONDITION_GROUPS: AutomationElementGroup = { icon: mdiDotsHorizontal, members: { template: {}, + trigger: {}, }, }, } as const; diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index f8be65baf183..cf5874f80cd8 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -143,6 +143,16 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { this._domains = undefined; } + private _getGroups = ( + type: AddAutomationElementDialogParams["type"], + group: string | undefined + ): AutomationElementGroup => + group + ? isService(group) + ? {} + : TYPES[type].groups[group].members! + : TYPES[type].groups; + private _convertToItem = ( key: string, options, @@ -169,22 +179,13 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { private _getFilteredItems = memoizeOne( ( type: AddAutomationElementDialogParams["type"], - root: AddAutomationElementDialogParams["root"], group: string | undefined, filter: string, localize: LocalizeFunc, services: HomeAssistant["services"], manifests?: DomainManifestLookup ): ListItem[] => { - const groups: AutomationElementGroup = group - ? isService(group) - ? {} - : TYPES[type].groups[group].members! - : TYPES[type].groups; - - if (type === "condition" && group === "other" && !root) { - groups.trigger = {}; - } + const groups = this._getGroups(type, group); const flattenGroups = (grp: AutomationElementGroup) => Object.entries(grp).map(([key, options]) => @@ -213,7 +214,6 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { private _getGroupItems = memoizeOne( ( type: AddAutomationElementDialogParams["type"], - root: AddAutomationElementDialogParams["root"], group: string | undefined, domains: Set | undefined, localize: LocalizeFunc, @@ -221,20 +221,17 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { manifests?: DomainManifestLookup ): ListItem[] => { if (type === "action" && isService(group)) { - const result = this._services(localize, services, manifests, group); + let result = this._services(localize, services, manifests, group); if (group === `${SERVICE_PREFIX}media_player`) { - result.unshift(this._convertToItem("play_media", {}, type, localize)); + result = [ + this._convertToItem("play_media", {}, type, localize), + ...result, + ]; } return result; } - const groups: AutomationElementGroup = group - ? TYPES[type].groups[group].members! - : TYPES[type].groups; - - if (type === "condition" && group === "other" && !root) { - groups.trigger = {}; - } + const groups = this._getGroups(type, group); const result = Object.entries(groups).map(([key, options]) => this._convertToItem(key, options, type, localize) @@ -459,7 +456,6 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { const items = this._filter ? this._getFilteredItems( this._params.type, - this._params.root, this._group, this._filter, this.hass.localize, @@ -468,7 +464,6 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { ) : this._getGroupItems( this._params.type, - this._params.root, this._group, this._domains, this.hass.localize, @@ -537,7 +532,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { rootTabbable style=${styleMap({ width: this._width ? `${this._width}px` : "auto", - height: this._height ? `${Math.min(670, this._height)}px` : "auto", + height: this._height ? `${Math.min(468, this._height)}px` : "auto", })} > ${this._params.clipboardItem && @@ -660,7 +655,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog { width: 24px; } mwc-list { - max-height: 670px; + max-height: 468px; max-width: 100vw; } search-input { diff --git a/src/panels/config/automation/condition/ha-automation-condition.ts b/src/panels/config/automation/condition/ha-automation-condition.ts index ecf4f8823770..27364b92a3ed 100644 --- a/src/panels/config/automation/condition/ha-automation-condition.ts +++ b/src/panels/config/automation/condition/ha-automation-condition.ts @@ -203,7 +203,6 @@ export default class HaAutomationCondition extends LitElement { showAddAutomationElementDialog(this, { type: "condition", add: this._addCondition, - root: !this.nested, clipboardItem: this._clipboard?.condition?.condition, }); } diff --git a/src/panels/config/automation/show-add-automation-element-dialog.ts b/src/panels/config/automation/show-add-automation-element-dialog.ts index 55453505121d..c497ca85c620 100644 --- a/src/panels/config/automation/show-add-automation-element-dialog.ts +++ b/src/panels/config/automation/show-add-automation-element-dialog.ts @@ -6,7 +6,6 @@ export interface AddAutomationElementDialogParams { type: "trigger" | "condition" | "action"; add: (key: string) => void; clipboardItem: string | undefined; - root?: boolean; group?: string; } const loadDialog = () => import("./add-automation-element-dialog"); From ae0eac3415f9df2cbab002c1f09742f0ee70c573 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 14:59:45 +0100 Subject: [PATCH 018/356] Bumped version to 20240103.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 570bc96eaf74..f43e4cf0dc55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240103.1" +version = "20240103.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 22929672a069db25a0a94f230c8c9f57ac0afdd7 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 3 Jan 2024 05:58:59 -0800 Subject: [PATCH 019/356] Remove tile pointer/ripple/index when it has no action (#19137) * Remove tile pointer/ripple/index when it has no action * update * Apply suggestions from code review Co-authored-by: Paul Bottein --------- Co-authored-by: Paul Bottein --- src/panels/lovelace/cards/hui-tile-card.ts | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index 1c06426d1acb..b3470aeed569 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -287,21 +287,40 @@ export class HuiTileCard extends LitElement implements LovelaceCard { @eventOptions({ passive: true }) private handleRippleActivate(evt?: Event) { + if (!this.hasCardAction) return; this._rippleHandlers.startPress(evt); } private handleRippleDeactivate() { + if (!this.hasCardAction) return; this._rippleHandlers.endPress(); } private handleRippleMouseEnter() { + if (!this.hasCardAction) return; this._rippleHandlers.startHover(); } private handleRippleMouseLeave() { + if (!this.hasCardAction) return; this._rippleHandlers.endHover(); } + get hasCardAction() { + return ( + !this._config?.tap_action || + hasAction(this._config?.tap_action) || + hasAction(this._config?.hold_action) || + hasAction(this._config?.double_tap_action) + ); + } + + get hasIconAction() { + return ( + !this._config?.icon_tap_action || hasAction(this._config?.icon_tap_action) + ); + } + protected render() { if (!this._config || !this.hass) { return nothing; @@ -368,8 +387,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard { hasHold: hasAction(this._config!.hold_action), hasDoubleClick: hasAction(this._config!.double_tap_action), })} - role="button" - tabindex="0" + role=${ifDefined(this.hasCardAction ? "button" : undefined)} + tabindex=${ifDefined(this.hasCardAction ? "0" : undefined)} aria-labelledby="info" @mousedown=${this.handleRippleActivate} @mouseup=${this.handleRippleDeactivate} @@ -386,8 +405,8 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
From 62dafac72b2c4fcc3975122aaa2c390dc1abcc80 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 3 Jan 2024 14:26:40 +0100 Subject: [PATCH 020/356] Display edit button for climate fan mode feature (#19259) --- .../lovelace/editor/config-elements/hui-card-features-editor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts b/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts index 49290ba57102..8693be890d8d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts @@ -81,6 +81,7 @@ const EDITABLES_FEATURE_TYPES = new Set([ "humidifier-modes", "water-heater-operation-modes", "lawn-mower-commands", + "climate-fan-modes", "climate-preset-modes", "numeric-input", "update-actions", From 2c69fe8c53cca9b1d3a1cda718b16cb06f8d23d4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 14:58:36 +0100 Subject: [PATCH 021/356] Fix checking todo item that dont support due date (#19262) * Fix checking todo item that dont support due date * make cleaner * Revert "make cleaner" This reverts commit fa33b3361451dd334d9f69142f9754a1ea2c1ca4. * Update dialog-todo-item-editor.ts * do check in 1 place --- src/data/todo.ts | 12 +++++++++--- src/panels/lovelace/cards/hui-todo-list-card.ts | 3 ++- src/panels/todo/dialog-todo-item-editor.ts | 12 +++++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/data/todo.ts b/src/data/todo.ts index 9af8ef0f4cc6..659c8d0c3c24 100644 --- a/src/data/todo.ts +++ b/src/data/todo.ts @@ -83,9 +83,12 @@ export const updateItem = ( item: item.uid, rename: item.summary, status: item.status, - description: item.description || null, + description: item.description, due_datetime: item.due?.includes("T") ? item.due : undefined, - due_date: item.due?.includes("T") ? undefined : item.due || null, + due_date: + item.due === undefined || item.due?.includes("T") + ? undefined + : item.due, }, { entity_id } ); @@ -102,7 +105,10 @@ export const createItem = ( item: item.summary, description: item.description || undefined, due_datetime: item.due?.includes("T") ? item.due : undefined, - due_date: item.due?.includes("T") ? undefined : item.due, + due_date: + item.due === undefined || item.due?.includes("T") + ? undefined + : item.due, }, { entity_id } ); diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index 3352f7a42b43..d1d62880f8ed 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -476,7 +476,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { return; } await updateItem(this.hass!, this._entityId!, { - ...item, + uid: item.uid, + summary: item.summary, status: item.status === TodoItemStatus.NeedsAction ? TodoItemStatus.Completed diff --git a/src/panels/todo/dialog-todo-item-editor.ts b/src/panels/todo/dialog-todo-item-editor.ts index cd26ad35fc28..daa5eff68627 100644 --- a/src/panels/todo/dialog-todo-item-editor.ts +++ b/src/panels/todo/dialog-todo-item-editor.ts @@ -324,14 +324,20 @@ class DialogTodoItemEditor extends LitElement { (this._todoListSupportsFeature( TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM ) - ? // backend should accept null to clear the field, but it doesn't now - null + ? null : undefined), due: this._due ? this._hasTime ? this._due.toISOString() : this._formatDate(this._due) - : null, + : this._todoListSupportsFeature( + TodoListEntityFeature.SET_DUE_DATETIME_ON_ITEM + ) || + this._todoListSupportsFeature( + TodoListEntityFeature.SET_DUE_DATE_ON_ITEM + ) + ? null + : undefined, status: this._checked ? TodoItemStatus.Completed : TodoItemStatus.NeedsAction, From 288d173a4d2fcf4ec665e4fffee4015550dafa67 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 15:02:14 +0100 Subject: [PATCH 022/356] Bumped version to 20240103.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f43e4cf0dc55..b1f2ee8ea705 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240103.0" +version = "20240103.3" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From fef2c44cb8ffe4ff3b0827365da3ba068e193ad3 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 17:43:37 +0100 Subject: [PATCH 023/356] Bumped version to 20240104.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b1f2ee8ea705..d9414825fabf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240103.3" +version = "20240104.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 030566c1e849997c3ec39ec82c6b86ac9c2048fc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:45:46 -0500 Subject: [PATCH 024/356] Update dependency marked to v11.1.1 (#19254) --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3f4e61c24329..0d2a855179f1 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "leaflet-draw": "1.0.4", "lit": "2.8.0", "luxon": "3.4.4", - "marked": "11.1.0", + "marked": "11.1.1", "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 510c103b2e84..3997cc2fa300 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9679,7 +9679,7 @@ __metadata: luxon: "npm:3.4.4" magic-string: "npm:0.30.5" map-stream: "npm:0.0.7" - marked: "npm:11.1.0" + marked: "npm:11.1.1" memoize-one: "npm:6.0.0" mocha: "npm:10.2.0" node-vibrant: "npm:3.2.1-alpha.1" @@ -11655,12 +11655,12 @@ __metadata: languageName: node linkType: hard -"marked@npm:11.1.0": - version: 11.1.0 - resolution: "marked@npm:11.1.0" +"marked@npm:11.1.1": + version: 11.1.1 + resolution: "marked@npm:11.1.1" bin: marked: bin/marked.js - checksum: 4636b16283c1963a715e97578d9fd91588b11949276e633a4de53dc408bcdab7b846d2b5c2cf3239f6d2dc8affe5294a0895954b5e3d9562d77301d8847a8915 + checksum: c2e15a330ac75cca2e12e25aae09985a78ad7e96a84418964dcdd3ee776764a38812dc0e94e9fcbacac43113d1650ca7946f9dc0bab800d72181e56a37e7631e languageName: node linkType: hard From 0b20725f5f42824d67168714f50632fd11e013bc Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:36:59 -0800 Subject: [PATCH 025/356] Fix select view dialog (#19267) * Fix select view dialog * add import --- .../select-view/hui-dialog-select-view.ts | 21 ++++++++++++++----- src/translations/en.json | 4 +++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts index 6a9c8eb04fdc..5f3e073f3a4f 100644 --- a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts +++ b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts @@ -8,6 +8,7 @@ import { stopPropagation } from "../../../../common/dom/stop_propagation"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-icon"; import "../../../../components/ha-select"; +import "../../../../components/ha-alert"; import { fetchConfig, LovelaceConfig, @@ -104,8 +105,15 @@ export class HuiDialogSelectView extends LitElement { })} ` : ""} - ${this._config - ? this._config.views.length > 1 + ${!this._config || (this._config.views || []).length < 1 + ? html`${this.hass.localize( + this._config + ? "ui.panel.lovelace.editor.select_view.no_views" + : "ui.panel.lovelace.editor.select_view.no_config" + )}` + : this._config.views.length > 1 ? html` ${this._config.views.map( @@ -125,8 +133,7 @@ export class HuiDialogSelectView extends LitElement { )} ` - : "" - : html`
No config found.
`} + : ""} ${this.hass!.localize("ui.common.cancel")} - + ${this._params.actionLabel || this.hass!.localize("ui.common.move")} diff --git a/src/translations/en.json b/src/translations/en.json index 53306cd8b77d..74467bcbf1ab 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5020,7 +5020,9 @@ "select_view": { "header": "Choose a view", "dashboard_label": "Dashboard", - "views_label": "View" + "views_label": "View", + "no_config": "No config found.", + "no_views": "No views in this dashboard." }, "suggest_card": { "header": "We created a suggestion for you", From efddbfcfa0941eccce4565a30c12dd689c7d6624 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 03:21:42 +0100 Subject: [PATCH 026/356] Fix circular progress size + fix bug in assist pipeline debug (#19268) --- src/auth/ha-auth-textfield.ts | 2 +- src/components/media-player/ha-media-upload-button.ts | 2 +- src/panels/config/repairs/dialog-system-information.ts | 2 +- .../voice-assistants/debug/assist-pipeline-run-debug.ts | 7 +++++-- .../voice-assistants/debug/assist-render-pipeline-run.ts | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/auth/ha-auth-textfield.ts b/src/auth/ha-auth-textfield.ts index 123deef03fe9..20d5e66174c8 100644 --- a/src/auth/ha-auth-textfield.ts +++ b/src/auth/ha-auth-textfield.ts @@ -47,7 +47,7 @@ export class HaAuthTextField extends HaTextField { // TODO: live() directive needs casting for lit-analyzer // https://github.com/runem/lit-analyzer/pull/91/files // TODO: lit-analyzer labels min/max as (number|string) instead of string - return html` 0 ? html` `; } else if (info.type === "failed") { diff --git a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts index 67b902ba6581..f7df3507fa4e 100644 --- a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts +++ b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts @@ -247,7 +247,7 @@ export class AssistPipelineRunDebug extends LitElement { } // Play audio when we're done. - if (updatedRun.stage === "done") { + if (updatedRun.stage === "done" && !updatedRun.error) { const url = updatedRun.tts!.tts_output!.url; const audio = new Audio(url); audio.addEventListener("ended", () => { @@ -261,7 +261,10 @@ export class AssistPipelineRunDebug extends LitElement { } }); audio.play(); - } else if (updatedRun.stage === "error") { + } else if ( + (updatedRun.stage === "done" && updatedRun.error) || + updatedRun.stage === "error" + ) { this._finished = true; } }, 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 05da128692af..ae455152beb0 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 @@ -90,7 +90,7 @@ const renderProgress = ( return html`❌`; } return html` - + `; } From 32fd8270d77ce80be6944d40807bcf6a6dcf1a07 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 03:27:30 +0100 Subject: [PATCH 027/356] Fix turning valve on/off (#19269) --- src/common/const.ts | 1 + src/panels/lovelace/common/entity/turn-on-off-entity.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/common/const.ts b/src/common/const.ts index 68f4fa97b1c1..bc114f2f1703 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -272,6 +272,7 @@ export const DOMAINS_TOGGLE = new Set([ "group", "automation", "humidifier", + "valve", ]); /** Domains that have a dynamic entity image / picture. */ diff --git a/src/panels/lovelace/common/entity/turn-on-off-entity.ts b/src/panels/lovelace/common/entity/turn-on-off-entity.ts index 701c2c4996ab..5be6beaea844 100644 --- a/src/panels/lovelace/common/entity/turn-on-off-entity.ts +++ b/src/panels/lovelace/common/entity/turn-on-off-entity.ts @@ -24,6 +24,9 @@ export const turnOnOffEntity = ( case "scene": service = "turn_on"; break; + case "valve": + service = turnOn ? "open_valve" : "close_valve"; + break; default: service = turnOn ? "turn_on" : "turn_off"; } From 8d541595b80638dc9ff5f4762bb243a8d77cce87 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 4 Jan 2024 10:54:20 +0100 Subject: [PATCH 028/356] Update getStates to support valves (#19277) --- src/common/entity/get_states.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/entity/get_states.ts b/src/common/entity/get_states.ts index 29c11ca48c42..456ce27bcea5 100644 --- a/src/common/entity/get_states.ts +++ b/src/common/entity/get_states.ts @@ -50,6 +50,7 @@ export const FIXED_DOMAIN_STATES = { timer: ["active", "idle", "paused"], update: ["on", "off"], vacuum: ["cleaning", "docked", "error", "idle", "paused", "returning"], + valve: ["closed", "closing", "open", "opening"], weather: [ "clear-night", "cloudy", From f147a5e909bc94e6bc1ed5364d9ac8791e2002a2 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 11:52:38 +0100 Subject: [PATCH 029/356] fix valve entities row (#19278) --- src/common/const.ts | 1 + src/data/valve.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/const.ts b/src/common/const.ts index bc114f2f1703..2e7d2f7c77d7 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -254,6 +254,7 @@ export const DOMAINS_INPUT_ROW = [ "text", "time", "vacuum", + "valve", ]; /** States that we consider "off". */ diff --git a/src/data/valve.ts b/src/data/valve.ts index 73f5d428ae18..645ca82e4954 100644 --- a/src/data/valve.ts +++ b/src/data/valve.ts @@ -14,14 +14,20 @@ export const enum ValveEntityFeature { } export function isFullyOpen(stateObj: ValveEntity) { - if (stateObj.attributes.current_position !== undefined) { + if ( + stateObj.attributes.current_position !== undefined && + stateObj.attributes.current_position !== null + ) { return stateObj.attributes.current_position === 100; } return stateObj.state === "open"; } export function isFullyClosed(stateObj: ValveEntity) { - if (stateObj.attributes.current_position !== undefined) { + if ( + stateObj.attributes.current_position !== undefined && + stateObj.attributes.current_position !== null + ) { return stateObj.attributes.current_position === 0; } return stateObj.state === "closed"; From a1cf18468b2bafade0bbb4f4e0552bdc1fd955b3 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 13:20:35 +0100 Subject: [PATCH 030/356] Remove overflow hidden from profile (#19279) --- src/panels/profile/ha-panel-profile.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/panels/profile/ha-panel-profile.ts b/src/panels/profile/ha-panel-profile.ts index 1756af4d9333..9e82e842df5f 100644 --- a/src/panels/profile/ha-panel-profile.ts +++ b/src/panels/profile/ha-panel-profile.ts @@ -250,7 +250,6 @@ class HaPanelProfile extends LitElement { max-width: 600px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); - overflow: hidden; } .content > * { From a31b9f1b4d952353a3f61b5905fdf6ee1eeec8ef Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 Jan 2024 14:24:33 +0100 Subject: [PATCH 031/356] Fix due date when no time in certain timezones (#19280) * Fix due date when no time in certain timezones * Update dialog-todo-item-editor.ts --- src/panels/lovelace/cards/hui-todo-list-card.ts | 2 +- src/panels/todo/dialog-todo-item-editor.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index d1d62880f8ed..1d1c6b6c8243 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -335,7 +335,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { const due = item.due ? item.due.includes("T") ? new Date(item.due) - : endOfDay(new Date(item.due)) + : endOfDay(new Date(`${item.due}T00:00:00`)) : undefined; const today = due && !item.due!.includes("T") && isSameDay(new Date(), due); diff --git a/src/panels/todo/dialog-todo-item-editor.ts b/src/panels/todo/dialog-todo-item-editor.ts index daa5eff68627..be03e260eccf 100644 --- a/src/panels/todo/dialog-todo-item-editor.ts +++ b/src/panels/todo/dialog-todo-item-editor.ts @@ -60,8 +60,10 @@ class DialogTodoItemEditor extends LitElement { this._checked = entry.status === TodoItemStatus.Completed; this._summary = entry.summary; this._description = entry.description || ""; - this._due = entry.due ? new Date(entry.due) : undefined; this._hasTime = entry.due?.includes("T") || false; + this._due = entry.due + ? new Date(this._hasTime ? entry.due : `${entry.due}T00:00:00`) + : undefined; } else { this._hasTime = false; this._checked = false; From 456c011f3edc0e31e3c49434dfaf37f3f715d485 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 4 Jan 2024 16:18:16 +0100 Subject: [PATCH 032/356] Fix thermostat and humidifier card rendering when off (#19281) * Fix thermostat and humidifier card rendering when off * Fix action color --- .../ha-state-control-climate-temperature.ts | 43 +++++++++++++------ .../ha-state-control-humidifier-humidity.ts | 37 ++++++++++++---- .../state-control-circular-slider-style.ts | 13 +++++- 3 files changed, 71 insertions(+), 22 deletions(-) diff --git a/src/state-control/climate/ha-state-control-climate-temperature.ts b/src/state-control/climate/ha-state-control-climate-temperature.ts index 7634fd2f2d18..0264af5ec7b3 100644 --- a/src/state-control/climate/ha-state-control-climate-temperature.ts +++ b/src/state-control/climate/ha-state-control-climate-temperature.ts @@ -177,11 +177,20 @@ export class HaStateControlClimateTemperature extends LitElement { const action = this.stateObj.attributes.hvac_action; + const isTemperatureDisplayed = + (this.stateObj.attributes.current_temperature != null && + this.showCurrentAsPrimary) || + ((this._supportsTargetTemperature || + this._supportsTargetTemperatureRange) && + !this.showCurrentAsPrimary); + return html`

- ${action + ${action && action !== "off" ? this.hass.formatEntityAttributeValue(this.stateObj, "hvac_action") - : this.hass.formatEntityState(this.stateObj)} + : isTemperatureDisplayed + ? this.hass.formatEntityState(this.stateObj) + : nothing}

`; } @@ -315,6 +324,14 @@ export class HaStateControlClimateTemperature extends LitElement { `; } + if (this.stateObj.state !== UNAVAILABLE) { + return html` +

+ ${this.hass.formatEntityState(this.stateObj)} +

+ `; + } + return nothing; } @@ -373,6 +390,14 @@ export class HaStateControlClimateTemperature extends LitElement { return html`

`; } + private _renderInfo() { + return html` +
+ ${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()} +
+ `; + } + get _supportsTargetTemperature() { return ( supportsFeature(this.stateObj, ClimateEntityFeature.TARGET_TEMPERATURE) && @@ -447,10 +472,7 @@ export class HaStateControlClimateTemperature extends LitElement { @value-changing=${this._valueChanging} > -
- ${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()} -
- ${this._renderTemperatureButtons("value")} + ${this._renderInfo()} ${this._renderTemperatureButtons("value")}
`; } @@ -484,9 +506,7 @@ export class HaStateControlClimateTemperature extends LitElement { @high-changing=${this._valueChanging} > -
- ${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()} -
+ ${this._renderInfo()} ${this._renderTemperatureButtons(this._selectTargetTemperature, true)}
`; @@ -497,6 +517,7 @@ export class HaStateControlClimateTemperature extends LitElement { class="container${containerSizeClass}" style=${styleMap({ "--state-color": stateColor, + "--action-color": actionColor, })} > -
- ${this._renderLabel()} ${this._renderSecondary()} -
+ ${this._renderInfo()}
`; } diff --git a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts index 6078180cd849..459e8d611730 100644 --- a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts +++ b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts @@ -105,11 +105,18 @@ export class HaStateControlHumidifierHumidity extends LitElement { const action = this.stateObj.attributes.action; + const isHumidityDisplayed = + (this.stateObj.attributes.current_humidity != null && + this.showCurrentAsPrimary) || + (this._targetHumidity != null && !this.showCurrentAsPrimary); + return html`

- ${action + ${action && action !== "off" ? this.hass.formatEntityAttributeValue(this.stateObj, "action") - : this.hass.formatEntityState(this.stateObj)} + : isHumidityDisplayed + ? this.hass.formatEntityState(this.stateObj) + : nothing}

`; } @@ -144,6 +151,14 @@ export class HaStateControlHumidifierHumidity extends LitElement { return this._renderTarget(this._targetHumidity!, "big"); } + if (this.stateObj.state !== UNAVAILABLE) { + return html` +

+ ${this.hass.formatEntityState(this.stateObj)} +

+ `; + } + return nothing; } @@ -225,6 +240,14 @@ export class HaStateControlHumidifierHumidity extends LitElement { `; } + private _renderInfo() { + return html` +
+ ${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()} +
+ `; + } + protected render() { const stateColor = stateColorCss(this.stateObj); const active = stateActive(this.stateObj); @@ -272,10 +295,7 @@ export class HaStateControlHumidifierHumidity extends LitElement { @value-changing=${this._valueChanging} > -
- ${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()} -
- ${this._renderButtons()} + ${this._renderInfo()} ${this._renderButtons()}
`; } @@ -284,6 +304,7 @@ export class HaStateControlHumidifierHumidity extends LitElement {
@@ -296,9 +317,7 @@ export class HaStateControlHumidifierHumidity extends LitElement { disabled > -
- ${this._renderLabel()} ${this._renderSecondary()} -
+ ${this._renderInfo()}
`; } diff --git a/src/state-control/state-control-circular-slider-style.ts b/src/state-control/state-control-circular-slider-style.ts index cc1c9366d7e9..b5d4d5281a03 100644 --- a/src/state-control/state-control-circular-slider-style.ts +++ b/src/state-control/state-control-circular-slider-style.ts @@ -54,7 +54,6 @@ export const stateControlCircularSliderStyle = css` .label.disabled { color: var(--secondary-text-color); } - .buttons { position: absolute; bottom: 10px; @@ -67,6 +66,9 @@ export const stateControlCircularSliderStyle = css` align-items: center; justify-content: center; } + .primary-state { + font-size: 36px; + } .buttons ha-outlined-icon-button { --md-outlined-icon-button-container-width: 48px; @@ -77,6 +79,9 @@ export const stateControlCircularSliderStyle = css` .container.md ha-big-number { font-size: 44px; } + .container.md .state { + font-size: 30px; + } .container.md .info { margin-top: 12px; gap: 6px; @@ -91,6 +96,9 @@ export const stateControlCircularSliderStyle = css` .container.sm ha-big-number { font-size: 32px; } + .container.sm .state { + font-size: 26px; + } .container.sm .info { margin-top: 12px; font-size: 14px; @@ -107,6 +115,9 @@ export const stateControlCircularSliderStyle = css` .container.xs ha-big-number { font-size: 32px; } + .container.xs .state { + font-size: 16px; + } .container.xs .info { margin-top: 12px; } From a8b48b46193e9d99933a3a224e1eb8e3bdc756f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 21 Jan 2024 06:09:59 +0000 Subject: [PATCH 033/356] Update dependency prettier to v3.2.4 (#19483) * Update dependency prettier to v3.2.4 * Reformat --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Steve Repsher --- .devcontainer/devcontainer.json | 18 +++++++++--------- package.json | 2 +- tsconfig.json | 12 ++++++------ yarn.lock | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d4af4fbebabf..ca5bb5e97d06 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,12 +2,12 @@ "name": "Home Assistant Frontend", "build": { "dockerfile": "Dockerfile", - "context": ".." + "context": "..", }, "appPort": "8124:8123", "postStartCommand": "script/bootstrap", "containerEnv": { - "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" + "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}", }, "customizations": { "vscode": { @@ -16,7 +16,7 @@ "esbenp.prettier-vscode", "runem.lit-plugin", "github.vscode-pull-request-github", - "eamodio.gitlens" + "eamodio.gitlens", ], "settings": { "files.eol": "\n", @@ -27,17 +27,17 @@ "editor.renderWhitespace": "boundary", "editor.rulers": [80], "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", }, "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", }, "files.trimTrailingWhitespace": true, "terminal.integrated.shell.linux": "/usr/bin/zsh", "gitlens.showWelcomeOnInstall": false, "gitlens.showWhatsNewAfterUpgrades": false, - "workbench.startupEditor": "none" - } - } - } + "workbench.startupEditor": "none", + }, + }, + }, } diff --git a/package.json b/package.json index 8ead92888281..039b7750e0ab 100644 --- a/package.json +++ b/package.json @@ -224,7 +224,7 @@ "object-hash": "3.0.0", "open": "10.0.3", "pinst": "3.0.0", - "prettier": "3.2.2", + "prettier": "3.2.4", "rollup": "2.79.1", "rollup-plugin-string": "3.0.0", "rollup-plugin-terser": "7.0.2", diff --git a/tsconfig.json b/tsconfig.json index 53cdd2dd9326..0c67e5a2b2e7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,13 +43,13 @@ "no-incompatible-property-type": "warning", "no-property-visibility-mismatch": "error", // CSS - "no-invalid-css": "off" // warning does not work + "no-invalid-css": "off", // warning does not work }, "globalTags": ["google-cast-launcher"], "customHtmlData": [ - "./node_modules/@lrnwebcomponents/simple-tooltip/custom-elements.json" - ] - } - ] - } + "./node_modules/@lrnwebcomponents/simple-tooltip/custom-elements.json", + ], + }, + ], + }, } diff --git a/yarn.lock b/yarn.lock index 9192d23858f4..f1e65b21dc16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9634,7 +9634,7 @@ __metadata: object-hash: "npm:3.0.0" open: "npm:10.0.3" pinst: "npm:3.0.0" - prettier: "npm:3.2.2" + prettier: "npm:3.2.4" proxy-polyfill: "npm:0.3.2" punycode: "npm:2.3.1" qr-scanner: "npm:1.4.2" @@ -13081,12 +13081,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:3.2.2": - version: 3.2.2 - resolution: "prettier@npm:3.2.2" +"prettier@npm:3.2.4": + version: 3.2.4 + resolution: "prettier@npm:3.2.4" bin: prettier: bin/prettier.cjs - checksum: ab9470ff6cfd19f28bc424f22e58f2fc4a488d148b9384f6c3739235017c8350cae82b3697392c23d9b098b9d8dfaa1cc9ff4ef25fd45f54c97b95f9cc7a1f7d + checksum: e2b735d0552501b3a7ac8bd3ba3b6de2920bb35bd4cd02d08cb9057ebe3e96d83b9a7e4b903d987b7530a50223b12c74d107c154337236ae2c68156ba1e65cd2 languageName: node linkType: hard From 55a5739e77ca8989eeda7ae3cdb384e24d21beae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:26:07 -0500 Subject: [PATCH 034/356] Update dependency @babel/helper-define-polyfill-provider to v0.5.0 (#19496) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 039b7750e0ab..8c7d0e78a096 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ }, "devDependencies": { "@babel/core": "7.23.7", - "@babel/helper-define-polyfill-provider": "0.4.4", + "@babel/helper-define-polyfill-provider": "0.5.0", "@babel/plugin-proposal-decorators": "7.23.7", "@babel/plugin-transform-runtime": "7.23.7", "@babel/preset-env": "7.23.8", diff --git a/yarn.lock b/yarn.lock index f1e65b21dc16..d9323887f27c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -160,9 +160,9 @@ __metadata: languageName: node linkType: hard -"@babel/helper-define-polyfill-provider@npm:0.4.4, @babel/helper-define-polyfill-provider@npm:^0.4.4": - version: 0.4.4 - resolution: "@babel/helper-define-polyfill-provider@npm:0.4.4" +"@babel/helper-define-polyfill-provider@npm:0.5.0, @babel/helper-define-polyfill-provider@npm:^0.5.0": + version: 0.5.0 + resolution: "@babel/helper-define-polyfill-provider@npm:0.5.0" dependencies: "@babel/helper-compilation-targets": "npm:^7.22.6" "@babel/helper-plugin-utils": "npm:^7.22.5" @@ -171,13 +171,13 @@ __metadata: resolve: "npm:^1.14.2" peerDependencies: "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: 16c312e40ecf2ead81f3ab7275387079071012d2363022c04cf16d56fe0d781185f3a517b928f4556c716ae45e0567b817b636d5cd2fee8fb2ce2b18a04c5bcd + checksum: f849e816ec4b182a3e8fa8e09ff016f88bb95259cd6b2190b815c48f83c3d3b68e973a8ec72acc5086bfe93705cbd46ec089c06476421d858597780e42235a03 languageName: node linkType: hard -"@babel/helper-define-polyfill-provider@npm:^0.5.0": - version: 0.5.0 - resolution: "@babel/helper-define-polyfill-provider@npm:0.5.0" +"@babel/helper-define-polyfill-provider@npm:^0.4.4": + version: 0.4.4 + resolution: "@babel/helper-define-polyfill-provider@npm:0.4.4" dependencies: "@babel/helper-compilation-targets": "npm:^7.22.6" "@babel/helper-plugin-utils": "npm:^7.22.5" @@ -186,7 +186,7 @@ __metadata: resolve: "npm:^1.14.2" peerDependencies: "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 - checksum: f849e816ec4b182a3e8fa8e09ff016f88bb95259cd6b2190b815c48f83c3d3b68e973a8ec72acc5086bfe93705cbd46ec089c06476421d858597780e42235a03 + checksum: 16c312e40ecf2ead81f3ab7275387079071012d2363022c04cf16d56fe0d781185f3a517b928f4556c716ae45e0567b817b636d5cd2fee8fb2ce2b18a04c5bcd languageName: node linkType: hard @@ -9464,7 +9464,7 @@ __metadata: resolution: "home-assistant-frontend@workspace:." dependencies: "@babel/core": "npm:7.23.7" - "@babel/helper-define-polyfill-provider": "npm:0.4.4" + "@babel/helper-define-polyfill-provider": "npm:0.5.0" "@babel/plugin-proposal-decorators": "npm:7.23.7" "@babel/plugin-transform-runtime": "npm:7.23.7" "@babel/preset-env": "npm:7.23.8" From 69139b35e130715a1af6a54d9160b114b89bf3db Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 21 Jan 2024 23:07:40 +0100 Subject: [PATCH 035/356] Clean up updater remains (#19501) --- src/common/const.ts | 2 -- src/components/entity/ha-state-label-badge.ts | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/common/const.ts b/src/common/const.ts index 2e7d2f7c77d7..b770cf1d447b 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -18,7 +18,6 @@ import { mdiChatSleep, mdiClipboardList, mdiClock, - mdiCloudUpload, mdiCog, mdiCommentAlert, mdiCounter, @@ -127,7 +126,6 @@ export const FIXED_DOMAIN_ICONS = { time: mdiClock, timer: mdiTimerOutline, tts: mdiSpeakerMessage, - updater: mdiCloudUpload, vacuum: mdiRobotVacuum, wake_word: mdiChatSleep, weather: mdiWeatherPartlyCloudy, diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index 4fe1a4d60c37..48854167a510 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -174,7 +174,6 @@ export class HaStateLabelBadge extends LitElement { case "scene": case "sun": case "timer": - case "updater": return null; // @ts-expect-error we don't break and go to default case "sensor": @@ -208,7 +207,6 @@ export class HaStateLabelBadge extends LitElement { case "alarm_control_panel": case "binary_sensor": case "device_tracker": - case "updater": case "person": case "scene": case "sun": @@ -285,8 +283,7 @@ export class HaStateLabelBadge extends LitElement { --ha-label-badge-label-text-transform: none; } - ha-label-badge.binary_sensor, - ha-label-badge.updater { + ha-label-badge.binary_sensor { --ha-label-badge-color: var(--label-badge-blue); } From 3a99a7de78a2e62281d827e94d9ccfac13047377 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:59:58 +0100 Subject: [PATCH 036/356] Bump actions/upload-artifact from 4.1.0 to 4.2.0 (#19503) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/nightly.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 744fa052fcaa..95ed7776d7f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -89,7 +89,7 @@ jobs: env: IS_TEST: "true" - name: Upload bundle stats - uses: actions/upload-artifact@v4.1.0 + uses: actions/upload-artifact@v4.2.0 with: name: frontend-bundle-stats path: build/stats/*.json @@ -113,7 +113,7 @@ jobs: env: IS_TEST: "true" - name: Upload bundle stats - uses: actions/upload-artifact@v4.1.0 + uses: actions/upload-artifact@v4.2.0 with: name: supervisor-bundle-stats path: build/stats/*.json diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 4502edab9e5c..0fdf8f79a123 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -57,14 +57,14 @@ jobs: run: tar -czvf translations.tar.gz translations - name: Upload build artifacts - uses: actions/upload-artifact@v4.1.0 + uses: actions/upload-artifact@v4.2.0 with: name: wheels path: dist/home_assistant_frontend*.whl if-no-files-found: error - name: Upload translations - uses: actions/upload-artifact@v4.1.0 + uses: actions/upload-artifact@v4.2.0 with: name: translations path: translations.tar.gz From 10ad0010cf00e2b10117b61e2bfa3847f81d520d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:04:58 +0100 Subject: [PATCH 037/356] Bump actions/cache from 3.3.3 to 4.0.0 (#19502) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 95ed7776d7f9..31e4297c68e8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,7 +37,7 @@ jobs: - name: Build resources run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages - name: Setup lint cache - uses: actions/cache@v3.3.3 + uses: actions/cache@v4.0.0 with: path: | node_modules/.cache/prettier From bf4b76864dd22ce7954785c082ff80139c20b6e7 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 22 Jan 2024 13:58:35 +0100 Subject: [PATCH 038/356] Adjust check focus behaviour for todo list (#19472) * Adjust check focus behaviour for todo list * improve aria --- .../lovelace/cards/hui-todo-list-card.ts | 202 +++++++++--------- 1 file changed, 105 insertions(+), 97 deletions(-) diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index 4d286c7fd3e7..56b9cbadabed 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -224,95 +224,98 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { ` : nothing}

- ${uncheckedItems.length - ? html`
- - ${this.hass!.localize( - "ui.panel.lovelace.cards.todo-list.unchecked_items" - )} - - ${this.todoListSupportsFeature( - TodoListEntityFeature.MOVE_TODO_ITEM - ) - ? html` - - - ${this.hass!.localize( - this._reordering - ? "ui.panel.lovelace.cards.todo-list.exit_reorder_items" - : "ui.panel.lovelace.cards.todo-list.reorder_items" - )} - - - - ` - : nothing} -
- - + + + ${uncheckedItems.length + ? html` +
+

+ ${this.hass!.localize( + "ui.panel.lovelace.cards.todo-list.unchecked_items" + )} +

+ ${this.todoListSupportsFeature( + TodoListEntityFeature.MOVE_TODO_ITEM + ) + ? html` + + + ${this.hass!.localize( + this._reordering + ? "ui.panel.lovelace.cards.todo-list.exit_reorder_items" + : "ui.panel.lovelace.cards.todo-list.reorder_items" + )} + + + + ` + : nothing} +
${this._renderItems(uncheckedItems, unavailable)} -
-
` - : html`

- ${this.hass.localize( - "ui.panel.lovelace.cards.todo-list.no_unchecked_items" - )} -

`} - ${checkedItems.length - ? html` -
-
- - ${this.hass!.localize( - "ui.panel.lovelace.cards.todo-list.checked_items" + ` + : html`

+ ${this.hass.localize( + "ui.panel.lovelace.cards.todo-list.no_unchecked_items" )} - - ${this.todoListSupportsFeature( - TodoListEntityFeature.DELETE_TODO_ITEM - ) - ? html` - - +

`} + ${checkedItems.length + ? html` +
+
+
+

${this.hass!.localize( - "ui.panel.lovelace.cards.todo-list.clear_items" + "ui.panel.lovelace.cards.todo-list.checked_items" )} - - - - ` - : nothing} -

- - ${this._renderItems(checkedItems, unavailable)} - - ` - : ""} + + ${this.todoListSupportsFeature( + TodoListEntityFeature.DELETE_TODO_ITEM + ) + ? html` + + + ${this.hass!.localize( + "ui.panel.lovelace.cards.todo-list.clear_items" + )} + + + + ` + : nothing} +
+
+ ${this._renderItems(checkedItems, unavailable)} + ` + : ""} +
+
`; } @@ -344,6 +347,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { left .hasMeta=${showReorder || showDelete} class="editRow ${classMap({ + draggable: item.status === TodoItemStatus.NeedsAction, completed: item.status === TodoItemStatus.Completed, multiline: Boolean(item.description || item.due), })}" @@ -471,6 +475,12 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { } private async _completeItem(ev): Promise { + let focusedIndex: number | undefined; + let list: List | undefined; + if (ev.type === "keydown") { + list = this.renderRoot.querySelector("mwc-list")!; + focusedIndex = list.getFocusedItemIndex(); + } const item = this._getItem(ev.currentTarget.itemId); if (!item) { return; @@ -483,17 +493,11 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { ? TodoItemStatus.Completed : TodoItemStatus.NeedsAction, }); - await this.updateComplete; - const newList: List = this.shadowRoot!.querySelector( - item.status === TodoItemStatus.NeedsAction ? "#checked" : "#unchecked" - )!; - await newList.updateComplete; - const items = - item.status === TodoItemStatus.NeedsAction - ? this._getCheckedItems(this._items) - : this._getUncheckedItems(this._items); - const index = items.findIndex((itm) => itm.uid === item.uid); - newList.focusItemAtIndex(index); + if (focusedIndex !== undefined && list) { + await this.updateComplete; + await list.updateComplete; + list.focusItemAtIndex(focusedIndex); + } } private async _clearCompletedItems(): Promise { @@ -562,6 +566,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { } private async _moveItem(oldIndex: number, newIndex: number) { + // correct index for header + oldIndex -= 1; + newIndex -= 1; const uncheckedItems = this._getUncheckedItems(this._items); const item = uncheckedItems[oldIndex]; let prevItem: TodoItem | undefined; @@ -630,8 +637,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard { direction: var(--direction); } - .header span { + .header h2 { color: var(--primary-text-color); + font-size: inherit; font-weight: 500; } From fffed0f5e13fb42ddb25805bb2d315a1dba77345 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:21:23 -0500 Subject: [PATCH 039/356] Update vaadinWebComponents monorepo to v24.3.4 (#19506) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 +- yarn.lock | 170 +++++++++++++++++++++++++-------------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/package.json b/package.json index 8c7d0e78a096..dd772f74e0f2 100644 --- a/package.json +++ b/package.json @@ -89,8 +89,8 @@ "@polymer/paper-toast": "3.0.1", "@polymer/polymer": "3.5.1", "@thomasloven/round-slider": "0.6.0", - "@vaadin/combo-box": "24.3.3", - "@vaadin/vaadin-themable-mixin": "24.3.3", + "@vaadin/combo-box": "24.3.4", + "@vaadin/vaadin-themable-mixin": "24.3.4", "@vibrant/color": "3.2.1-alpha.1", "@vibrant/core": "3.2.1-alpha.1", "@vibrant/quantizer-mmcq": "3.2.1-alpha.1", diff --git a/yarn.lock b/yarn.lock index d9323887f27c..b44ea0d1f164 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4660,128 +4660,128 @@ __metadata: languageName: node linkType: hard -"@vaadin/a11y-base@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/a11y-base@npm:24.3.3" +"@vaadin/a11y-base@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/a11y-base@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/component-base": "npm:~24.3.3" + "@vaadin/component-base": "npm:~24.3.4" lit: "npm:^3.0.0" - checksum: fca4baa66ed32b95a4318720b2a3a94ce1f01ceb13f71a176baab79b75396f6d19e8c368fca53c64dab33742b72824dcdf93180dc4a1db6950525631d1d79c76 + checksum: ef74bdd1e20f6cb131f613ffabf3099170c9713fcc3d7bd54c5471dfa3c355adba84befff585981420bb4525943b30830bff8b3c32db864edd80f720dd8ca723 languageName: node linkType: hard -"@vaadin/combo-box@npm:24.3.3": - version: 24.3.3 - resolution: "@vaadin/combo-box@npm:24.3.3" +"@vaadin/combo-box@npm:24.3.4": + version: 24.3.4 + resolution: "@vaadin/combo-box@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/a11y-base": "npm:~24.3.3" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/field-base": "npm:~24.3.3" - "@vaadin/input-container": "npm:~24.3.3" - "@vaadin/item": "npm:~24.3.3" - "@vaadin/lit-renderer": "npm:~24.3.3" - "@vaadin/overlay": "npm:~24.3.3" - "@vaadin/vaadin-lumo-styles": "npm:~24.3.3" - "@vaadin/vaadin-material-styles": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" - checksum: e7c4045585c0b08b5c3b6708f1c0a2664721126916926b0cfa05a6c0fa6e0ecac079616697ba08a21a9756ffdc83cb0db87cfb5892d3cfb8aecebc50c3f7c9e5 + "@vaadin/a11y-base": "npm:~24.3.4" + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/field-base": "npm:~24.3.4" + "@vaadin/input-container": "npm:~24.3.4" + "@vaadin/item": "npm:~24.3.4" + "@vaadin/lit-renderer": "npm:~24.3.4" + "@vaadin/overlay": "npm:~24.3.4" + "@vaadin/vaadin-lumo-styles": "npm:~24.3.4" + "@vaadin/vaadin-material-styles": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" + checksum: a2d08d8d64a8b88a00f4436e5df1ddba402fd8b909bcfe3647eed1b1caba9b6edc93743fbdd56b73f0b7a5e71a7ab32e38a6912e266637453b11ecb34d3cf5f8 languageName: node linkType: hard -"@vaadin/component-base@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/component-base@npm:24.3.3" +"@vaadin/component-base@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/component-base@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" "@vaadin/vaadin-development-mode-detector": "npm:^2.0.0" "@vaadin/vaadin-usage-statistics": "npm:^2.1.0" lit: "npm:^3.0.0" - checksum: 57ab8b202d21cf71ce9db3762f1024321c997a48c4f7a1c79aa6cf8c108b862fb61a831c003c06f51b649e5a5cb311cf71ea8e366fc2897adf4d80818541773e + checksum: 4411977be1e394fc03d84f026fc093393c8f511df588560b43fae4f8b360222473723a6d56b6a65cde90b1d9fba29f3e9640fa0e2a4816f1701c4a5a43a86fe3 languageName: node linkType: hard -"@vaadin/field-base@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/field-base@npm:24.3.3" +"@vaadin/field-base@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/field-base@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/a11y-base": "npm:~24.3.3" - "@vaadin/component-base": "npm:~24.3.3" + "@vaadin/a11y-base": "npm:~24.3.4" + "@vaadin/component-base": "npm:~24.3.4" lit: "npm:^3.0.0" - checksum: f19559702f0a85e27257963a2e9c176ad1a9bc83e86d3d2460fa9ba28c199bebf2bd1fde00009106cf8b854c1e6c530fc8aaf5a911a023781d45cbcc029f5963 + checksum: fda6584bb7f343665070f6db1c4c9a705e82e97d0c9e482b5dc615a07677f3bdcc7d10a182e6f8a97b16d3c698a165538feb69b3a9d317e1d6a86912a8db3179 languageName: node linkType: hard -"@vaadin/icon@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/icon@npm:24.3.3" +"@vaadin/icon@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/icon@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/vaadin-lumo-styles": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/vaadin-lumo-styles": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" lit: "npm:^3.0.0" - checksum: f08d526100c8ddcb001e9b0c64be8dfb8ea42d93092617a089252e2c3162d6ade56df98fb8112992c8e8a24e84779fca2efe7e032c4676c7a59bfacd55b69943 + checksum: cb09713d42381a8a437c7485d2c71a84b91f0489e062c41abe5ae4aab9a40d0bedbb78020a8e1e847d71467a0011b2fd91944cd2eb8993d18efc98efb7dd0de1 languageName: node linkType: hard -"@vaadin/input-container@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/input-container@npm:24.3.3" +"@vaadin/input-container@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/input-container@npm:24.3.4" dependencies: "@polymer/polymer": "npm:^3.0.0" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/vaadin-lumo-styles": "npm:~24.3.3" - "@vaadin/vaadin-material-styles": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/vaadin-lumo-styles": "npm:~24.3.4" + "@vaadin/vaadin-material-styles": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" lit: "npm:^3.0.0" - checksum: fae301ac2bd31e1304a0804b727292393a46ad090ee7a1dce6ddfa8d1aabd934607848b3cfc38d4d9f887ef8c1db228e6e63068085afdd45dec0831cca57fa2d + checksum: a38155c598328f8d6ad9d41d8b36e3eef65ddb2f73cea09cd114284570b10f1564c7414f6dea4c6cc811f01f114dae8853e3188b883ea909bc23024bb7ada83c languageName: node linkType: hard -"@vaadin/item@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/item@npm:24.3.3" +"@vaadin/item@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/item@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/a11y-base": "npm:~24.3.3" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/vaadin-lumo-styles": "npm:~24.3.3" - "@vaadin/vaadin-material-styles": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" - checksum: 7a49488a543493bd9586ab85d20d8863c51c06b074581e8e7ab4aea3cfeabc32d0a8ca1352581df801726bf6ff07e5950d67ceb7a3f50cacb53185e95c4a6ad6 + "@vaadin/a11y-base": "npm:~24.3.4" + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/vaadin-lumo-styles": "npm:~24.3.4" + "@vaadin/vaadin-material-styles": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" + checksum: 9d4f1e57305febd387e476955a56c27bd55c524da60105532b39263644d2b246d578e9bf1d41d90a114919684121520007c9a881cc876ffcb79f80fcaf107374 languageName: node linkType: hard -"@vaadin/lit-renderer@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/lit-renderer@npm:24.3.3" +"@vaadin/lit-renderer@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/lit-renderer@npm:24.3.4" dependencies: lit: "npm:^3.0.0" - checksum: 56c5f6d070989405a15fabae6b1e7cd452fd8b944169a40e3e1cf07ceb106fbc4cf2e07de4b8709f6ee8306d2abc48050f11140fc3f7e3ae9691ade4de57b305 + checksum: 31283f1e8a12661fb75cae7d73cabd4a29eeaa310ae998b206b3a8f5ef0203d7d8235c75f39d848b8c9122e0b0b03bb8c889dd2f39be89d7edc84af7769a3ae2 languageName: node linkType: hard -"@vaadin/overlay@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/overlay@npm:24.3.3" +"@vaadin/overlay@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/overlay@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" "@polymer/polymer": "npm:^3.0.0" - "@vaadin/a11y-base": "npm:~24.3.3" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/vaadin-lumo-styles": "npm:~24.3.3" - "@vaadin/vaadin-material-styles": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" - checksum: 3d21ae486b4d11850850cc6bed0269adcf31f1649be3d558aa3c65849ac2090dde01c948e2e6a5d4267db12675b263e07052f51117847587f2fe97fb543f0bbd + "@vaadin/a11y-base": "npm:~24.3.4" + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/vaadin-lumo-styles": "npm:~24.3.4" + "@vaadin/vaadin-material-styles": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" + checksum: 357a446e162deb377cac3c5b4004651f7e2a882e209cc8180ebd32ba560e974a3bbfb7294dc36092ba8f8ad6946b7b8f3f2ba5afbe120d9e7630871d0cdd03f8 languageName: node linkType: hard @@ -4792,36 +4792,36 @@ __metadata: languageName: node linkType: hard -"@vaadin/vaadin-lumo-styles@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/vaadin-lumo-styles@npm:24.3.3" +"@vaadin/vaadin-lumo-styles@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/vaadin-lumo-styles@npm:24.3.4" dependencies: "@polymer/polymer": "npm:^3.0.0" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/icon": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" - checksum: f9ad5214e3fe54633345d9b580edd3f6a4dd5f630a89c4549f33f1c3edea50e245b5fa52b270e0b5f006d2b22eb7b30cd1306ff27d37006f0ac0f10c6965cedc + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/icon": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" + checksum: c04ae63de4d5ed01f8ee4a2786a47dc8cbf9b238fd2199115ac6cd63bbc110ed6c7bd3d50eb0a1d7fa2036343f63c5b475f0376b2c4c081be111a7c1b356290c languageName: node linkType: hard -"@vaadin/vaadin-material-styles@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/vaadin-material-styles@npm:24.3.3" +"@vaadin/vaadin-material-styles@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/vaadin-material-styles@npm:24.3.4" dependencies: "@polymer/polymer": "npm:^3.0.0" - "@vaadin/component-base": "npm:~24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:~24.3.3" - checksum: 8e5fd5cb4b9826d750ce971cbf7808afdf57a215866cd62b397f7b967b2aeb250a31264e7d88ba6aa16c0d68fc273ad0dcf2ab71ab0342cd0cc40422887dee1a + "@vaadin/component-base": "npm:~24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:~24.3.4" + checksum: 60f3bd1598705e822428cde7698af93bd9b025f9229af2a489005e210dc7b1a3a9bcd9f960da9b44174c03dbdb2d16a5f43062b78ab3f34acc6a8d09d9c03919 languageName: node linkType: hard -"@vaadin/vaadin-themable-mixin@npm:24.3.3, @vaadin/vaadin-themable-mixin@npm:~24.3.3": - version: 24.3.3 - resolution: "@vaadin/vaadin-themable-mixin@npm:24.3.3" +"@vaadin/vaadin-themable-mixin@npm:24.3.4, @vaadin/vaadin-themable-mixin@npm:~24.3.4": + version: 24.3.4 + resolution: "@vaadin/vaadin-themable-mixin@npm:24.3.4" dependencies: "@open-wc/dedupe-mixin": "npm:^1.3.0" lit: "npm:^3.0.0" - checksum: 7a2cc59d2f77b559c50b9a7bd1b8447c49d01b68f11fa8d7fe539059dc9a1bfc56a091105ec668bdd72b769ded38253705556912853b72d3d168d146a761491d + checksum: ad932481d1f80759e583c58926d0f8e1cf67b29f6cd2ddfe6f16af16848f6f15f91eb266c093746ddfc2b562e855972742df40ff065855a536f872738e1320e4 languageName: node linkType: hard @@ -9563,8 +9563,8 @@ __metadata: "@types/webspeechapi": "npm:0.0.29" "@typescript-eslint/eslint-plugin": "npm:6.19.0" "@typescript-eslint/parser": "npm:6.19.0" - "@vaadin/combo-box": "npm:24.3.3" - "@vaadin/vaadin-themable-mixin": "npm:24.3.3" + "@vaadin/combo-box": "npm:24.3.4" + "@vaadin/vaadin-themable-mixin": "npm:24.3.4" "@vibrant/color": "npm:3.2.1-alpha.1" "@vibrant/core": "npm:3.2.1-alpha.1" "@vibrant/quantizer-mmcq": "npm:3.2.1-alpha.1" From 5c72c38c0d466e67c36fd23bdf8b794bf4f8d9b0 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Mon, 22 Jan 2024 06:57:06 -0800 Subject: [PATCH 040/356] Revert "Add a button to delete all refresh tokens" (#19480) --- src/panels/profile/ha-refresh-tokens-card.ts | 31 -------------------- src/translations/en.json | 2 -- 2 files changed, 33 deletions(-) diff --git a/src/panels/profile/ha-refresh-tokens-card.ts b/src/panels/profile/ha-refresh-tokens-card.ts index 3523acc417e2..6217936dcb46 100644 --- a/src/panels/profile/ha-refresh-tokens-card.ts +++ b/src/panels/profile/ha-refresh-tokens-card.ts @@ -9,7 +9,6 @@ import "../../components/ha-card"; import "../../components/ha-settings-row"; import "../../components/ha-icon-button"; import { RefreshToken } from "../../data/refresh_token"; -import { deleteAllRefreshTokens } from "../../data/auth"; import { showAlertDialog, showConfirmationDialog, @@ -109,13 +108,6 @@ class HaRefreshTokens extends LitElement { ) : ""} -
- - ${this.hass.localize( - "ui.panel.profile.refresh_tokens.delete_all_tokens" - )} - -
`; } @@ -147,29 +139,6 @@ class HaRefreshTokens extends LitElement { } } - private async _deleteAllTokens(): Promise { - if ( - !(await showConfirmationDialog(this, { - text: this.hass.localize( - "ui.panel.profile.refresh_tokens.confirm_delete_all" - ), - destructive: true, - })) - ) { - return; - } - try { - await deleteAllRefreshTokens(this.hass); - } catch (err: any) { - await showAlertDialog(this, { - title: this.hass.localize( - "ui.panel.profile.refresh_tokens.delete_failed" - ), - text: err.message, - }); - } - } - static get styles(): CSSResultGroup { return [ haStyle, diff --git a/src/translations/en.json b/src/translations/en.json index 3f17573f9c45..1142a89d2371 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5843,8 +5843,6 @@ "last_used": "Last used {date} from {location}", "not_used": "Has never been used", "confirm_delete": "Are you sure you want to delete the refresh token for {name}?", - "delete_all_tokens": "Delete all tokens", - "confirm_delete_all": "Are you sure you want to delete all refresh tokens? You will be logged out as part of this operation.", "delete_failed": "Failed to delete the refresh token.", "current_token_tooltip": "Unable to delete current refresh token" }, From 28a8863f4575e5d3f0c312763eef0c9b9bb923ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 22 Jan 2024 16:03:07 +0100 Subject: [PATCH 041/356] Allow for lists inside GitHub alerts when redered in markdown (#19505) * Allow for lists inside GitHub alerts when redered in markdown * simplify --- gallery/src/pages/lovelace/markdown-card.ts | 3 +++ src/components/ha-markdown-element.ts | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gallery/src/pages/lovelace/markdown-card.ts b/gallery/src/pages/lovelace/markdown-card.ts index 576e6189c76b..aa47310b52bf 100644 --- a/gallery/src/pages/lovelace/markdown-card.ts +++ b/gallery/src/pages/lovelace/markdown-card.ts @@ -80,6 +80,9 @@ const CONFIGS = [ > [!CAUTION] > This is a GitHub caution alert + > [!TIP] + > - This is a list entry in GitHub tip alert + ## Lists Unordered diff --git a/src/components/ha-markdown-element.ts b/src/components/ha-markdown-element.ts index e282378ada7d..cd4e90c0c98a 100644 --- a/src/components/ha-markdown-element.ts +++ b/src/components/ha-markdown-element.ts @@ -98,13 +98,16 @@ class HaMarkdownElement extends ReactiveElement { firstElementChild!.childNodes[1].textContent?.trimStart()) || ""; - const childNodes = Array.from(firstElementChild!.childNodes); - for (const child of childNodes.slice( - childNodes.findIndex( - // There is always a line break between the title and the content, we want to skip that - (childNode) => childNode instanceof HTMLBRElement - ) + 1 - )) { + const childNodes = Array.from(node.childNodes) + .map((child) => Array.from(child.childNodes)) + .reduce((acc, val) => acc.concat(val), []) + .filter( + (childNode) => + childNode.textContent && + !(childNode.textContent in _gitHubBlockQuoteToAlert) && + !(childNode.textContent in _legacyGitHubBlockQuoteToAlert) + ); + for (const child of childNodes) { alertNote.appendChild(child); } node.firstElementChild!.replaceWith(alertNote); From 349344161a8c93bdf5fa6ea74a8bea69b5421e3f Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 22 Jan 2024 10:04:58 -0500 Subject: [PATCH 042/356] Fix incompatible object/array property types (2 of 3) (#19482) --- cast/src/launcher/layout/hc-cast.ts | 6 +++--- cast/src/launcher/layout/hc-layout.ts | 8 ++++---- gallery/src/components/demo-cards.ts | 2 +- gallery/src/components/demo-more-infos.ts | 2 +- .../components/supervisor-backup-content.ts | 2 +- src/auth/ha-auth-flow.ts | 2 +- src/auth/ha-pick-auth-provider.ts | 4 ++-- src/components/device/ha-device-picker.ts | 6 ++++-- src/components/device/ha-devices-picker.ts | 10 ++++++---- src/components/entity/ha-entities-picker.ts | 3 ++- src/components/entity/ha-entity-picker.ts | 3 ++- src/components/ha-aliases-editor.ts | 2 +- src/components/ha-area-picker.ts | 6 ++++-- src/components/ha-areas-picker.ts | 8 +++++--- src/components/ha-attribute-icon.ts | 2 +- src/components/ha-blueprint-picker.ts | 2 +- src/components/ha-combo-box.ts | 2 +- src/components/ha-country-picker.ts | 2 +- src/components/ha-date-range-picker.ts | 6 +++--- src/components/ha-form/ha-form-string.ts | 2 +- src/components/ha-gauge.ts | 4 ++-- src/components/ha-language-picker.ts | 2 +- src/components/ha-qr-scanner.ts | 2 +- src/components/ha-target-picker.ts | 6 ++++-- .../media-player/ha-browse-media-tts.ts | 2 +- .../media-player/ha-media-manage-button.ts | 2 +- .../media-player/ha-media-upload-button.ts | 2 +- src/layouts/hass-subpage.ts | 2 +- src/mixins/lit-localize-lite-mixin.ts | 2 +- src/onboarding/onboarding-analytics.ts | 2 +- src/onboarding/onboarding-core-config.ts | 2 +- src/onboarding/onboarding-create-user.ts | 2 +- src/onboarding/onboarding-integrations.ts | 2 +- src/onboarding/onboarding-location.ts | 2 +- src/onboarding/onboarding-welcome-links.ts | 2 +- src/onboarding/onboarding-welcome.ts | 2 +- .../mqtt/mqtt-discovery-payload.ts | 2 +- .../integration-elements/mqtt/mqtt-messages.ts | 2 +- .../components/ha-energy-validation-result.ts | 6 ++---- .../zha/zha-clusters-data-table.ts | 2 +- src/panels/config/scene/ha-config-scene.ts | 2 +- src/panels/config/scene/ha-scene-dashboard.ts | 2 +- src/panels/config/scene/ha-scene-editor.ts | 2 +- src/panels/config/script/ha-config-script.ts | 2 +- .../config/script/ha-script-field-row.ts | 4 ++-- src/panels/config/script/ha-script-fields.ts | 2 +- src/panels/config/script/ha-script-picker.ts | 2 +- src/panels/config/tags/tag-image.ts | 2 +- src/panels/custom/ha-panel-custom.ts | 2 +- .../developer-tools/event/events-list.ts | 2 +- src/panels/iframe/ha-panel-iframe.ts | 2 +- src/panels/logbook/ha-logbook.ts | 18 +++++++----------- .../lovelace/components/hui-buttons-base.ts | 3 ++- .../lovelace/components/hui-entity-editor.ts | 3 ++- .../components/hui-timestamp-display.ts | 2 +- src/panels/lovelace/ha-panel-lovelace.ts | 2 +- src/panels/lovelace/hui-editor.ts | 2 +- src/panels/profile/ha-advanced-mode-row.ts | 2 +- 58 files changed, 97 insertions(+), 89 deletions(-) diff --git a/cast/src/launcher/layout/hc-cast.ts b/cast/src/launcher/layout/hc-cast.ts index bc61a5cfd7a9..b95be048fc8a 100644 --- a/cast/src/launcher/layout/hc-cast.ts +++ b/cast/src/launcher/layout/hc-cast.ts @@ -31,11 +31,11 @@ import "./hc-layout"; @customElement("hc-cast") class HcCast extends LitElement { - @property() public auth!: Auth; + @property({ attribute: false }) public auth!: Auth; - @property() public connection!: Connection; + @property({ attribute: false }) public connection!: Connection; - @property() public castManager!: CastManager; + @property({ attribute: false }) public castManager!: CastManager; @state() private askWrite = false; diff --git a/cast/src/launcher/layout/hc-layout.ts b/cast/src/launcher/layout/hc-layout.ts index 69d788fe2134..31b336cb513e 100644 --- a/cast/src/launcher/layout/hc-layout.ts +++ b/cast/src/launcher/layout/hc-layout.ts @@ -10,13 +10,13 @@ import "../../../../src/components/ha-card"; @customElement("hc-layout") class HcLayout extends LitElement { - @property() public subtitle?: string | undefined; + @property() public subtitle?: string; - @property() public auth?: Auth; + @property({ attribute: false }) public auth?: Auth; - @property() public connection?: Connection; + @property({ attribute: false }) public connection?: Connection; - @property() public user?: HassUser; + @property({ attribute: false }) public user?: HassUser; protected render(): TemplateResult { return html` diff --git a/gallery/src/components/demo-cards.ts b/gallery/src/components/demo-cards.ts index 8080b4a7fc47..c2e117ceeb5d 100644 --- a/gallery/src/components/demo-cards.ts +++ b/gallery/src/components/demo-cards.ts @@ -10,7 +10,7 @@ import "../ha-demo-options"; @customElement("demo-cards") class DemoCards extends LitElement { - @property() public configs!: DemoCardConfig[]; + @property({ attribute: false }) public configs!: DemoCardConfig[]; @property({ attribute: false }) public hass!: HomeAssistant; diff --git a/gallery/src/components/demo-more-infos.ts b/gallery/src/components/demo-more-infos.ts index 072dca265816..af7703050c0c 100644 --- a/gallery/src/components/demo-more-infos.ts +++ b/gallery/src/components/demo-more-infos.ts @@ -11,7 +11,7 @@ import "./demo-more-info"; class DemoMoreInfos extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entities!: []; + @property({ type: Array }) public entities!: string[]; @state() private _showConfig = false; diff --git a/hassio/src/components/supervisor-backup-content.ts b/hassio/src/components/supervisor-backup-content.ts index ff67b511c023..0c76daba83d9 100644 --- a/hassio/src/components/supervisor-backup-content.ts +++ b/hassio/src/components/supervisor-backup-content.ts @@ -72,7 +72,7 @@ const _computeAddons = (addons): AddonCheckboxItem[] => export class SupervisorBackupContent extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public localize?: LocalizeFunc; + @property({ attribute: false }) public localize?: LocalizeFunc; @property({ attribute: false }) public supervisor?: Supervisor; diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index 30b0e2176a17..66a93c021c3b 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -34,7 +34,7 @@ export class HaAuthFlow extends LitElement { @property() public oauth2State?: string; - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @property({ attribute: false }) public step?: DataEntryFlowStep; diff --git a/src/auth/ha-pick-auth-provider.ts b/src/auth/ha-pick-auth-provider.ts index e26030146cf9..a814788b0a30 100644 --- a/src/auth/ha-pick-auth-provider.ts +++ b/src/auth/ha-pick-auth-provider.ts @@ -18,9 +18,9 @@ declare global { @customElement("ha-pick-auth-provider") export class HaPickAuthProvider extends LitElement { - @property() public authProviders: AuthProvider[] = []; + @property({ attribute: false }) public authProviders: AuthProvider[] = []; - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; protected render() { return html` diff --git a/src/components/device/ha-device-picker.ts b/src/components/device/ha-device-picker.ts index ed6d49e37d63..cfcd2e2d7092 100644 --- a/src/components/device/ha-device-picker.ts +++ b/src/components/device/ha-device-picker.ts @@ -84,9 +84,11 @@ export class HaDevicePicker extends LitElement { @property({ type: Array, attribute: "exclude-devices" }) public excludeDevices?: string[]; - @property() public deviceFilter?: HaDevicePickerDeviceFilterFunc; + @property({ attribute: false }) + public deviceFilter?: HaDevicePickerDeviceFilterFunc; - @property() public entityFilter?: HaDevicePickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaDevicePickerEntityFilterFunc; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/device/ha-devices-picker.ts b/src/components/device/ha-devices-picker.ts index f53af31bcd63..1133d0f5e3db 100644 --- a/src/components/device/ha-devices-picker.ts +++ b/src/components/device/ha-devices-picker.ts @@ -12,7 +12,7 @@ import type { class HaDevicesPicker extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public value?: string[]; + @property({ type: Array }) public value?: string[]; @property() public helper?: string; @@ -36,17 +36,19 @@ class HaDevicesPicker extends LitElement { @property({ type: Array, attribute: "exclude-domains" }) public excludeDomains?: string[]; - @property({ attribute: "picked-device-label" }) @property({ type: Array, attribute: "include-device-classes" }) public includeDeviceClasses?: string[]; + @property({ attribute: "picked-device-label" }) public pickedDeviceLabel?: string; @property({ attribute: "pick-device-label" }) public pickDeviceLabel?: string; - @property() public deviceFilter?: HaDevicePickerDeviceFilterFunc; + @property({ attribute: false }) + public deviceFilter?: HaDevicePickerDeviceFilterFunc; - @property() public entityFilter?: HaDevicePickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaDevicePickerEntityFilterFunc; protected render() { if (!this.hass) { diff --git a/src/components/entity/ha-entities-picker.ts b/src/components/entity/ha-entities-picker.ts index 72ea3ee8ccbc..b121e34ee434 100644 --- a/src/components/entity/ha-entities-picker.ts +++ b/src/components/entity/ha-entities-picker.ts @@ -73,7 +73,8 @@ class HaEntitiesPickerLight extends LitElement { @property({ attribute: "pick-entity-label" }) public pickEntityLabel?: string; - @property() public entityFilter?: HaEntityPickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaEntityPickerEntityFilterFunc; protected render() { if (!this.hass) { diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index f6bad8a96569..1ae47cb99a87 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -92,7 +92,8 @@ export class HaEntityPicker extends LitElement { @property({ type: Array, attribute: "exclude-entities" }) public excludeEntities?: string[]; - @property() public entityFilter?: HaEntityPickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaEntityPickerEntityFilterFunc; @property({ type: Boolean }) public hideClearIcon = false; diff --git a/src/components/ha-aliases-editor.ts b/src/components/ha-aliases-editor.ts index e466b6012379..8f45409ba789 100644 --- a/src/components/ha-aliases-editor.ts +++ b/src/components/ha-aliases-editor.ts @@ -8,7 +8,7 @@ import "./ha-multi-textfield"; class AliasesEditor extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public aliases!: string[]; + @property({ type: Array }) public aliases!: string[]; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts index fd68a8eb4b16..e3b237e8e714 100644 --- a/src/components/ha-area-picker.ts +++ b/src/components/ha-area-picker.ts @@ -88,9 +88,11 @@ export class HaAreaPicker extends LitElement { @property({ type: Array, attribute: "exclude-areas" }) public excludeAreas?: string[]; - @property() public deviceFilter?: HaDevicePickerDeviceFilterFunc; + @property({ attribute: false }) + public deviceFilter?: HaDevicePickerDeviceFilterFunc; - @property() public entityFilter?: (entity: HassEntity) => boolean; + @property({ attribute: false }) + public entityFilter?: (entity: HassEntity) => boolean; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-areas-picker.ts b/src/components/ha-areas-picker.ts index 0d36f8e3fe51..12defd8611d5 100644 --- a/src/components/ha-areas-picker.ts +++ b/src/components/ha-areas-picker.ts @@ -13,7 +13,7 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) { @property() public label?: string; - @property() public value?: string[]; + @property({ type: Array }) public value?: string[]; @property() public helper?: string; @@ -46,9 +46,11 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) { @property({ type: Array, attribute: "include-device-classes" }) public includeDeviceClasses?: string[]; - @property() public deviceFilter?: HaDevicePickerDeviceFilterFunc; + @property({ attribute: false }) + public deviceFilter?: HaDevicePickerDeviceFilterFunc; - @property() public entityFilter?: (entity: HassEntity) => boolean; + @property({ attribute: false }) + public entityFilter?: (entity: HassEntity) => boolean; @property({ attribute: "picked-area-label" }) public pickedAreaLabel?: string; diff --git a/src/components/ha-attribute-icon.ts b/src/components/ha-attribute-icon.ts index 6b2df9b436a4..682befceda76 100644 --- a/src/components/ha-attribute-icon.ts +++ b/src/components/ha-attribute-icon.ts @@ -10,7 +10,7 @@ import { attributeIconPath } from "../common/entity/attribute_icon_path"; @customElement("ha-attribute-icon") export class HaAttributeIcon extends LitElement { - @property() public hass!: HomeAssistant; + @property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public stateObj?: HassEntity; diff --git a/src/components/ha-blueprint-picker.ts b/src/components/ha-blueprint-picker.ts index 214f9599c35b..7ddbd3c0c8ea 100644 --- a/src/components/ha-blueprint-picker.ts +++ b/src/components/ha-blueprint-picker.ts @@ -24,7 +24,7 @@ class HaBluePrintPicker extends LitElement { @property() public domain: BlueprintDomain = "automation"; - @property() public blueprints?: Blueprints; + @property({ attribute: false }) public blueprints?: Blueprints; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts index 5dd9d2a21105..01b33c9a0634 100644 --- a/src/components/ha-combo-box.ts +++ b/src/components/ha-combo-box.ts @@ -95,7 +95,7 @@ export class HaComboBox extends LitElement { @property({ attribute: "item-id-path" }) public itemIdPath?: string; - @property() public renderer?: ComboBoxLitRenderer; + @property({ attribute: false }) public renderer?: ComboBoxLitRenderer; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-country-picker.ts b/src/components/ha-country-picker.ts index fea293a2b43a..55b7768c4058 100644 --- a/src/components/ha-country-picker.ts +++ b/src/components/ha-country-picker.ts @@ -269,7 +269,7 @@ export class HaCountryPicker extends LitElement { @property() public label?: string; - @property() public countries?: string[]; + @property({ type: Array }) public countries?: string[]; @property() public helper?: string; diff --git a/src/components/ha-date-range-picker.ts b/src/components/ha-date-range-picker.ts index dc9ef2f6aa2f..6984dc13fc61 100644 --- a/src/components/ha-date-range-picker.ts +++ b/src/components/ha-date-range-picker.ts @@ -47,11 +47,11 @@ export interface DateRangePickerRanges { export class HaDateRangePicker extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public startDate!: Date; + @property({ attribute: false }) public startDate!: Date; - @property() public endDate!: Date; + @property({ attribute: false }) public endDate!: Date; - @property() public ranges?: DateRangePickerRanges | false; + @property({ attribute: false }) public ranges?: DateRangePickerRanges | false; @state() private _ranges?: DateRangePickerRanges; diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index a0a1757b801d..dc9c4305e211 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -29,7 +29,7 @@ export class HaFormString extends LitElement implements HaFormElement { @property() public localizeBaseKey = "ui.components.selectors.text"; - @property() public schema!: HaFormStringSchema; + @property({ attribute: false }) public schema!: HaFormStringSchema; @property() public data!: HaFormStringData; diff --git a/src/components/ha-gauge.ts b/src/components/ha-gauge.ts index 1b2f665d0d26..9ec23558ffec 100644 --- a/src/components/ha-gauge.ts +++ b/src/components/ha-gauge.ts @@ -31,11 +31,11 @@ export class HaGauge extends LitElement { @property({ type: String }) public valueText?: string; - @property() public locale!: FrontendLocaleData; + @property({ attribute: false }) public locale!: FrontendLocaleData; @property({ type: Boolean }) public needle = false; - @property() public levels?: LevelDefinition[]; + @property({ type: Array }) public levels?: LevelDefinition[]; @property() public label = ""; diff --git a/src/components/ha-language-picker.ts b/src/components/ha-language-picker.ts index dcf0f7312d1d..c8a1e9d15b62 100644 --- a/src/components/ha-language-picker.ts +++ b/src/components/ha-language-picker.ts @@ -19,7 +19,7 @@ export class HaLanguagePicker extends LitElement { @property() public label?: string; - @property() public languages?: string[]; + @property({ type: Array }) public languages?: string[]; @property({ attribute: false }) public hass?: HomeAssistant; diff --git a/src/components/ha-qr-scanner.ts b/src/components/ha-qr-scanner.ts index fe3bc8f0f6fb..b26aae20d6ca 100644 --- a/src/components/ha-qr-scanner.ts +++ b/src/components/ha-qr-scanner.ts @@ -14,7 +14,7 @@ import type { HaTextField } from "./ha-textfield"; @customElement("ha-qr-scanner") class HaQrScanner extends LitElement { - @property() localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @state() private _cameras?: QrScanner.Camera[]; diff --git a/src/components/ha-target-picker.ts b/src/components/ha-target-picker.ts index e6a274ed1936..1604c42ce1ce 100644 --- a/src/components/ha-target-picker.ts +++ b/src/components/ha-target-picker.ts @@ -62,9 +62,11 @@ export class HaTargetPicker extends LitElement { @property({ type: Array, attribute: "include-device-classes" }) public includeDeviceClasses?: string[]; - @property() public deviceFilter?: HaDevicePickerDeviceFilterFunc; + @property({ attribute: false }) + public deviceFilter?: HaDevicePickerDeviceFilterFunc; - @property() public entityFilter?: HaEntityPickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaEntityPickerEntityFilterFunc; @property({ type: Boolean, reflect: true }) public disabled = false; diff --git a/src/components/media-player/ha-browse-media-tts.ts b/src/components/media-player/ha-browse-media-tts.ts index d93ba0c9b48a..52a43d04d073 100644 --- a/src/components/media-player/ha-browse-media-tts.ts +++ b/src/components/media-player/ha-browse-media-tts.ts @@ -33,7 +33,7 @@ declare global { class BrowseMediaTTS extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public item!: MediaPlayerItem; + @property({ attribute: false }) public item!: MediaPlayerItem; @property() public action!: MediaPlayerBrowseAction; diff --git a/src/components/media-player/ha-media-manage-button.ts b/src/components/media-player/ha-media-manage-button.ts index e777aa95dc0a..90a85482dfa4 100644 --- a/src/components/media-player/ha-media-manage-button.ts +++ b/src/components/media-player/ha-media-manage-button.ts @@ -19,7 +19,7 @@ declare global { class MediaManageButton extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() currentItem?: MediaPlayerItem; + @property({ attribute: false }) currentItem?: MediaPlayerItem; @state() _uploading = 0; diff --git a/src/components/media-player/ha-media-upload-button.ts b/src/components/media-player/ha-media-upload-button.ts index 92e7531dffe9..97a92ea17122 100644 --- a/src/components/media-player/ha-media-upload-button.ts +++ b/src/components/media-player/ha-media-upload-button.ts @@ -24,7 +24,7 @@ declare global { class MediaUploadButton extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() currentItem?: MediaPlayerItem; + @property({ attribute: false }) currentItem?: MediaPlayerItem; @state() _uploading = 0; diff --git a/src/layouts/hass-subpage.ts b/src/layouts/hass-subpage.ts index 18483e218262..9eb3549630a3 100644 --- a/src/layouts/hass-subpage.ts +++ b/src/layouts/hass-subpage.ts @@ -25,7 +25,7 @@ class HassSubpage extends LitElement { @property({ type: String, attribute: "back-path" }) public backPath?: string; - @property() public backCallback?: () => void; + @property({ attribute: false }) public backCallback?: () => void; @property({ type: Boolean, reflect: true }) public narrow = false; diff --git a/src/mixins/lit-localize-lite-mixin.ts b/src/mixins/lit-localize-lite-mixin.ts index 2259a23dfff9..7d4823d73365 100644 --- a/src/mixins/lit-localize-lite-mixin.ts +++ b/src/mixins/lit-localize-lite-mixin.ts @@ -13,7 +13,7 @@ export const litLocalizeLiteMixin = >( ) => { class LitLocalizeLiteClass extends superClass { // Initialized to empty will prevent undefined errors if called before connected to DOM. - @property() public localize: LocalizeFunc = empty; + @property({ attribute: false }) public localize: LocalizeFunc = empty; // Use browser language setup before login. @property() public language?: string = getLocalLanguage(); diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index 359fb0b031f8..4cce93b6d276 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -16,7 +16,7 @@ import { onBoardingStyles } from "./styles"; class OnboardingAnalytics extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @state() private _error?: string; diff --git a/src/onboarding/onboarding-core-config.ts b/src/onboarding/onboarding-core-config.ts index 73debff9cb40..a45b989c2020 100644 --- a/src/onboarding/onboarding-core-config.ts +++ b/src/onboarding/onboarding-core-config.ts @@ -26,7 +26,7 @@ import "./onboarding-location"; class OnboardingCoreConfig extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public onboardingLocalize!: LocalizeFunc; + @property({ attribute: false }) public onboardingLocalize!: LocalizeFunc; @state() private _working = false; diff --git a/src/onboarding/onboarding-create-user.ts b/src/onboarding/onboarding-create-user.ts index e8d50bfcc7cb..615d28930c0a 100644 --- a/src/onboarding/onboarding-create-user.ts +++ b/src/onboarding/onboarding-create-user.ts @@ -43,7 +43,7 @@ const CREATE_USER_SCHEMA: HaFormSchema[] = [ @customElement("onboarding-create-user") class OnboardingCreateUser extends LitElement { - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @property() public language!: string; diff --git a/src/onboarding/onboarding-integrations.ts b/src/onboarding/onboarding-integrations.ts index 337896b43a23..12156a6ea849 100644 --- a/src/onboarding/onboarding-integrations.ts +++ b/src/onboarding/onboarding-integrations.ts @@ -36,7 +36,7 @@ const HIDDEN_DOMAINS = new Set([ class OnboardingIntegrations extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public onboardingLocalize!: LocalizeFunc; + @property({ attribute: false }) public onboardingLocalize!: LocalizeFunc; @state() private _entries: ConfigEntry[] = []; diff --git a/src/onboarding/onboarding-location.ts b/src/onboarding/onboarding-location.ts index 77c87186d15d..e452e8a7ad29 100644 --- a/src/onboarding/onboarding-location.ts +++ b/src/onboarding/onboarding-location.ts @@ -48,7 +48,7 @@ const LOCATION_MARKER_ID = "location"; class OnboardingLocation extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public onboardingLocalize!: LocalizeFunc; + @property({ attribute: false }) public onboardingLocalize!: LocalizeFunc; @state() private _working = false; diff --git a/src/onboarding/onboarding-welcome-links.ts b/src/onboarding/onboarding-welcome-links.ts index 97dd2ab13c41..9c342e508370 100644 --- a/src/onboarding/onboarding-welcome-links.ts +++ b/src/onboarding/onboarding-welcome-links.ts @@ -19,7 +19,7 @@ import "./onboarding-welcome-link"; class OnboardingWelcomeLinks extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @property({ type: Boolean }) public mobileApp = false; diff --git a/src/onboarding/onboarding-welcome.ts b/src/onboarding/onboarding-welcome.ts index 02985f6ce86f..7b3888a0f0be 100644 --- a/src/onboarding/onboarding-welcome.ts +++ b/src/onboarding/onboarding-welcome.ts @@ -17,7 +17,7 @@ import "../components/ha-button"; class OnboardingWelcome extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public localize!: LocalizeFunc; + @property({ attribute: false }) public localize!: LocalizeFunc; @property({ type: Boolean }) public supervisor = false; diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts index f61c1995f3cc..ef9b3b74d253 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts @@ -5,7 +5,7 @@ import { classMap } from "lit/directives/class-map"; @customElement("mqtt-discovery-payload") class MQTTDiscoveryPayload extends LitElement { - @property() public payload!: Record; + @property({ attribute: false }) public payload!: Record; @property({ type: Boolean }) public showAsYaml = false; diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts index 31386b94021d..10297c5a4631 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts @@ -10,7 +10,7 @@ import { HomeAssistant } from "../../../../../../types"; class MQTTMessages extends LitElement { public hass!: HomeAssistant; - @property() public messages!: MQTTMessage[]; + @property({ attribute: false }) public messages!: MQTTMessage[]; @property() public direction!: string; diff --git a/src/panels/config/energy/components/ha-energy-validation-result.ts b/src/panels/config/energy/components/ha-energy-validation-result.ts index ba91b416e837..2a0817345a75 100644 --- a/src/panels/config/energy/components/ha-energy-validation-result.ts +++ b/src/panels/config/energy/components/ha-energy-validation-result.ts @@ -6,11 +6,9 @@ import { HomeAssistant } from "../../../../types"; @customElement("ha-energy-validation-result") class EnergyValidationMessage extends LitElement { - @property({ attribute: false }) - public hass!: HomeAssistant; + @property({ attribute: false }) public hass!: HomeAssistant; - @property() - public issues!: EnergyValidationIssue[]; + @property({ attribute: false }) public issues!: EnergyValidationIssue[]; public render() { if (this.issues.length === 0) { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts index 1ceb7b2cb02d..60b8f82fafb1 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts @@ -22,7 +22,7 @@ export class ZHAClustersDataTable extends LitElement { @property({ type: Boolean }) public narrow = false; - @property() public clusters: Cluster[] = []; + @property({ attribute: false }) public clusters: Cluster[] = []; @query("ha-data-table", true) private _dataTable!: HaDataTable; diff --git a/src/panels/config/scene/ha-config-scene.ts b/src/panels/config/scene/ha-config-scene.ts index 59a88b92c24a..965e1a6bbc19 100644 --- a/src/panels/config/scene/ha-config-scene.ts +++ b/src/panels/config/scene/ha-config-scene.ts @@ -30,7 +30,7 @@ class HaConfigScene extends HassRouterPage { @property({ type: Boolean }) public showAdvanced = false; - @property() public scenes: SceneEntity[] = []; + @property({ attribute: false }) public scenes: SceneEntity[] = []; protected routerOptions: RouterOptions = { defaultPage: "dashboard", diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts index 27e21501db94..f620c2235ec5 100644 --- a/src/panels/config/scene/ha-scene-dashboard.ts +++ b/src/panels/config/scene/ha-scene-dashboard.ts @@ -70,7 +70,7 @@ class HaSceneDashboard extends LitElement { @property({ attribute: false }) public route!: Route; - @property() public scenes!: SceneEntity[]; + @property({ attribute: false }) public scenes!: SceneEntity[]; @state() private _activeFilters?: string[]; diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index b8c2ab466ecd..53ce39942a21 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -95,7 +95,7 @@ export class HaSceneEditor extends SubscribeMixin( @property() public sceneId: string | null = null; - @property() public scenes!: SceneEntity[]; + @property({ attribute: false }) public scenes!: SceneEntity[]; @property({ type: Boolean }) public showAdvanced = false; diff --git a/src/panels/config/script/ha-config-script.ts b/src/panels/config/script/ha-config-script.ts index 3e96240f7a37..56aaade1c1c9 100644 --- a/src/panels/config/script/ha-config-script.ts +++ b/src/panels/config/script/ha-config-script.ts @@ -33,7 +33,7 @@ class HaConfigScript extends HassRouterPage { @property({ type: Boolean }) public showAdvanced = false; - @property() public scripts: ScriptEntity[] = []; + @property({ attribute: false }) public scripts: ScriptEntity[] = []; @state() @consume({ context: fullEntitiesContext, subscribe: true }) diff --git a/src/panels/config/script/ha-script-field-row.ts b/src/panels/config/script/ha-script-field-row.ts index 8e57629789f8..38a0c4e33cc6 100644 --- a/src/panels/config/script/ha-script-field-row.ts +++ b/src/panels/config/script/ha-script-field-row.ts @@ -27,9 +27,9 @@ export default class HaScriptFieldRow extends LitElement { @property() public key!: string; - @property() public excludeKeys: string[] = []; + @property({ type: Array }) public excludeKeys: string[] = []; - @property() public field!: Field; + @property({ attribute: false }) public field!: Field; @property({ type: Boolean }) public disabled = false; diff --git a/src/panels/config/script/ha-script-fields.ts b/src/panels/config/script/ha-script-fields.ts index 3a80df82c9c2..8fb319db396f 100644 --- a/src/panels/config/script/ha-script-fields.ts +++ b/src/panels/config/script/ha-script-fields.ts @@ -24,7 +24,7 @@ export default class HaScriptFields extends LitElement { @property({ type: Boolean }) public disabled = false; - @property() public fields!: Fields; + @property({ attribute: false }) public fields!: Fields; private _focusLastActionOnChange = false; diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index 0b51320a8a60..aa46a532a872 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -68,7 +68,7 @@ type ScriptItem = ScriptEntity & { class HaScriptPicker extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public scripts!: ScriptEntity[]; + @property({ attribute: false }) public scripts!: ScriptEntity[]; @property({ type: Boolean }) public isWide = false; diff --git a/src/panels/config/tags/tag-image.ts b/src/panels/config/tags/tag-image.ts index 3079bb61d82e..17c3b636edb3 100644 --- a/src/panels/config/tags/tag-image.ts +++ b/src/panels/config/tags/tag-image.ts @@ -6,7 +6,7 @@ import { TagRowData } from "./ha-config-tags"; @customElement("tag-image") export class HaTagImage extends LitElement { - @property() public tag?: TagRowData; + @property({ attribute: false }) public tag?: TagRowData; private _timeout?: number; diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 04a4a406ba1c..6d048e924763 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -27,7 +27,7 @@ export class HaPanelCustom extends ReactiveElement { @property({ attribute: false }) public route!: Route; - @property() public panel!: CustomPanelInfo; + @property({ attribute: false }) public panel!: CustomPanelInfo; private _setProperties?: (props: Record) => void | undefined; diff --git a/src/panels/developer-tools/event/events-list.ts b/src/panels/developer-tools/event/events-list.ts index 7007ca6eab44..a509651f2d34 100644 --- a/src/panels/developer-tools/event/events-list.ts +++ b/src/panels/developer-tools/event/events-list.ts @@ -13,7 +13,7 @@ interface EventListenerCount { class EventsList extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public events: EventListenerCount[] = []; + @property({ attribute: false }) public events: EventListenerCount[] = []; protected render(): TemplateResult { return html` diff --git a/src/panels/iframe/ha-panel-iframe.ts b/src/panels/iframe/ha-panel-iframe.ts index ba6b45105606..72b7e96d10ab 100644 --- a/src/panels/iframe/ha-panel-iframe.ts +++ b/src/panels/iframe/ha-panel-iframe.ts @@ -11,7 +11,7 @@ class HaPanelIframe extends LitElement { @property({ type: Boolean }) public narrow = false; - @property() panel!: PanelInfo<{ url: string }>; + @property({ attribute: false }) panel!: PanelInfo<{ url: string }>; render() { if ( diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index 984a6a694bd0..ea25e307b3d4 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -41,28 +41,24 @@ const idsChanged = (oldIds?: string[], newIds?: string[]) => { export class HaLogbook extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public time!: + @property({ attribute: false }) public time!: | { range: [Date, Date] } | { // Seconds recent: number; }; - @property() public entityIds?: string[]; + @property({ attribute: false }) public entityIds?: string[]; - @property() public deviceIds?: string[]; + @property({ attribute: false }) public deviceIds?: string[]; - @property({ type: Boolean, attribute: "narrow" }) - public narrow = false; + @property({ type: Boolean }) public narrow = false; - @property({ type: Boolean, attribute: "virtualize", reflect: true }) - public virtualize = false; + @property({ type: Boolean, reflect: true }) public virtualize = false; - @property({ type: Boolean, attribute: "no-icon" }) - public noIcon = false; + @property({ type: Boolean, attribute: "no-icon" }) public noIcon = false; - @property({ type: Boolean, attribute: "no-name" }) - public noName = false; + @property({ type: Boolean, attribute: "no-name" }) public noName = false; @property({ type: Boolean, attribute: "show-indicator" }) public showIndicator = false; diff --git a/src/panels/lovelace/components/hui-buttons-base.ts b/src/panels/lovelace/components/hui-buttons-base.ts index 0edeb4c2f217..7030d2c6cc62 100644 --- a/src/panels/lovelace/components/hui-buttons-base.ts +++ b/src/panels/lovelace/components/hui-buttons-base.ts @@ -17,7 +17,8 @@ import { haStyleScrollbar } from "../../../resources/styles"; export class HuiButtonsBase extends LitElement { @state() public hass!: HomeAssistant; - @property() public configEntities?: EntitiesCardEntityConfig[]; + @property({ attribute: false }) + public configEntities?: EntitiesCardEntityConfig[]; protected render(): TemplateResult { return html` diff --git a/src/panels/lovelace/components/hui-entity-editor.ts b/src/panels/lovelace/components/hui-entity-editor.ts index c69ad7066e52..77f22a85c097 100644 --- a/src/panels/lovelace/components/hui-entity-editor.ts +++ b/src/panels/lovelace/components/hui-entity-editor.ts @@ -19,7 +19,8 @@ export class HuiEntityEditor extends LitElement { @property({ attribute: false }) public entities?: EntityConfig[]; - @property() public entityFilter?: HaEntityPickerEntityFilterFunc; + @property({ attribute: false }) + public entityFilter?: HaEntityPickerEntityFilterFunc; @property() public label?: string; diff --git a/src/panels/lovelace/components/hui-timestamp-display.ts b/src/panels/lovelace/components/hui-timestamp-display.ts index c3871ca099cf..c0b99d2c4554 100644 --- a/src/panels/lovelace/components/hui-timestamp-display.ts +++ b/src/panels/lovelace/components/hui-timestamp-display.ts @@ -27,7 +27,7 @@ const INTERVAL_FORMAT = ["relative", "total"]; class HuiTimestampDisplay extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public ts?: Date; + @property({ attribute: false }) public ts?: Date; @property() public format?: TimestampRenderingFormat; diff --git a/src/panels/lovelace/ha-panel-lovelace.ts b/src/panels/lovelace/ha-panel-lovelace.ts index 81e6aa793234..4319c94d5bde 100644 --- a/src/panels/lovelace/ha-panel-lovelace.ts +++ b/src/panels/lovelace/ha-panel-lovelace.ts @@ -52,7 +52,7 @@ let resourcesLoaded = false; @customElement("ha-panel-lovelace") export class LovelacePanel extends LitElement { - @property() public panel?: PanelInfo; + @property({ attribute: false }) public panel?: PanelInfo; @property({ attribute: false }) public hass?: HomeAssistant; diff --git a/src/panels/lovelace/hui-editor.ts b/src/panels/lovelace/hui-editor.ts index 8748cb195f89..cf5983d87504 100644 --- a/src/panels/lovelace/hui-editor.ts +++ b/src/panels/lovelace/hui-editor.ts @@ -49,7 +49,7 @@ class LovelaceFullConfigEditor extends LitElement { @property({ attribute: false }) public lovelace?: Lovelace; - @property() public closeEditor?: () => void; + @property({ attribute: false }) public closeEditor?: () => void; @state() private _saving?: boolean; diff --git a/src/panels/profile/ha-advanced-mode-row.ts b/src/panels/profile/ha-advanced-mode-row.ts index 3eed30ceed52..1877e0412141 100644 --- a/src/panels/profile/ha-advanced-mode-row.ts +++ b/src/panels/profile/ha-advanced-mode-row.ts @@ -15,7 +15,7 @@ class AdvancedModeRow extends LitElement { @property({ type: Boolean }) public narrow = false; - @property() public coreUserData?: CoreFrontendUserData; + @property({ attribute: false }) public coreUserData?: CoreFrontendUserData; protected render(): TemplateResult { return html` From 634122657c89cdc9a9594e7636ef0af15f44e6c4 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 22 Jan 2024 12:03:42 -0500 Subject: [PATCH 043/356] Fix incompatible object/array property types (3 of 3) (#19510) --- .../chart/state-history-chart-line.ts | 2 +- .../chart/state-history-chart-timeline.ts | 2 +- src/components/chart/state-history-charts.ts | 5 ++-- src/components/chart/statistics-chart.ts | 2 +- src/components/ha-form/ha-form-boolean.ts | 4 ++-- src/components/ha-form/ha-form-expandable.ts | 6 +++-- src/components/ha-form/ha-form-grid.ts | 6 +++-- .../ha-form/ha-form-multi_select.ts | 4 ++-- src/components/ha-form/ha-form-select.ts | 2 +- src/components/ha-form/ha-form.ts | 24 +++++++++++++------ src/components/ha-hs-color-picker.ts | 2 +- .../ha-selector/ha-selector-constant.ts | 3 ++- .../ha-selector/ha-selector-icon.ts | 2 +- .../ha-selector/ha-selector-select.ts | 3 ++- .../ha-selector/ha-selector-state.ts | 2 +- src/components/ha-selector/ha-selector.ts | 5 ++-- src/components/ha-sortable.ts | 2 +- src/components/trace/ha-trace-path-details.ts | 5 ++-- src/components/user/ha-user-picker.ts | 2 +- src/components/user/ha-users-picker.ts | 2 +- .../previews/flow-preview-group.ts | 2 +- .../previews/flow-preview-template.ts | 2 +- .../lights/ha-favorite-color-button.ts | 2 +- .../configurator-notification-item.ts | 3 ++- .../notifications/notification-item.ts | 3 ++- .../persistent-notification-item.ts | 2 +- src/layouts/hass-tabs-subpage-data-table.ts | 4 ++-- src/layouts/hass-tabs-subpage.ts | 2 +- .../calendar/ha-recurrence-rule-editor.ts | 2 +- .../ha-automation-action-activate_scene.ts | 2 +- .../types/ha-automation-action-choose.ts | 2 +- .../types/ha-automation-action-condition.ts | 2 +- .../types/ha-automation-action-event.ts | 2 +- .../action/types/ha-automation-action-stop.ts | 2 +- .../config/automation/ha-automation-editor.ts | 2 +- .../config/automation/ha-automation-picker.ts | 2 +- .../config/automation/ha-config-automation.ts | 2 +- .../config/blueprint/ha-config-blueprint.ts | 3 ++- .../device-detail/ha-device-entities-card.ts | 2 +- .../devices/ha-config-devices-dashboard.ts | 4 ++-- .../settings/entity-settings-helper-tab.ts | 2 +- .../entity-registry-settings-editor.ts | 2 +- .../integrations/ha-config-flow-card.ts | 4 ++-- .../ha-config-integration-page.ts | 2 +- .../ha-disabled-config-entry-card.ts | 4 ++-- .../ha-ignored-config-entry-card.ts | 4 ++-- .../ha-integration-action-card.ts | 2 +- .../integrations/ha-integration-card.ts | 2 +- .../assist-pipeline-detail-config.ts | 4 ++-- .../assist-pipeline-detail-conversation.ts | 2 +- .../assist-pipeline-detail-stt.ts | 2 +- .../assist-pipeline-detail-tts.ts | 2 +- .../assist-pipeline-detail-wakeword.ts | 2 +- .../debug/assist-render-pipeline-events.ts | 2 +- .../debug/assist-render-pipeline-run.ts | 2 +- tsconfig.json | 1 - 56 files changed, 95 insertions(+), 76 deletions(-) diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index e712762470cd..7652fbabc78a 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -27,7 +27,7 @@ export class StateHistoryChartLine extends LitElement { @property({ attribute: false }) public data: LineChartEntity[] = []; - @property() public names?: Record; + @property({ attribute: false }) public names?: Record; @property() public unit?: string; diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 4ed3eff474d3..79b51be40ed3 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -25,7 +25,7 @@ export class StateHistoryChartTimeline extends LitElement { @property({ type: Boolean }) public narrow = false; - @property() public names?: Record; + @property({ attribute: false }) public names?: Record; @property() public unit?: string; diff --git a/src/components/chart/state-history-charts.ts b/src/components/chart/state-history-charts.ts index dd68187f3007..7ecbfdd26a1c 100644 --- a/src/components/chart/state-history-charts.ts +++ b/src/components/chart/state-history-charts.ts @@ -54,10 +54,9 @@ export class StateHistoryCharts extends LitElement { @property({ type: Boolean }) public narrow = false; - @property() public names?: Record; + @property({ attribute: false }) public names?: Record; - @property({ type: Boolean, attribute: "virtualize", reflect: true }) - public virtualize = false; + @property({ type: Boolean, reflect: true }) public virtualize = false; @property({ attribute: false }) public endTime?: Date; diff --git a/src/components/chart/statistics-chart.ts b/src/components/chart/statistics-chart.ts index a0fc6ca53ba5..0e2fa2a9f50a 100644 --- a/src/components/chart/statistics-chart.ts +++ b/src/components/chart/statistics-chart.ts @@ -54,7 +54,7 @@ export class StatisticsChart extends LitElement { StatisticsMetaData >; - @property() public names?: Record; + @property({ attribute: false }) public names?: Record; @property() public unit?: string; diff --git a/src/components/ha-form/ha-form-boolean.ts b/src/components/ha-form/ha-form-boolean.ts index 1e62d3fd1359..171739e844ca 100644 --- a/src/components/ha-form/ha-form-boolean.ts +++ b/src/components/ha-form/ha-form-boolean.ts @@ -12,9 +12,9 @@ import "../ha-checkbox"; @customElement("ha-form-boolean") export class HaFormBoolean extends LitElement implements HaFormElement { - @property() public schema!: HaFormBooleanSchema; + @property({ attribute: false }) public schema!: HaFormBooleanSchema; - @property() public data!: HaFormBooleanData; + @property({ attribute: false }) public data!: HaFormBooleanData; @property() public label!: string; diff --git a/src/components/ha-form/ha-form-expandable.ts b/src/components/ha-form/ha-form-expandable.ts index 79ed2162dde6..f8e88c43aa63 100644 --- a/src/components/ha-form/ha-form-expandable.ts +++ b/src/components/ha-form/ha-form-expandable.ts @@ -19,12 +19,14 @@ export class HaFormExpendable extends LitElement implements HaFormElement { @property({ type: Boolean }) public disabled = false; - @property() public computeLabel?: ( + @property({ attribute: false }) public computeLabel?: ( schema: HaFormSchema, data?: HaFormDataContainer ) => string; - @property() public computeHelper?: (schema: HaFormSchema) => string; + @property({ attribute: false }) public computeHelper?: ( + schema: HaFormSchema + ) => string; protected render() { return html` diff --git a/src/components/ha-form/ha-form-grid.ts b/src/components/ha-form/ha-form-grid.ts index a3fbcb079a27..27c602531234 100644 --- a/src/components/ha-form/ha-form-grid.ts +++ b/src/components/ha-form/ha-form-grid.ts @@ -26,12 +26,14 @@ export class HaFormGrid extends LitElement implements HaFormElement { @property({ type: Boolean }) public disabled = false; - @property() public computeLabel?: ( + @property({ attribute: false }) public computeLabel?: ( schema: HaFormSchema, data?: HaFormDataContainer ) => string; - @property() public computeHelper?: (schema: HaFormSchema) => string; + @property({ attribute: false }) public computeHelper?: ( + schema: HaFormSchema + ) => string; public async focus() { await this.updateComplete; diff --git a/src/components/ha-form/ha-form-multi_select.ts b/src/components/ha-form/ha-form-multi_select.ts index 66c7d60ca6c0..3a76d87f77f8 100644 --- a/src/components/ha-form/ha-form-multi_select.ts +++ b/src/components/ha-form/ha-form-multi_select.ts @@ -35,9 +35,9 @@ const SHOW_ALL_ENTRIES_LIMIT = 6; @customElement("ha-form-multi_select") export class HaFormMultiSelect extends LitElement implements HaFormElement { - @property() public schema!: HaFormMultiSelectSchema; + @property({ attribute: false }) public schema!: HaFormMultiSelectSchema; - @property() public data!: HaFormMultiSelectData; + @property({ attribute: false }) public data!: HaFormMultiSelectData; @property() public label!: string; diff --git a/src/components/ha-form/ha-form-select.ts b/src/components/ha-form/ha-form-select.ts index 86a5db98a65e..83a2c7525a8b 100644 --- a/src/components/ha-form/ha-form-select.ts +++ b/src/components/ha-form/ha-form-select.ts @@ -17,7 +17,7 @@ export class HaFormSelect extends LitElement implements HaFormElement { @property({ attribute: false }) public schema!: HaFormSelectSchema; - @property() public data!: HaFormSelectData; + @property({ attribute: false }) public data!: HaFormSelectData; @property() public label?: string; diff --git a/src/components/ha-form/ha-form.ts b/src/components/ha-form/ha-form.ts index f4eed03d9ad9..6cd8dfeb8107 100644 --- a/src/components/ha-form/ha-form.ts +++ b/src/components/ha-form/ha-form.ts @@ -45,24 +45,34 @@ export class HaForm extends LitElement implements HaFormElement { @property({ attribute: false }) public schema!: readonly HaFormSchema[]; - @property() public error?: Record; + @property({ attribute: false }) public error?: Record; - @property() public warning?: Record; + @property({ attribute: false }) public warning?: Record; @property({ type: Boolean }) public disabled = false; - @property() public computeError?: (schema: any, error) => string; + @property({ attribute: false }) public computeError?: ( + schema: any, + error + ) => string; - @property() public computeWarning?: (schema: any, warning) => string; + @property({ attribute: false }) public computeWarning?: ( + schema: any, + warning + ) => string; - @property() public computeLabel?: ( + @property({ attribute: false }) public computeLabel?: ( schema: any, data: HaFormDataContainer ) => string; - @property() public computeHelper?: (schema: any) => string | undefined; + @property({ attribute: false }) public computeHelper?: ( + schema: any + ) => string | undefined; - @property() public localizeValue?: (key: string) => string; + @property({ attribute: false }) public localizeValue?: ( + key: string + ) => string; protected getFormProperties(): Record { return {}; diff --git a/src/components/ha-hs-color-picker.ts b/src/components/ha-hs-color-picker.ts index f492be2d7cdc..b332e0fd636b 100644 --- a/src/components/ha-hs-color-picker.ts +++ b/src/components/ha-hs-color-picker.ts @@ -115,7 +115,7 @@ class HaHsColorPicker extends LitElement { @property({ type: Number, attribute: false }) public renderSize?: number; - @property({ type: Number }) + @property({ type: Array }) public value?: [number, number]; @property({ type: Number }) diff --git a/src/components/ha-selector/ha-selector-constant.ts b/src/components/ha-selector/ha-selector-constant.ts index f05557832bfd..9ea7f1ec2e50 100644 --- a/src/components/ha-selector/ha-selector-constant.ts +++ b/src/components/ha-selector/ha-selector-constant.ts @@ -8,7 +8,8 @@ export class HaSelectorConstant extends LitElement { @property({ type: Boolean }) public disabled = false; - @property() public localizeValue?: (key: string) => string; + @property({ attribute: false }) + public localizeValue?: (key: string) => string; protected render() { if (this.disabled) { diff --git a/src/components/ha-selector/ha-selector-icon.ts b/src/components/ha-selector/ha-selector-icon.ts index 148bd08dfd46..c922f99a5d2e 100644 --- a/src/components/ha-selector/ha-selector-icon.ts +++ b/src/components/ha-selector/ha-selector-icon.ts @@ -25,7 +25,7 @@ export class HaIconSelector extends LitElement { @property({ type: Boolean }) public required = true; - @property() public context?: { + @property({ attribute: false }) public context?: { icon_entity?: string; }; diff --git a/src/components/ha-selector/ha-selector-select.ts b/src/components/ha-selector/ha-selector-select.ts index 0f1301d28680..069dd157d424 100644 --- a/src/components/ha-selector/ha-selector-select.ts +++ b/src/components/ha-selector/ha-selector-select.ts @@ -32,7 +32,8 @@ export class HaSelectSelector extends LitElement { @property() public helper?: string; - @property() public localizeValue?: (key: string) => string; + @property({ attribute: false }) + public localizeValue?: (key: string) => string; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/ha-selector/ha-selector-state.ts b/src/components/ha-selector/ha-selector-state.ts index f42718b3c23f..e79259dcd68d 100644 --- a/src/components/ha-selector/ha-selector-state.ts +++ b/src/components/ha-selector/ha-selector-state.ts @@ -21,7 +21,7 @@ export class HaSelectorState extends SubscribeMixin(LitElement) { @property({ type: Boolean }) public required = true; - @property() public context?: { + @property({ attribute: false }) public context?: { filter_attribute?: string; filter_entity?: string; }; diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts index bad10c521f75..66696fbf8338 100644 --- a/src/components/ha-selector/ha-selector.ts +++ b/src/components/ha-selector/ha-selector.ts @@ -71,7 +71,8 @@ export class HaSelector extends LitElement { @property() public helper?: string; - @property() public localizeValue?: (key: string) => string; + @property({ attribute: false }) + public localizeValue?: (key: string) => string; @property() public placeholder?: any; @@ -79,7 +80,7 @@ export class HaSelector extends LitElement { @property({ type: Boolean }) public required = true; - @property() public context?: Record; + @property({ attribute: false }) public context?: Record; public async focus() { await this.updateComplete; diff --git a/src/components/ha-sortable.ts b/src/components/ha-sortable.ts index 32c9cffe711f..248a0171f8ae 100644 --- a/src/components/ha-sortable.ts +++ b/src/components/ha-sortable.ts @@ -24,7 +24,7 @@ export class HaSortable extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Boolean }) + @property({ type: Array }) public path?: ItemPath; @property({ type: Boolean, attribute: "no-style" }) diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts index 9be129def828..cb71dd98a305 100644 --- a/src/components/trace/ha-trace-path-details.ts +++ b/src/components/trace/ha-trace-path-details.ts @@ -43,9 +43,10 @@ export class HaTracePathDetails extends LitElement { @property({ attribute: false }) public selected!: NodeInfo; - @property() public renderedNodes: Record = {}; + @property({ attribute: false }) + public renderedNodes: Record = {}; - @property() public trackedNodes!: Record; + @property({ attribute: false }) public trackedNodes!: Record; @state() private _view: (typeof TRACE_PATH_TABS)[number] = "step_config"; diff --git a/src/components/user/ha-user-picker.ts b/src/components/user/ha-user-picker.ts index 50ec6b4611c4..3f89ecc10fdb 100644 --- a/src/components/user/ha-user-picker.ts +++ b/src/components/user/ha-user-picker.ts @@ -19,7 +19,7 @@ class HaUserPicker extends LitElement { @property() public value = ""; - @property() public users?: User[]; + @property({ attribute: false }) public users?: User[]; @property({ type: Boolean }) public disabled = false; diff --git a/src/components/user/ha-users-picker.ts b/src/components/user/ha-users-picker.ts index a78de5ed4cd6..1962e7c4ce42 100644 --- a/src/components/user/ha-users-picker.ts +++ b/src/components/user/ha-users-picker.ts @@ -13,7 +13,7 @@ import "./ha-user-picker"; class HaUsersPickerLight extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public value?: string[]; + @property({ attribute: false }) public value?: string[]; @property({ attribute: "picked-user-label" }) public pickedUserLabel?: string; diff --git a/src/dialogs/config-flow/previews/flow-preview-group.ts b/src/dialogs/config-flow/previews/flow-preview-group.ts index 11d48cd09f9b..5afc93a038e1 100644 --- a/src/dialogs/config-flow/previews/flow-preview-group.ts +++ b/src/dialogs/config-flow/previews/flow-preview-group.ts @@ -19,7 +19,7 @@ class FlowPreviewGroup extends LitElement { @property() public flowId!: string; - @property() public stepData!: Record; + @property({ attribute: false }) public stepData!: Record; @state() private _preview?: HassEntity; diff --git a/src/dialogs/config-flow/previews/flow-preview-template.ts b/src/dialogs/config-flow/previews/flow-preview-template.ts index 19e7c6c998dd..e2f49feb43a8 100644 --- a/src/dialogs/config-flow/previews/flow-preview-template.ts +++ b/src/dialogs/config-flow/previews/flow-preview-template.ts @@ -24,7 +24,7 @@ class FlowPreviewTemplate extends LitElement { @property() public flowId!: string; - @property() public stepData!: Record; + @property({ attribute: false }) public stepData!: Record; @state() private _preview?: HassEntity; diff --git a/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts b/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts index 1da77121e2aa..f631a52beb90 100644 --- a/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts +++ b/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts @@ -26,7 +26,7 @@ class MoreInfoViewLightColorPicker extends LitElement { @property({ attribute: false }) public stateObj?: LightEntity; - @property() color!: LightColor; + @property({ attribute: false }) color!: LightColor; @query("ha-outlined-icon-button", true) private _button?: HaOutlinedIconButton; diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts index ae69269952d1..0d87c6fd5fe4 100644 --- a/src/dialogs/notifications/configurator-notification-item.ts +++ b/src/dialogs/notifications/configurator-notification-item.ts @@ -11,7 +11,8 @@ import "./notification-item-template"; export class HuiConfiguratorNotificationItem extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public notification?: PersitentNotificationEntity; + @property({ attribute: false }) + public notification?: PersitentNotificationEntity; protected render() { if (!this.hass || !this.notification) { diff --git a/src/dialogs/notifications/notification-item.ts b/src/dialogs/notifications/notification-item.ts index 908e19251458..ca92227e1fab 100644 --- a/src/dialogs/notifications/notification-item.ts +++ b/src/dialogs/notifications/notification-item.ts @@ -10,7 +10,8 @@ import "./persistent-notification-item"; export class HuiNotificationItem extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public notification?: HassEntity | PersistentNotification; + @property({ attribute: false }) + public notification?: HassEntity | PersistentNotification; protected shouldUpdate(changedProps: PropertyValues): boolean { if (!this.hass || !this.notification || changedProps.has("notification")) { diff --git a/src/dialogs/notifications/persistent-notification-item.ts b/src/dialogs/notifications/persistent-notification-item.ts index 40ce7e6b2fe7..16a615296511 100644 --- a/src/dialogs/notifications/persistent-notification-item.ts +++ b/src/dialogs/notifications/persistent-notification-item.ts @@ -13,7 +13,7 @@ import "./notification-item-template"; export class HuiPersistentNotificationItem extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @property() public notification?: PersistentNotification; + @property({ attribute: false }) public notification?: PersistentNotification; protected render() { if (!this.hass || !this.notification) { diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index b21c627ad8ca..275cfe82f12f 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -116,7 +116,7 @@ export class HaTabsSubpageDataTable extends LitElement { * Function to call when the back button is pressed. * @type {() => void} */ - @property() public backCallback?: () => void; + @property({ attribute: false }) public backCallback?: () => void; /** * String to show when there are no records in the data table. @@ -136,7 +136,7 @@ export class HaTabsSubpageDataTable extends LitElement { * Array of tabs to show on the page. * @type {Array} */ - @property() public tabs: PageNavigation[] = []; + @property({ attribute: false }) public tabs: PageNavigation[] = []; /** * Force hides the filter menu. diff --git a/src/layouts/hass-tabs-subpage.ts b/src/layouts/hass-tabs-subpage.ts index ac650afdd406..05438d121642 100644 --- a/src/layouts/hass-tabs-subpage.ts +++ b/src/layouts/hass-tabs-subpage.ts @@ -45,7 +45,7 @@ class HassTabsSubpage extends LitElement { @property({ type: String, attribute: "back-path" }) public backPath?: string; - @property() public backCallback?: () => void; + @property({ attribute: false }) public backCallback?: () => void; @property({ type: Boolean, attribute: "main-page" }) public mainPage = false; diff --git a/src/panels/calendar/ha-recurrence-rule-editor.ts b/src/panels/calendar/ha-recurrence-rule-editor.ts index 3d1dd412f37b..5a1727b43131 100644 --- a/src/panels/calendar/ha-recurrence-rule-editor.ts +++ b/src/panels/calendar/ha-recurrence-rule-editor.ts @@ -39,7 +39,7 @@ export class RecurrenceRuleEditor extends LitElement { @property() public value = ""; - @property() public dtstart?: Date; + @property({ attribute: false }) public dtstart?: Date; @property({ type: Boolean }) public allDay = false; diff --git a/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts b/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts index 5e61ca20341a..d8664f2c35b3 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts @@ -14,7 +14,7 @@ export class HaSceneAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property() public action!: SceneAction; + @property({ attribute: false }) public action!: SceneAction; public static get defaultConfig(): SceneAction { return { diff --git a/src/panels/config/automation/action/types/ha-automation-action-choose.ts b/src/panels/config/automation/action/types/ha-automation-action-choose.ts index 2272d5104c51..ed24485d606f 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-choose.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-choose.ts @@ -54,7 +54,7 @@ export class HaChooseAction extends LitElement implements ActionElement { @property({ attribute: false }) public path?: ItemPath; - @property() public action!: ChooseAction; + @property({ attribute: false }) public action!: ChooseAction; @state() private _showDefault = false; diff --git a/src/panels/config/automation/action/types/ha-automation-action-condition.ts b/src/panels/config/automation/action/types/ha-automation-action-condition.ts index d62176812d8b..3b098e9a8611 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-condition.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-condition.ts @@ -18,7 +18,7 @@ export class HaConditionAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property() public action!: Condition; + @property({ attribute: false }) public action!: Condition; public static get defaultConfig() { return { condition: "state" }; 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 c2aebdd02206..15ed85aea434 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 @@ -16,7 +16,7 @@ export class HaEventAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property() public action!: EventAction; + @property({ attribute: false }) public action!: EventAction; @query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor; diff --git a/src/panels/config/automation/action/types/ha-automation-action-stop.ts b/src/panels/config/automation/action/types/ha-automation-action-stop.ts index 6ca7177e4f1f..c98a5e2cffb4 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-stop.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-stop.ts @@ -10,7 +10,7 @@ import { ActionElement } from "../ha-automation-action-row"; export class HaStopAction extends LitElement implements ActionElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public action!: StopAction; + @property({ attribute: false }) public action!: StopAction; @property({ type: Boolean }) public disabled = false; diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index f179e971682d..c4658284130b 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -87,7 +87,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { @property() public entityId: string | null = null; - @property() public automations!: AutomationEntity[]; + @property({ attribute: false }) public automations!: AutomationEntity[]; @property({ type: Boolean }) public isWide = false; diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index 588c07a109ef..3bb5802c7dd3 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -79,7 +79,7 @@ class HaAutomationPicker extends LitElement { @property({ attribute: false }) public route!: Route; - @property() public automations!: AutomationEntity[]; + @property({ attribute: false }) public automations!: AutomationEntity[]; @state() private _activeFilters?: string[]; diff --git a/src/panels/config/automation/ha-config-automation.ts b/src/panels/config/automation/ha-config-automation.ts index ef1182e98205..bd07c0fa1792 100644 --- a/src/panels/config/automation/ha-config-automation.ts +++ b/src/panels/config/automation/ha-config-automation.ts @@ -30,7 +30,7 @@ class HaConfigAutomation extends HassRouterPage { @property({ type: Boolean }) public showAdvanced = false; - @property() public automations: AutomationEntity[] = []; + @property({ attribute: false }) public automations: AutomationEntity[] = []; private _debouncedUpdateAutomations = debounce((pageEl) => { const newAutomations = this._getAutomations(this.hass.states); diff --git a/src/panels/config/blueprint/ha-config-blueprint.ts b/src/panels/config/blueprint/ha-config-blueprint.ts index 1e6bbeed95b3..4a371a2cf0d9 100644 --- a/src/panels/config/blueprint/ha-config-blueprint.ts +++ b/src/panels/config/blueprint/ha-config-blueprint.ts @@ -25,7 +25,8 @@ class HaConfigBlueprint extends HassRouterPage { @property({ type: Boolean }) public showAdvanced = false; - @property() public blueprints: Record = {}; + @property({ attribute: false }) + public blueprints: Record = {}; protected routerOptions: RouterOptions = { defaultPage: "dashboard", diff --git a/src/panels/config/devices/device-detail/ha-device-entities-card.ts b/src/panels/config/devices/device-detail/ha-device-entities-card.ts index 636216483c54..2dd3dacae0ae 100644 --- a/src/panels/config/devices/device-detail/ha-device-entities-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-entities-card.ts @@ -36,7 +36,7 @@ export class HaDeviceEntitiesCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entities!: EntityRegistryStateEntry[]; + @property({ attribute: false }) public entities!: EntityRegistryStateEntry[]; @property({ type: Boolean }) public showHidden = false; diff --git a/src/panels/config/devices/ha-config-devices-dashboard.ts b/src/panels/config/devices/ha-config-devices-dashboard.ts index a3fbf080c539..1f8dbabd97d4 100644 --- a/src/panels/config/devices/ha-config-devices-dashboard.ts +++ b/src/panels/config/devices/ha-config-devices-dashboard.ts @@ -66,13 +66,13 @@ export class HaConfigDeviceDashboard extends LitElement { @property({ type: Boolean }) public isWide = false; - @property() public entries!: ConfigEntry[]; + @property({ attribute: false }) public entries!: ConfigEntry[]; @state() @consume({ context: fullEntitiesContext, subscribe: true }) entities!: EntityRegistryEntry[]; - @property() public manifests!: IntegrationManifest[]; + @property({ attribute: false }) public manifests!: IntegrationManifest[]; @property({ attribute: false }) public route!: Route; diff --git a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts index dbe61afa3d6a..52a617c2716b 100644 --- a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts +++ b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts @@ -36,7 +36,7 @@ import type { EntityRegistrySettingsEditor } from "../../entity-registry-setting export class EntitySettingsHelperTab extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entry!: ExtEntityRegistryEntry; + @property({ attribute: false }) public entry!: ExtEntityRegistryEntry; @state() private _error?: string; diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index 2da5ef250b51..e7da87719272 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -141,7 +141,7 @@ export class EntityRegistrySettingsEditor extends LitElement { @property({ type: Boolean }) public disabled = false; - @property() public helperConfigEntry?: ConfigEntry; + @property({ attribute: false }) public helperConfigEntry?: ConfigEntry; @state() private _name!: string; diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index ad7df5b414b8..3cfa297a0ef1 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -24,9 +24,9 @@ import "../../../components/ha-list-item"; export class HaConfigFlowCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public flow!: DataEntryFlowProgressExtended; + @property({ attribute: false }) public flow!: DataEntryFlowProgressExtended; - @property() public manifest?: IntegrationManifest; + @property({ attribute: false }) public manifest?: IntegrationManifest; protected render(): TemplateResult { const attention = ATTENTION_SOURCES.includes(this.flow.context.source); diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index cca54614807e..a58597c114ba 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -116,7 +116,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { @property({ type: Boolean }) public showAdvanced = false; - @property() public configEntries?: ConfigEntry[]; + @property({ attribute: false }) public configEntries?: ConfigEntry[]; @property({ attribute: false }) public configEntriesInProgress: DataEntryFlowProgressExtended[] = []; diff --git a/src/panels/config/integrations/ha-disabled-config-entry-card.ts b/src/panels/config/integrations/ha-disabled-config-entry-card.ts index f6003515aead..e18baf434183 100644 --- a/src/panels/config/integrations/ha-disabled-config-entry-card.ts +++ b/src/panels/config/integrations/ha-disabled-config-entry-card.ts @@ -16,9 +16,9 @@ import "./ha-integration-action-card"; export class HaDisabledConfigEntryCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entry!: ConfigEntryExtended; + @property({ attribute: false }) public entry!: ConfigEntryExtended; - @property() public manifest?: IntegrationManifest; + @property({ attribute: false }) public manifest?: IntegrationManifest; protected render(): TemplateResult { return html` diff --git a/src/panels/config/integrations/ha-ignored-config-entry-card.ts b/src/panels/config/integrations/ha-ignored-config-entry-card.ts index f00d481d3794..919032207306 100644 --- a/src/panels/config/integrations/ha-ignored-config-entry-card.ts +++ b/src/panels/config/integrations/ha-ignored-config-entry-card.ts @@ -13,9 +13,9 @@ import "../../../components/ha-button"; export class HaIgnoredConfigEntryCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public entry!: ConfigEntryExtended; + @property({ attribute: false }) public entry!: ConfigEntryExtended; - @property() public manifest?: IntegrationManifest; + @property({ attribute: false }) public manifest?: IntegrationManifest; protected render(): TemplateResult { return html` diff --git a/src/panels/config/integrations/ha-integration-action-card.ts b/src/panels/config/integrations/ha-integration-action-card.ts index f1a758d759bf..ab715f0e848d 100644 --- a/src/panels/config/integrations/ha-integration-action-card.ts +++ b/src/panels/config/integrations/ha-integration-action-card.ts @@ -22,7 +22,7 @@ export class HaIntegrationActionCard extends LitElement { @property() public label!: string; - @property() public manifest?: IntegrationManifest; + @property({ attribute: false }) public manifest?: IntegrationManifest; protected render(): TemplateResult { return html` diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 4fdafdba2c2b..143ea3bfe14c 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -52,7 +52,7 @@ export class HaIntegrationCard extends LitElement { @property({ type: Boolean }) public supportsDiagnostics = false; - @property() public logInfo?: IntegrationLogInfo; + @property({ attribute: false }) public logInfo?: IntegrationLogInfo; @queryAsync("mwc-ripple") private _ripple!: Promise; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts index 856af04c392c..2791d89f1334 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts @@ -10,9 +10,9 @@ import "../../../../components/ha-form/ha-form"; export class AssistPipelineDetailConfig extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public data?: Partial; + @property({ attribute: false }) public data?: Partial; - @property() public supportedLanguages?: string[]; + @property({ type: Array }) public supportedLanguages?: string[]; public async focus() { await this.updateComplete; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts index c4f40ad904b8..cd2b6441dd76 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts @@ -11,7 +11,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; export class AssistPipelineDetailConversation extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public data?: Partial; + @property({ attribute: false }) public data?: Partial; @state() private _supportedLanguages?: "*" | string[]; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts index 37cbe01d032a..46d411dc6fd5 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts @@ -10,7 +10,7 @@ import "../../../../components/ha-form/ha-form"; export class AssistPipelineDetailSTT extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public data?: Partial; + @property({ attribute: false }) public data?: Partial; @state() private _supportedLanguages?: string[]; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts index 4850a70caf5f..a99abb48dc0d 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts @@ -12,7 +12,7 @@ import { HomeAssistant } from "../../../../types"; export class AssistPipelineDetailTTS extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public data?: Partial; + @property({ attribute: false }) public data?: Partial; @state() private _supportedLanguages?: string[]; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts index 77e167c45608..7180bb295078 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts @@ -20,7 +20,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; export class AssistPipelineDetailWakeWord extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public data?: Partial; + @property({ attribute: false }) public data?: Partial; @state() private _wakeWords?: WakeWord[]; diff --git a/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts b/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts index 0d9cc6d79c6e..90fe7b449aae 100644 --- a/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts +++ b/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts @@ -13,7 +13,7 @@ import "./assist-render-pipeline-run"; export class AssistPipelineEvents extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public events!: PipelineRunEvent[]; + @property({ attribute: false }) public events!: PipelineRunEvent[]; private _processEvents = memoizeOne( (events: PipelineRunEvent[]): PipelineRun | undefined => { 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 ae455152beb0..15c64cc56111 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 @@ -138,7 +138,7 @@ const dataMinusKeysRender = ( export class AssistPipelineDebug extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public pipelineRun!: PipelineRun; + @property({ attribute: false }) public pipelineRun!: PipelineRun; protected render(): TemplateResult { const lastRunStage: string = this.pipelineRun diff --git a/tsconfig.json b/tsconfig.json index 0c67e5a2b2e7..72918ea5ad68 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -40,7 +40,6 @@ // Binding types "no-incompatible-type-binding": "warning", // LitElement - "no-incompatible-property-type": "warning", "no-property-visibility-mismatch": "error", // CSS "no-invalid-css": "off", // warning does not work From 545d140dcfdf98bcaafec6af348b21169a6ea068 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:12:25 -0800 Subject: [PATCH 044/356] Various leaflet map bugfixes (#19475) * Various leaflet map bugfixes * move pan to updated --- .../ha-selector/ha-selector-location.ts | 10 +++++-- src/components/map/ha-locations-editor.ts | 30 +++++++++++++++++++ src/onboarding/onboarding-location.ts | 6 ++-- src/panels/config/zone/dialog-zone-detail.ts | 6 ++-- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/components/ha-selector/ha-selector-location.ts b/src/components/ha-selector/ha-selector-location.ts index a2ae29dd9880..96d9d6629802 100644 --- a/src/components/ha-selector/ha-selector-location.ts +++ b/src/components/ha-selector/ha-selector-location.ts @@ -51,8 +51,14 @@ export class HaLocationSelector extends LitElement { return [ { id: "location", - latitude: value?.latitude || this.hass.config.latitude, - longitude: value?.longitude || this.hass.config.longitude, + latitude: + !value || isNaN(value.latitude) + ? this.hass.config.latitude + : value.latitude, + longitude: + !value || isNaN(value.longitude) + ? this.hass.config.longitude + : value.longitude, radius: selector.location?.radius ? value?.radius || 1000 : undefined, radius_color: zoneRadiusColor, icon: diff --git a/src/components/map/ha-locations-editor.ts b/src/components/map/ha-locations-editor.ts index fc81e9f68600..10702cbf55b4 100644 --- a/src/components/map/ha-locations-editor.ts +++ b/src/components/map/ha-locations-editor.ts @@ -168,6 +168,36 @@ export class HaLocationsEditor extends LitElement { } } + public updated(changedProps: PropertyValues): void { + // Still loading. + if (!this.Leaflet) { + return; + } + + if (changedProps.has("locations")) { + const oldLocations = changedProps.get("locations"); + const movedLocations = this.locations?.filter( + (loc, idx) => + !oldLocations[idx] || + ((loc.latitude !== oldLocations[idx].latitude || + loc.longitude !== oldLocations[idx].longitude) && + this.map.leafletMap?.getBounds().contains({ + lat: oldLocations[idx].latitude, + lng: oldLocations[idx].longitude, + }) && + !this.map.leafletMap + ?.getBounds() + .contains({ lat: loc.latitude, lng: loc.longitude })) + ); + if (movedLocations?.length === 1) { + this.map.leafletMap?.panTo({ + lat: movedLocations[0].latitude, + lng: movedLocations[0].longitude, + }); + } + } + } + private _updateLocation(ev: DragEndEvent) { const marker = ev.target; const latlng: LatLng = marker.getLatLng(); diff --git a/src/onboarding/onboarding-location.ts b/src/onboarding/onboarding-location.ts index e452e8a7ad29..1d031b81f3e7 100644 --- a/src/onboarding/onboarding-location.ts +++ b/src/onboarding/onboarding-location.ts @@ -295,8 +295,10 @@ class OnboardingLocation extends LitElement { if (ev.detail.id === LOCATION_MARKER_ID) { return; } - this._highlightedMarker = ev.detail.id; - const place = this._places!.find((plc) => plc.place_id === ev.detail.id)!; + this._highlightedMarker = Number(ev.detail.id); + const place = this._places!.find( + (plc) => plc.place_id === Number(ev.detail.id) + )!; this._location = [Number(place.lat), Number(place.lon)]; this._country = place.address.country_code.toUpperCase(); } diff --git a/src/panels/config/zone/dialog-zone-detail.ts b/src/panels/config/zone/dialog-zone-detail.ts index 4b655ea3d1a5..37432c6b8f89 100644 --- a/src/panels/config/zone/dialog-zone-detail.ts +++ b/src/panels/config/zone/dialog-zone-detail.ts @@ -152,13 +152,13 @@ class DialogZoneDetail extends LitElement { { name: "latitude", required: true, - selector: { text: {} }, + selector: { number: {} }, }, { name: "longitude", required: true, - selector: { text: {} }, + selector: { number: {} }, }, ], }, @@ -183,7 +183,7 @@ class DialogZoneDetail extends LitElement { private _valueChanged(ev: CustomEvent) { this._error = undefined; - const value = ev.detail.value; + const value = { ...ev.detail.value }; if ( value.location.latitude !== this._data!.latitude || value.location.longitude !== this._data!.longitude || From 9354ed927bcc4dd66ab93284dddc5da4a51e1773 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:17:20 +0100 Subject: [PATCH 045/356] Localize sun condition in automation editor (#19473) Sun condition --- src/data/automation_i18n.ts | 76 ++++++++++++++----------------------- src/translations/en.json | 19 +++++++--- 2 files changed, 42 insertions(+), 53 deletions(-) diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts index d7f186a0dc3b..e01c04de148e 100644 --- a/src/data/automation_i18n.ts +++ b/src/data/automation_i18n.ts @@ -1016,60 +1016,40 @@ const tryDescribeCondition = ( } // Sun condition - if ( - condition.condition === "sun" && - ("before" in condition || "after" in condition) - ) { - let base = "Confirm"; - - if (!condition.after && !condition.before) { - base += " sun"; - return base; - } - - base += " sun"; - - if (condition.after) { - let after_duration = ""; - - if (condition.after_offset) { - if (typeof condition.after_offset === "number") { - after_duration = ` offset by ${secondsToDuration( - condition.after_offset - )!}`; - } else if (typeof condition.after_offset === "string") { - after_duration = ` offset by ${condition.after_offset}`; - } else { - after_duration = ` offset by ${JSON.stringify( - condition.after_offset - )}`; - } + if (condition.condition === "sun" && (condition.before || condition.after)) { + let afterDuration = ""; + if (condition.after && condition.after_offset) { + if (typeof condition.after_offset === "number") { + afterDuration = secondsToDuration(condition.after_offset)!; + } else if (typeof condition.after_offset === "string") { + afterDuration = condition.after_offset; + } else { + afterDuration = JSON.stringify(condition.after_offset); } - - base += ` after ${condition.after}${after_duration}`; } - if (condition.before) { - let before_duration = ""; - - if (condition.before_offset) { - if (typeof condition.before_offset === "number") { - before_duration = ` offset by ${secondsToDuration( - condition.before_offset - )!}`; - } else if (typeof condition.before_offset === "string") { - before_duration = ` offset by ${condition.before_offset}`; - } else { - before_duration = ` offset by ${JSON.stringify( - condition.before_offset - )}`; - } + let beforeDuration = ""; + if (condition.before && condition.before_offset) { + if (typeof condition.before_offset === "number") { + beforeDuration = secondsToDuration(condition.before_offset)!; + } else if (typeof condition.before_offset === "string") { + beforeDuration = condition.before_offset; + } else { + beforeDuration = JSON.stringify(condition.before_offset); } - - base += ` before ${condition.before}${before_duration}`; } - return base; + return hass.localize( + `${conditionsTranslationBaseKey}.sun.description.full`, + { + afterChoice: condition.after ?? "other", + afterOffsetChoice: afterDuration !== "" ? "offset" : "other", + afterOffset: afterDuration, + beforeChoice: condition.before ?? "other", + beforeOffsetChoice: beforeDuration !== "" ? "offset" : "other", + beforeOffset: beforeDuration, + } + ); } // Zone condition diff --git a/src/translations/en.json b/src/translations/en.json index 1142a89d2371..0bb3f0844d19 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2508,7 +2508,9 @@ "label": "Time and location", "description": "When someone enters or leaves a zone, or at a specific time." }, - "other": { "label": "Other triggers" } + "other": { + "label": "Other triggers" + } }, "type": { "calendar": { @@ -2748,7 +2750,9 @@ "label": "Time and location", "description": "If someone is in a zone or if the current time is before or after a specified time." }, - "other": { "label": "Other conditions" }, + "other": { + "label": "Other conditions" + }, "building_blocks": { "label": "Building blocks", "description": "Build more complex conditions." @@ -2828,7 +2832,8 @@ "sunrise": "Sunrise", "sunset": "Sunset", "description": { - "picker": "If the sun is above or below the horizon." + "picker": "If the sun is above or below the horizon.", + "full": "Confirm sun{afterChoice, select, \n sunrise { after sunrise}\n sunset { after sunset}\n other {}\n}{afterOffsetChoice, select, \n offset { offset by {afterOffset}}\n other {}\n}{beforeChoice, select, \n sunrise { before sunrise}\n sunset { before sunset}\n other {}\n}{beforeOffsetChoice, select, \n offset { offset by {beforeOffset}}\n other {}\n}" } }, "template": { @@ -2912,8 +2917,12 @@ "type_select": "Action type", "continue_on_error": "Continue on error", "groups": { - "helpers": { "label": "Helpers" }, - "other": { "label": "Other actions" }, + "helpers": { + "label": "Helpers" + }, + "other": { + "label": "Other actions" + }, "building_blocks": { "label": "Building blocks", "description": "Build more complex sequences of actions." From f6af73b222415816572d51334659bd36dbc4dd79 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 22 Jan 2024 12:53:04 -0500 Subject: [PATCH 046/356] Allow expanding a history graph card (#19481) * Allow expanding a history graph card * Update styling --- .../lovelace/cards/hui-history-graph-card.ts | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/cards/hui-history-graph-card.ts b/src/panels/lovelace/cards/hui-history-graph-card.ts index b79da32bb661..03c39cd2b2a8 100644 --- a/src/panels/lovelace/cards/hui-history-graph-card.ts +++ b/src/panels/lovelace/cards/hui-history-graph-card.ts @@ -6,12 +6,14 @@ import { html, nothing, } from "lit"; +import { mdiChevronRight } from "@mdi/js"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/chart/state-history-charts"; import "../../../components/ha-alert"; import "../../../components/ha-card"; +import "../../../components/ha-icon-button"; import { HistoryResult, computeHistory, @@ -23,6 +25,7 @@ import { hasConfigOrEntitiesChanged } from "../common/has-changed"; import { processConfigEntities } from "../common/process-config-entities"; import { LovelaceCard } from "../types"; import { HistoryGraphCardConfig } from "./types"; +import { createSearchParam } from "../../../common/url/search-params"; export const DEFAULT_HOURS_TO_SHOW = 24; @@ -192,9 +195,25 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard { if (!this.hass || !this._config) { return nothing; } + const now = new Date(); + now.setHours(now.getHours() - this._hoursToShow); + const configUrl = `/history?${createSearchParam({ + entity_id: this._entityIds.join(","), + start_date: now.toISOString(), + })}`; return html` - + + ${this._config.title + ? html` +

+ ${this._config.title} + +

+ ` + : nothing}
Date: Mon, 22 Jan 2024 20:10:08 +0100 Subject: [PATCH 047/356] Add stateValue parameter to ha-state-icon (#19508) * Add state value option to entityIcon * Migrate lock, valve and cover more info to icon translations * Migrate tile card * Remove domain icon from area card * Use attribute --- src/components/ha-state-icon.ts | 14 +++-- src/components/tile/ha-tile-badge.ts | 13 +--- src/components/tile/ha-tile-icon.ts | 15 ++--- src/data/icons.ts | 25 ++++---- .../controls/more-info-alarm_control_panel.ts | 7 +-- .../more-info/controls/more-info-lock.ts | 9 +-- src/panels/lovelace/cards/hui-area-card.ts | 17 ++--- src/panels/lovelace/cards/hui-tile-card.ts | 63 ++++++++----------- .../cards/tile/badges/tile-badge-climate.ts | 32 +++++++--- .../tile/badges/tile-badge-humidifier.ts | 28 ++++++--- .../cards/tile/badges/tile-badge-person.ts | 45 +++++++++---- .../lovelace/cards/tile/badges/tile-badge.ts | 45 ++++++------- .../cover/ha-state-control-cover-toggle.ts | 32 +++++++--- .../lock/ha-state-control-lock-toggle.ts | 42 ++++++------- .../valve/ha-state-control-valve-toggle.ts | 32 +++++++--- 15 files changed, 241 insertions(+), 178 deletions(-) diff --git a/src/components/ha-state-icon.ts b/src/components/ha-state-icon.ts index 062da216375d..2589dc318f81 100644 --- a/src/components/ha-state-icon.ts +++ b/src/components/ha-state-icon.ts @@ -14,6 +14,8 @@ export class HaStateIcon extends LitElement { @property({ attribute: false }) public stateObj?: HassEntity; + @property({ attribute: false }) public stateValue?: string; + @property() public icon?: string; protected render() { @@ -30,12 +32,14 @@ export class HaStateIcon extends LitElement { if (!this.hass) { return this._renderFallback(); } - const icon = entityIcon(this.hass, this.stateObj).then((icn) => { - if (icn) { - return html``; + const icon = entityIcon(this.hass, this.stateObj, this.stateValue).then( + (icn) => { + if (icn) { + return html``; + } + return this._renderFallback(); } - return this._renderFallback(); - }); + ); return html`${until(icon)}`; } diff --git a/src/components/tile/ha-tile-badge.ts b/src/components/tile/ha-tile-badge.ts index dea713e069f2..33aa85fce4d0 100644 --- a/src/components/tile/ha-tile-badge.ts +++ b/src/components/tile/ha-tile-badge.ts @@ -1,19 +1,13 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property } from "lit/decorators"; +import { customElement } from "lit/decorators"; import "../ha-icon"; @customElement("ha-tile-badge") export class HaTileBadge extends LitElement { - @property() public iconPath?: string; - - @property() public icon?: string; - protected render(): TemplateResult { return html`
- ${this.icon - ? html`` - : html``} +
`; } @@ -36,8 +30,7 @@ export class HaTileBadge extends LitElement { background-color: var(--tile-badge-background-color); transition: background-color 280ms ease-in-out; } - .badge ha-icon, - .badge ha-svg-icon { + .badge ::slotted(*) { color: var(--tile-badge-icon-color); } `; diff --git a/src/components/tile/ha-tile-icon.ts b/src/components/tile/ha-tile-icon.ts index 5bf889575f53..f5ebe8863c52 100644 --- a/src/components/tile/ha-tile-icon.ts +++ b/src/components/tile/ha-tile-icon.ts @@ -1,20 +1,14 @@ -import { CSSResultGroup, html, css, LitElement, TemplateResult } from "lit"; -import { customElement, property } from "lit/decorators"; +import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import { customElement } from "lit/decorators"; import "../ha-icon"; import "../ha-svg-icon"; @customElement("ha-tile-icon") export class HaTileIcon extends LitElement { - @property() public iconPath?: string; - - @property() public icon?: string; - protected render(): TemplateResult { return html`
- ${this.icon - ? html`` - : html``} +
`; } @@ -47,8 +41,7 @@ export class HaTileIcon extends LitElement { transition: color 180ms ease-in-out; overflow: hidden; } - .shape ha-icon, - .shape ha-svg-icon { + .shape ::slotted(*) { display: flex; color: var(--tile-icon-color); transition: color 180ms ease-in-out; diff --git a/src/data/icons.ts b/src/data/icons.ts index 544ce8f25d5a..009723d67fa8 100644 --- a/src/data/icons.ts +++ b/src/data/icons.ts @@ -71,10 +71,15 @@ export const getComponentIcons = async ( return resources.entity_component.then((res) => res[domain]); }; -export const entityIcon = async (hass: HomeAssistant, state: HassEntity) => { +export const entityIcon = async ( + hass: HomeAssistant, + state: HassEntity, + stateValue?: string +) => { let icon: string | undefined; const domain = computeStateDomain(state); const entity = hass.entities?.[state.entity_id]; + const value = stateValue ?? state.state; if (entity?.icon) { return entity.icon; } @@ -82,18 +87,19 @@ export const entityIcon = async (hass: HomeAssistant, state: HassEntity) => { const platformIcons = await getPlatformIcons(hass, entity.platform); if (platformIcons) { icon = - platformIcons[domain]?.[entity.translation_key]?.state?.[state.state] || + platformIcons[domain]?.[entity.translation_key]?.state?.[value] || platformIcons[domain]?.[entity.translation_key]?.default; } } if (!icon) { const entityComponentIcons = await getComponentIcons(hass, domain); + if (entityComponentIcons) { icon = entityComponentIcons[state.attributes.device_class || "_"]?.state?.[ - state.state + value ] || - entityComponentIcons._?.state?.[state.state] || + entityComponentIcons._?.state?.[value] || entityComponentIcons[state.attributes.device_class || "_"]?.default || entityComponentIcons._?.default; } @@ -110,13 +116,14 @@ export const attributeIcon = async ( let icon: string | undefined; const domain = computeStateDomain(state); const entity = hass.entities?.[state.entity_id]; + const value = attributeValue ?? state.attributes[attribute]; if (entity?.translation_key && entity.platform) { const platformIcons = await getPlatformIcons(hass, entity.platform); if (platformIcons) { icon = platformIcons[domain]?.[entity.translation_key]?.state_attributes?.[ attribute - ]?.state?.[attributeValue || state.attributes[attribute]]; + ]?.state?.[value]; } } if (!icon) { @@ -124,12 +131,8 @@ export const attributeIcon = async ( if (entityComponentIcons) { icon = entityComponentIcons[state.attributes.device_class || "_"] - .state_attributes?.[attribute]?.state?.[ - attributeValue || state.attributes[attribute] - ] || - entityComponentIcons._.state_attributes?.[attribute]?.state?.[ - attributeValue || state.attributes[attribute] - ]; + .state_attributes?.[attribute]?.state?.[value] || + entityComponentIcons._.state_attributes?.[attribute]?.state?.[value]; } } return icon; diff --git a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts index 53cd1ac08ef5..bfc39a2ddc49 100644 --- a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts @@ -2,9 +2,9 @@ import { mdiShieldOff } from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; -import { domainIcon } from "../../../common/entity/domain_icon"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-outlined-button"; +import "../../../components/ha-state-icon"; import { AlarmControlPanelEntity } from "../../../data/alarm_control_panel"; import "../../../state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes"; import type { HomeAssistant } from "../../../types"; @@ -59,9 +59,8 @@ class MoreInfoAlarmControlPanel extends LitElement {
- + +
${this.hass.localize("ui.card.alarm_control_panel.disarm")} diff --git a/src/dialogs/more-info/controls/more-info-lock.ts b/src/dialogs/more-info/controls/more-info-lock.ts index fb5815cc5208..9af77fd128bf 100644 --- a/src/dialogs/more-info/controls/more-info-lock.ts +++ b/src/dialogs/more-info/controls/more-info-lock.ts @@ -2,11 +2,11 @@ import { mdiDoorOpen, mdiLock, mdiLockOff } from "@mdi/js"; import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; -import { domainIcon } from "../../../common/entity/domain_icon"; import { stateColorCss } from "../../../common/entity/state_color"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; import "../../../components/ha-outlined-icon-button"; +import "../../../components/ha-state-icon"; import { UNAVAILABLE } from "../../../data/entity"; import { LockEntity, @@ -62,9 +62,10 @@ class MoreInfoLock extends LitElement {
- +
` diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index 5a455a9f6c24..3ceb943ebeec 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -1,5 +1,7 @@ import "@material/mwc-ripple"; import { + mdiFan, + mdiFanOff, mdiLightbulbMultiple, mdiLightbulbMultipleOff, mdiRun, @@ -9,30 +11,30 @@ import { } from "@mdi/js"; import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; import { - css, CSSResultGroup, - html, LitElement, PropertyValues, TemplateResult, + css, + html, nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; -import { STATES_OFF, FIXED_DEVICE_CLASS_ICONS } from "../../../common/const"; +import { FIXED_DEVICE_CLASS_ICONS, STATES_OFF } from "../../../common/const"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; -import { computeDomain } from "../../../common/entity/compute_domain"; import { binarySensorIcon } from "../../../common/entity/binary_sensor_icon"; -import { domainIcon } from "../../../common/entity/domain_icon"; +import { computeDomain } from "../../../common/entity/compute_domain"; import { navigate } from "../../../common/navigate"; import { formatNumber, isNumericState, } from "../../../common/number/format_number"; -import { subscribeOne } from "../../../common/util/subscribe-one"; +import { blankBeforeUnit } from "../../../common/translations/blank_before_unit"; import parseAspectRatio from "../../../common/util/parse-aspect-ratio"; +import { subscribeOne } from "../../../common/util/subscribe-one"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-svg-icon"; @@ -56,7 +58,6 @@ import "../components/hui-image"; import "../components/hui-warning"; import { LovelaceCard, LovelaceCardEditor } from "../types"; import { AreaCardConfig } from "./types"; -import { blankBeforeUnit } from "../../../common/translations/blank_before_unit"; export const DEFAULT_ASPECT_RATIO = "16:9"; @@ -76,7 +77,7 @@ export const DEVICE_CLASSES = { const DOMAIN_ICONS = { light: { on: mdiLightbulbMultiple, off: mdiLightbulbMultipleOff }, switch: { on: mdiToggleSwitch, off: mdiToggleSwitchOff }, - fan: { on: domainIcon("fan"), off: domainIcon("fan") }, + fan: { on: mdiFan, off: mdiFanOff }, binary_sensor: { motion: mdiRun, moisture: mdiWaterAlert, diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index 70d3d13063a3..e400e147ce55 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -28,8 +28,9 @@ import { DOMAINS_TOGGLE } from "../../../common/const"; import { computeDomain } from "../../../common/entity/compute_domain"; import { stateActive } from "../../../common/entity/state_active"; import { stateColorCss } from "../../../common/entity/state_color"; -import { stateIconPath } from "../../../common/entity/state_icon_path"; import "../../../components/ha-card"; +import "../../../components/ha-state-icon"; +import "../../../components/ha-svg-icon"; import "../../../components/tile/ha-tile-badge"; import "../../../components/tile/ha-tile-icon"; import "../../../components/tile/ha-tile-image"; @@ -48,7 +49,7 @@ import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import "../components/hui-timestamp-display"; import type { LovelaceCard, LovelaceCardEditor } from "../types"; -import { computeTileBadge } from "./tile/badges/tile-badge"; +import { renderTileBadge } from "./tile/badges/tile-badge"; import type { ThermostatCardConfig, TileCardConfig } from "./types"; const TIMESTAMP_STATE_DOMAINS = ["button", "input_button", "scene"]; @@ -341,17 +342,14 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
- - + + + + + +
@@ -360,9 +358,6 @@ export class HuiTileCard extends LitElement implements LovelaceCard { `; } - const icon = this._config.icon || stateObj.attributes.icon; - const iconPath = stateIconPath(stateObj); - const name = this._config.name || stateObj.attributes.friendly_name; const localizedState = this._config.hide_state @@ -382,7 +377,6 @@ export class HuiTileCard extends LitElement implements LovelaceCard { const imageUrl = this._config.show_entity_picture ? this._getImageUrl(stateObj) : undefined; - const badge = computeTileBadge(stateObj, this.hass); return html` @@ -420,7 +414,6 @@ export class HuiTileCard extends LitElement implements LovelaceCard { ? html` ` @@ -428,27 +421,18 @@ export class HuiTileCard extends LitElement implements LovelaceCard { + > + + `} - ${badge - ? html` - - ` - : nothing} + ${renderTileBadge(stateObj, this.hass)}
@@ -516,7 +500,7 @@ export class HuiTileCard extends LitElement implements LovelaceCard { margin-inline-start: initial; margin-inline-end: initial; } - .vertical .info { + .vertical ha-tile-info { width: 100%; } .icon-container { @@ -528,14 +512,15 @@ export class HuiTileCard extends LitElement implements LovelaceCard { direction: var(--direction); transition: transform 180ms ease-in-out; } - .icon-container .icon { + .icon-container ha-tile-icon, + .icon-container ha-tile-image { --tile-icon-color: var(--tile-color); user-select: none; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; } - .icon-container .badge { + .icon-container ha-tile-badge { position: absolute; top: -3px; right: -3px; @@ -544,7 +529,7 @@ export class HuiTileCard extends LitElement implements LovelaceCard { .icon-container[role="button"]:active { transform: scale(1.2); } - .info { + ha-tile-info { position: relative; padding: 12px; flex: 1; @@ -564,6 +549,10 @@ export class HuiTileCard extends LitElement implements LovelaceCard { animation: pulse 1s infinite; } + ha-tile-badge.not-found { + --tile-badge-background-color: var(--red-color); + } + @keyframes pulse { 0% { opacity: 1; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts index a00d773e5674..ed75266f7475 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts @@ -1,20 +1,36 @@ +import { html, nothing } from "lit"; +import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; +import "../../../../../components/ha-attribute-icon"; +import "../../../../../components/tile/ha-tile-badge"; import { - CLIMATE_HVAC_ACTION_ICONS, CLIMATE_HVAC_ACTION_TO_MODE, ClimateEntity, } from "../../../../../data/climate"; -import { ComputeBadgeFunction } from "./tile-badge"; +import { RenderBadgeFunction } from "./tile-badge"; -export const computeClimateBadge: ComputeBadgeFunction = (stateObj) => { +export const renderClimateBadge: RenderBadgeFunction = (stateObj, hass) => { const hvacAction = (stateObj as ClimateEntity).attributes.hvac_action; if (!hvacAction || hvacAction === "off") { - return undefined; + return nothing; } - return { - iconPath: CLIMATE_HVAC_ACTION_ICONS[hvacAction], - color: stateColorCss(stateObj, CLIMATE_HVAC_ACTION_TO_MODE[hvacAction]), - }; + return html` + + + + + `; }; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts index 709f4e7c68d5..4ca246c02c9d 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts @@ -1,20 +1,32 @@ +import { html, nothing } from "lit"; +import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; +import "../../../../../components/ha-attribute-icon"; +import "../../../../../components/tile/ha-tile-badge"; import { - HUMIDIFIER_ACTION_ICONS, HUMIDIFIER_ACTION_MODE, HumidifierEntity, } from "../../../../../data/humidifier"; -import { ComputeBadgeFunction } from "./tile-badge"; +import { RenderBadgeFunction } from "./tile-badge"; -export const computeHumidifierBadge: ComputeBadgeFunction = (stateObj) => { +export const renderHumidifierBadge: RenderBadgeFunction = (stateObj, hass) => { const hvacAction = (stateObj as HumidifierEntity).attributes.action; if (!hvacAction || hvacAction === "off") { - return undefined; + return nothing; } - return { - iconPath: HUMIDIFIER_ACTION_ICONS[hvacAction], - color: stateColorCss(stateObj, HUMIDIFIER_ACTION_MODE[hvacAction]), - }; + return html` + + + + + `; }; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts index 6d58f5af81ce..4c0fd8be80b7 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts @@ -1,8 +1,13 @@ import { mdiHome, mdiHomeExportOutline } from "@mdi/js"; import { HassEntity } from "home-assistant-js-websocket"; +import { html } from "lit"; +import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; +import "../../../../../components/ha-icon"; +import "../../../../../components/ha-svg-icon"; +import "../../../../../components/tile/ha-tile-badge"; import { HomeAssistant } from "../../../../../types"; -import { ComputeBadgeFunction } from "./tile-badge"; +import { RenderBadgeFunction } from "./tile-badge"; function getZone(entity: HassEntity, hass: HomeAssistant) { const state = entity.state; @@ -15,17 +20,33 @@ function getZone(entity: HassEntity, hass: HomeAssistant) { return zones.find((z) => state === z.attributes.friendly_name); } -function personBadgeIcon(entity: HassEntity) { - const state = entity.state; - return state === "not_home" ? mdiHomeExportOutline : mdiHome; -} - -export const computePersonBadge: ComputeBadgeFunction = (stateObj, hass) => { +export const renderPersonBadge: RenderBadgeFunction = (stateObj, hass) => { const zone = getZone(stateObj, hass); - return { - iconPath: personBadgeIcon(stateObj), - icon: zone?.attributes.icon, - color: stateColorCss(stateObj), - }; + const zoneIcon = zone?.attributes.icon; + + if (zoneIcon) { + return html` + + + + `; + } + + const defaultIcon = + stateObj.state === "not_home" ? mdiHomeExportOutline : mdiHome; + + return html` + + + + `; }; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge.ts b/src/panels/lovelace/cards/tile/badges/tile-badge.ts index 5281f3591de3..e6bdc8fb0c38 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge.ts @@ -1,43 +1,46 @@ import { mdiExclamationThick } from "@mdi/js"; import { HassEntity } from "home-assistant-js-websocket"; +import { TemplateResult, html, nothing } from "lit"; +import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../../../common/entity/compute_domain"; import { UNAVAILABLE, UNKNOWN } from "../../../../../data/entity"; import { HomeAssistant } from "../../../../../types"; -import { computeClimateBadge } from "./tile-badge-climate"; -import { computePersonBadge } from "./tile-badge-person"; -import { computeHumidifierBadge } from "./tile-badge-humidifier"; +import { renderClimateBadge } from "./tile-badge-climate"; +import { renderHumidifierBadge } from "./tile-badge-humidifier"; +import { renderPersonBadge } from "./tile-badge-person"; +import "../../../../../components/tile/ha-tile-badge"; +import "../../../../../components/ha-svg-icon"; -export type TileBadge = { - color?: string; - icon?: string; - iconPath?: string; -}; - -export type ComputeBadgeFunction = ( +export type RenderBadgeFunction = ( stateObj: HassEntity, hass: HomeAssistant -) => TileBadge | undefined; +) => TemplateResult | typeof nothing; -export const computeTileBadge: ComputeBadgeFunction = (stateObj, hass) => { +export const renderTileBadge: RenderBadgeFunction = (stateObj, hass) => { if (stateObj.state === UNKNOWN) { - return undefined; + return nothing; } if (stateObj.state === UNAVAILABLE) { - return { - color: "var(--orange-color)", - iconPath: mdiExclamationThick, - }; + return html` + + + + `; } const domain = computeDomain(stateObj.entity_id); switch (domain) { case "person": case "device_tracker": - return computePersonBadge(stateObj, hass); + return renderPersonBadge(stateObj, hass); case "climate": - return computeClimateBadge(stateObj, hass); + return renderClimateBadge(stateObj, hass); case "humidifier": - return computeHumidifierBadge(stateObj, hass); + return renderHumidifierBadge(stateObj, hass); default: - return undefined; + return nothing; } }; diff --git a/src/state-control/cover/ha-state-control-cover-toggle.ts b/src/state-control/cover/ha-state-control-cover-toggle.ts index dc26ffe24cce..b47a7b62a190 100644 --- a/src/state-control/cover/ha-state-control-cover-toggle.ts +++ b/src/state-control/cover/ha-state-control-cover-toggle.ts @@ -3,10 +3,10 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; -import { domainIcon } from "../../common/entity/domain_icon"; import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; +import "../../components/ha-state-icon"; import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; import { forwardHaptic } from "../../data/haptics"; import { HomeAssistant } from "../../types"; @@ -77,9 +77,11 @@ export class HaStateControlCoverToggle extends LitElement { "--color": onColor, })} > - + - +
`; @@ -102,8 +106,6 @@ export class HaStateControlCoverToggle extends LitElement { return html` + + `; } diff --git a/src/state-control/lock/ha-state-control-lock-toggle.ts b/src/state-control/lock/ha-state-control-lock-toggle.ts index 2914e17587cb..06e975ee59f1 100644 --- a/src/state-control/lock/ha-state-control-lock-toggle.ts +++ b/src/state-control/lock/ha-state-control-lock-toggle.ts @@ -9,10 +9,10 @@ import { import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; -import { domainIcon } from "../../common/entity/domain_icon"; import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; +import "../../components/ha-state-icon"; import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; import { forwardHaptic } from "../../data/haptics"; import { callProtectedLockService, LockEntity } from "../../data/lock"; @@ -81,18 +81,6 @@ export class HaStateControlLockToggle extends LitElement { const color = stateColorCss(this.stateObj); - const onIcon = domainIcon( - "lock", - this.stateObj, - locking ? "locking" : "locked" - ); - - const offIcon = domainIcon( - "lock", - this.stateObj, - unlocking ? "unlocking" : "unlocked" - ); - if (this.stateObj.state === UNKNOWN) { return html`
@@ -100,13 +88,21 @@ export class HaStateControlLockToggle extends LitElement { .label=${this.hass.localize("ui.card.lock.lock")} @click=${this._turnOn} > - + - +
`; @@ -127,16 +123,20 @@ export class HaStateControlLockToggle extends LitElement { })} .disabled=${this.stateObj.state === UNAVAILABLE} > - - + + > `; } diff --git a/src/state-control/valve/ha-state-control-valve-toggle.ts b/src/state-control/valve/ha-state-control-valve-toggle.ts index 2eb0dbd93477..b543b539d8f5 100644 --- a/src/state-control/valve/ha-state-control-valve-toggle.ts +++ b/src/state-control/valve/ha-state-control-valve-toggle.ts @@ -3,10 +3,10 @@ import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; -import { domainIcon } from "../../common/entity/domain_icon"; import { stateColorCss } from "../../common/entity/state_color"; import "../../components/ha-control-button"; import "../../components/ha-control-switch"; +import "../../components/ha-state-icon"; import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; import { forwardHaptic } from "../../data/haptics"; import { HomeAssistant } from "../../types"; @@ -77,9 +77,11 @@ export class HaStateControlValveToggle extends LitElement { "--color": onColor, })} > - + - +
`; @@ -102,8 +106,6 @@ export class HaStateControlValveToggle extends LitElement { return html` + + `; } From 98e3dbceb57c054172773cfecf727bea8d58c516 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 20:15:44 +0100 Subject: [PATCH 048/356] Update dependency @bundle-stats/plugin-webpack-filter to v4.9.1 (#19513) 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 dd772f74e0f2..9ecc2f9e8185 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "@babel/plugin-transform-runtime": "7.23.7", "@babel/preset-env": "7.23.8", "@babel/preset-typescript": "7.23.3", - "@bundle-stats/plugin-webpack-filter": "4.8.4", + "@bundle-stats/plugin-webpack-filter": "4.9.1", "@koa/cors": "5.0.0", "@lokalise/node-api": "12.1.0", "@octokit/auth-oauth-device": "6.0.1", diff --git a/yarn.lock b/yarn.lock index b44ea0d1f164..7972cc3ce8a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1462,12 +1462,12 @@ __metadata: languageName: node linkType: hard -"@bundle-stats/plugin-webpack-filter@npm:4.8.4": - version: 4.8.4 - resolution: "@bundle-stats/plugin-webpack-filter@npm:4.8.4" +"@bundle-stats/plugin-webpack-filter@npm:4.9.1": + version: 4.9.1 + resolution: "@bundle-stats/plugin-webpack-filter@npm:4.9.1" peerDependencies: core-js: ^3.0.0 - checksum: 7a33a19094fb32579ca215cfee7c536a7e524558e6a17bee0376377691b4957bd1346531dfe3b01e8daf364acef75e1926f3d1aed76d986be79ba374157782fb + checksum: ec3fba8e5d9a49a2500bdf75468c743b48d78ab8b0199e3ceda1bc59d57de3f9b7ad48ca04846cd7f1f64e33d3646fd605c7f56e242798d06e76d18997489365 languageName: node linkType: hard @@ -9471,7 +9471,7 @@ __metadata: "@babel/preset-typescript": "npm:7.23.3" "@babel/runtime": "npm:7.23.8" "@braintree/sanitize-url": "npm:7.0.0" - "@bundle-stats/plugin-webpack-filter": "npm:4.8.4" + "@bundle-stats/plugin-webpack-filter": "npm:4.9.1" "@codemirror/autocomplete": "npm:6.12.0" "@codemirror/commands": "npm:6.3.3" "@codemirror/language": "npm:6.10.0" From d335dd4b8389d1355735919e65c16ea2c274d467 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:43:05 -0500 Subject: [PATCH 049/356] Update dependency @types/luxon to v3.4.2 (#19514) 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 9ecc2f9e8185..f941eb0ffa7e 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,7 @@ "@types/js-yaml": "4.0.9", "@types/leaflet": "1.9.8", "@types/leaflet-draw": "1.0.11", - "@types/luxon": "3.4.1", + "@types/luxon": "3.4.2", "@types/mocha": "10.0.6", "@types/qrcode": "1.5.5", "@types/serve-handler": "6.1.4", diff --git a/yarn.lock b/yarn.lock index 7972cc3ce8a9..798dc1ac3b21 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4276,10 +4276,10 @@ __metadata: languageName: node linkType: hard -"@types/luxon@npm:3.4.1": - version: 3.4.1 - resolution: "@types/luxon@npm:3.4.1" - checksum: dc133d28dee98fd7944e81fbde8df4fcdd7b602139259b5566b556a09da296a6c57e02899b0068470465d5b3798f551edafe0a6c8fb89fcd327d799ff7d37c92 +"@types/luxon@npm:3.4.2": + version: 3.4.2 + resolution: "@types/luxon@npm:3.4.2" + checksum: fd89566e3026559f2bc4ddcc1e70a2c16161905ed50be9473ec0cfbbbe919165041408c4f6e06c4bcf095445535052e2c099087c76b1b38e368127e618fc968d languageName: node linkType: hard @@ -9553,7 +9553,7 @@ __metadata: "@types/js-yaml": "npm:4.0.9" "@types/leaflet": "npm:1.9.8" "@types/leaflet-draw": "npm:1.0.11" - "@types/luxon": "npm:3.4.1" + "@types/luxon": "npm:3.4.2" "@types/mocha": "npm:10.0.6" "@types/qrcode": "npm:1.5.5" "@types/serve-handler": "npm:6.1.4" From 88f67230fca2c203ead0daeb1ef57be0548ccb6e Mon Sep 17 00:00:00 2001 From: G Johansson Date: Tue, 23 Jan 2024 12:04:23 +0100 Subject: [PATCH 050/356] Preview for time_date helper (#19476) --- src/data/time_date.ts | 21 +++++ .../previews/flow-preview-time_date.ts | 94 +++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/data/time_date.ts create mode 100644 src/dialogs/config-flow/previews/flow-preview-time_date.ts diff --git a/src/data/time_date.ts b/src/data/time_date.ts new file mode 100644 index 000000000000..5f572cb658b3 --- /dev/null +++ b/src/data/time_date.ts @@ -0,0 +1,21 @@ +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { HomeAssistant } from "../types"; + +export interface TimeDatePreview { + state: string; + attributes: Record; +} + +export const subscribePreviewTimeDate = ( + hass: HomeAssistant, + flow_id: string, + flow_type: "config_flow" | "options_flow", + user_input: Record, + callback: (preview: TimeDatePreview) => void +): Promise => + hass.connection.subscribeMessage(callback, { + type: "time_date/start_preview", + flow_id, + flow_type, + user_input, + }); diff --git a/src/dialogs/config-flow/previews/flow-preview-time_date.ts b/src/dialogs/config-flow/previews/flow-preview-time_date.ts new file mode 100644 index 000000000000..fd4676ec439c --- /dev/null +++ b/src/dialogs/config-flow/previews/flow-preview-time_date.ts @@ -0,0 +1,94 @@ +import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import { LitElement, html } from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { FlowType } from "../../../data/data_entry_flow"; +import { + TimeDatePreview, + subscribePreviewTimeDate, +} from "../../../data/time_date"; +import { HomeAssistant } from "../../../types"; +import "./entity-preview-row"; +import { debounce } from "../../../common/util/debounce"; + +@customElement("flow-preview-time_date") +class FlowPreviewTimeDate extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + @property() public flowType!: FlowType; + + public handler!: string; + + @property() public stepId!: string; + + @property() public flowId!: string; + + @property() public stepData!: Record; + + @state() private _preview?: HassEntity; + + private _unsub?: Promise; + + disconnectedCallback(): void { + super.disconnectedCallback(); + if (this._unsub) { + this._unsub.then((unsub) => unsub()); + this._unsub = undefined; + } + } + + willUpdate(changedProps) { + if (changedProps.has("stepData")) { + this._debouncedSubscribePreview(); + } + } + + protected render() { + return html``; + } + + private _setPreview = (preview: TimeDatePreview) => { + const now = new Date().toISOString(); + this._preview = { + entity_id: `${this.stepId}.___flow_preview___`, + last_changed: now, + last_updated: now, + context: { id: "", parent_id: null, user_id: null }, + ...preview, + }; + }; + + private _debouncedSubscribePreview = debounce(() => { + this._subscribePreview(); + }, 250); + + private async _subscribePreview() { + if (this._unsub) { + (await this._unsub)(); + this._unsub = undefined; + } + if (this.flowType === "repair_flow") { + return; + } + try { + this._unsub = subscribePreviewTimeDate( + this.hass, + this.flowId, + this.flowType, + this.stepData, + this._setPreview + ); + await this._unsub; + } catch (err) { + this._preview = undefined; + } + } +} + +declare global { + interface HTMLElementTagNameMap { + "flow-preview-time_date": FlowPreviewTimeDate; + } +} From cc4cfe1b5c63e1b5b83951e1431a6c6b940b6892 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 23 Jan 2024 13:16:49 +0100 Subject: [PATCH 051/356] Add `set_conversation_response` action (#19512) --- src/components/trace/hat-script-graph.ts | 112 +----------------- src/data/action.ts | 3 + src/data/script.ts | 8 ++ src/data/script_i18n.ts | 9 ++ .../action/ha-automation-action-row.ts | 1 + ...mation-action-set_conversation_response.ts | 54 +++++++++ src/translations/en.json | 7 ++ 7 files changed, 85 insertions(+), 109 deletions(-) create mode 100644 src/panels/config/automation/action/types/ha-automation-action-set_conversation_response.ts diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts index 40afe60a6276..6dcfa4b5ee8d 100644 --- a/src/components/trace/hat-script-graph.ts +++ b/src/components/trace/hat-script-graph.ts @@ -13,14 +13,9 @@ import { mdiClose, mdiCodeBraces, mdiCodeBrackets, - mdiDevices, - mdiGestureDoubleTap, - mdiHandBackRight, - mdiPalette, mdiRefresh, mdiRoomService, mdiShuffleDisabled, - mdiTimerOutline, } from "@mdi/js"; import { css, html, LitElement, PropertyValues } from "lit"; import { customElement, property } from "lit/decorators"; @@ -30,17 +25,14 @@ import { Condition, Trigger } from "../../data/automation"; import { Action, ChooseAction, - DelayAction, - DeviceAction, - EventAction, IfAction, ManualScriptConfig, ParallelAction, RepeatAction, - SceneAction, ServiceAction, WaitAction, WaitForTriggerAction, + getActionType, } from "../../data/script"; import { ChooseActionTraceStep, @@ -53,6 +45,7 @@ import "./hat-graph-branch"; import { BRANCH_HEIGHT, NODE_SIZE, SPACING } from "./hat-graph-const"; import "./hat-graph-node"; import "./hat-graph-spacer"; +import { ACTION_ICONS } from "../../data/action"; export interface NodeInfo { path: string; @@ -115,17 +108,12 @@ export class HatScriptGraph extends LitElement { and: this.render_condition_node, or: this.render_condition_node, not: this.render_condition_node, - delay: this.render_delay_node, - event: this.render_event_node, - scene: this.render_scene_node, service: this.render_service_node, wait_template: this.render_wait_node, wait_for_trigger: this.render_wait_node, repeat: this.render_repeat_node, choose: this.render_choose_node, - device_id: this.render_device_node, if: this.render_if_node, - stop: this.render_stop_node, parallel: this.render_parallel_node, other: this.render_other_node, }; @@ -371,63 +359,6 @@ export class HatScriptGraph extends LitElement { `; } - private render_delay_node( - node: DelayAction, - path: string, - graphStart = false, - disabled = false - ) { - return html` - - `; - } - - private render_device_node( - node: DeviceAction, - path: string, - graphStart = false, - disabled = false - ) { - return html` - - `; - } - - private render_event_node( - node: EventAction, - path: string, - graphStart = false, - disabled = false - ) { - return html` - - `; - } - private render_repeat_node( node: RepeatAction, path: string, @@ -475,25 +406,6 @@ export class HatScriptGraph extends LitElement { `; } - private render_scene_node( - node: SceneAction, - path: string, - graphStart = false, - disabled = false - ) { - return html` - - `; - } - private render_service_node( node: ServiceAction, path: string, @@ -580,24 +492,6 @@ export class HatScriptGraph extends LitElement { `; } - private render_stop_node( - node: Action, - path: string, - graphStart = false, - disabled = false - ) { - return html` - - `; - } - private render_other_node( node: Action, path: string, @@ -607,7 +501,7 @@ export class HatScriptGraph extends LitElement { return html` ([ @@ -68,6 +70,7 @@ export const ACTION_GROUPS: AutomationElementGroup = { members: { event: {}, service: {}, + set_conversation_response: {}, }, }, } as const; diff --git a/src/data/script.ts b/src/data/script.ts index 08910dc88fcb..0f585cf1e003 100644 --- a/src/data/script.ts +++ b/src/data/script.ts @@ -248,6 +248,10 @@ export interface ParallelAction extends BaseAction { parallel: ManualScriptConfig | Action | (ManualScriptConfig | Action)[]; } +export interface SetConversationResponseAction extends BaseAction { + set_conversation_response: string; +} + interface UnknownAction extends BaseAction { [key: string]: unknown; } @@ -292,6 +296,7 @@ export interface ActionTypes { play_media: PlayMediaAction; stop: StopAction; parallel: ParallelAction; + set_conversation_response: SetConversationResponseAction; unknown: UnknownAction; } @@ -383,6 +388,9 @@ export const getActionType = (action: Action): ActionType => { if ("parallel" in action) { return "parallel"; } + if ("set_conversation_response" in action) { + return "set_conversation_response"; + } if ("service" in action) { if ("metadata" in action) { if (is(action, activateSceneActionStruct)) { diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 40c823bc862f..22d5e3c0a7bf 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -27,6 +27,7 @@ import { PlayMediaAction, RepeatAction, SceneAction, + SetConversationResponseAction, StopAction, VariablesAction, WaitForTriggerAction, @@ -443,5 +444,13 @@ const tryDescribeAction = ( ); } + if (actionType === "set_conversation_response") { + const config = action as SetConversationResponseAction; + return hass.localize( + `${actionTranslationBaseKey}.set_conversation_response.description.full`, + { response: config.set_conversation_response } + ); + } + return actionType; }; diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index 64c469a0db4c..69e811b0ba4d 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -77,6 +77,7 @@ import "./types/ha-automation-action-service"; import "./types/ha-automation-action-stop"; import "./types/ha-automation-action-wait_for_trigger"; import "./types/ha-automation-action-wait_template"; +import "./types/ha-automation-action-set_conversation_response"; export const getType = (action: Action | undefined) => { if (!action) { diff --git a/src/panels/config/automation/action/types/ha-automation-action-set_conversation_response.ts b/src/panels/config/automation/action/types/ha-automation-action-set_conversation_response.ts new file mode 100644 index 000000000000..b4c9b9c51ded --- /dev/null +++ b/src/panels/config/automation/action/types/ha-automation-action-set_conversation_response.ts @@ -0,0 +1,54 @@ +import { html, LitElement } from "lit"; +import { customElement, property } from "lit/decorators"; +import "../../../../../components/ha-form/ha-form"; +import type { SetConversationResponseAction } from "../../../../../data/script"; +import type { HomeAssistant } from "../../../../../types"; +import type { ActionElement } from "../ha-automation-action-row"; + +const SCHEMA = [ + { + name: "set_conversation_response", + selector: { + template: {}, + }, + }, +] as const; + +@customElement("ha-automation-action-set_conversation_response") +export class HaSetConversationResponseAction + extends LitElement + implements ActionElement +{ + @property({ attribute: false }) public hass!: HomeAssistant; + + @property({ attribute: false }) public action!: SetConversationResponseAction; + + @property({ type: Boolean }) public disabled = false; + + public static get defaultConfig() { + return { set_conversation_response: "" }; + } + + protected render() { + return html` + + `; + } + + private _computeLabelCallback = (): string => + this.hass.localize( + "ui.panel.config.automation.editor.actions.type.set_conversation_response.label" + ); +} + +declare global { + interface HTMLElementTagNameMap { + "ha-automation-action-set_conversation_response": HaSetConversationResponseAction; + } +} diff --git a/src/translations/en.json b/src/translations/en.json index 0bb3f0844d19..c55dd8963365 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3117,6 +3117,13 @@ "full": "Test {condition}" } }, + "set_conversation_response": { + "label": "Set conversation response", + "description": { + "picker": "Set response of conversation when automation was triggered by conversation trigger.", + "full": "Set response of conversation to {response}" + } + }, "unknown": { "label": "Unknown" } From 807d08d8eb8b1ab51d7b1dcc57f870da3545bb6e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:11:52 -0500 Subject: [PATCH 052/356] Update dependency core-js to v3.35.1 (#19519) --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f941eb0ffa7e..bb79acc2a583 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "app-datepicker": "5.1.1", "chart.js": "4.4.1", "comlink": "4.4.1", - "core-js": "3.35.0", + "core-js": "3.35.1", "cropperjs": "1.6.1", "date-fns": "2.30.0", "date-fns-tz": "2.0.0", diff --git a/yarn.lock b/yarn.lock index 798dc1ac3b21..863091057102 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6983,10 +6983,10 @@ __metadata: languageName: node linkType: hard -"core-js@npm:3.35.0": - version: 3.35.0 - resolution: "core-js@npm:3.35.0" - checksum: 0815fce6bcc91d79d4b28885975453b0faa4d17fc2230635102b4f3832cd621035e4032aa3307e1dbe0ee14d5e34bcb64b507fd89bd8f567aedaf29538522e6a +"core-js@npm:3.35.1": + version: 3.35.1 + resolution: "core-js@npm:3.35.1" + checksum: 5d31f22eb05cf66bd1a2088a04b7106faa5d0b91c1ffa5d72c5203e4974c31bd7e11969297f540a806c00c74c23991eaad5639592df8b5dbe4412fff3c075cd5 languageName: node linkType: hard @@ -9579,7 +9579,7 @@ __metadata: chai: "npm:5.0.0" chart.js: "npm:4.4.1" comlink: "npm:4.4.1" - core-js: "npm:3.35.0" + core-js: "npm:3.35.1" cropperjs: "npm:1.6.1" date-fns: "npm:2.30.0" date-fns-tz: "npm:2.0.0" From beb3454f8d2012d69ed3ce91672e617c9bb9cacc Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 24 Jan 2024 18:16:59 +0100 Subject: [PATCH 053/356] Hide fallback when dragging items in sidebar (#19521) --- src/components/ha-sortable.ts | 3 +-- src/resources/sortable.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/ha-sortable.ts b/src/components/ha-sortable.ts index 248a0171f8ae..b188620c87d0 100644 --- a/src/components/ha-sortable.ts +++ b/src/components/ha-sortable.ts @@ -77,8 +77,7 @@ export class HaSortable extends LitElement { return html`