From 45e7f8ae06d07335d3ec17299b3bc75379591e7d Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 10 Jan 2023 18:28:34 +0100 Subject: [PATCH] Fixes multiple domains target selector in blueprint (#15054) * Fixes multiple domains target selector in blueprint * Fixes lint --- src/components/ha-selector/ha-selector-target.ts | 3 ++- src/panels/config/automation/blueprint-automation-editor.ts | 2 +- src/panels/config/script/blueprint-script-editor.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/ha-selector/ha-selector-target.ts b/src/components/ha-selector/ha-selector-target.ts index e4cf47278d..9853d1552e 100644 --- a/src/components/ha-selector/ha-selector-target.ts +++ b/src/components/ha-selector/ha-selector-target.ts @@ -9,6 +9,7 @@ import { } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; +import { ensureArray } from "../../common/array/ensure-array"; import { DeviceRegistryEntry, getDeviceIntegrationLookup, @@ -78,7 +79,7 @@ export class HaTargetSelector extends LitElement { ? [this.selector.target?.entity.device_class] : undefined} .includeDomains=${this.selector.target?.entity?.domain - ? [this.selector.target?.entity.domain] + ? ensureArray(this.selector.target.entity.domain as string | string[]) : undefined} .disabled=${this.disabled} >`; diff --git a/src/panels/config/automation/blueprint-automation-editor.ts b/src/panels/config/automation/blueprint-automation-editor.ts index 8eb563bd10..43b0ccf681 100644 --- a/src/panels/config/automation/blueprint-automation-editor.ts +++ b/src/panels/config/automation/blueprint-automation-editor.ts @@ -184,7 +184,7 @@ export class HaBlueprintAutomationEditor extends LitElement { ev.stopPropagation(); const target = ev.target as any; const key = target.key; - const value = ev.detail?.value ?? target.value; + const value = ev.detail ? ev.detail.value : target.value; if ( (this.config.use_blueprint.input && this.config.use_blueprint.input[key] === value) || diff --git a/src/panels/config/script/blueprint-script-editor.ts b/src/panels/config/script/blueprint-script-editor.ts index 3e4f3e8ec8..20746fcdbb 100644 --- a/src/panels/config/script/blueprint-script-editor.ts +++ b/src/panels/config/script/blueprint-script-editor.ts @@ -158,7 +158,7 @@ export class HaBlueprintScriptEditor extends LitElement { ev.stopPropagation(); const target = ev.target as any; const key = target.key; - const value = ev.detail?.value ?? target.value; + const value = ev.detail ? ev.detail.value : target.value; if ( (this.config.use_blueprint.input && this.config.use_blueprint.input[key] === value) ||