Fixes multiple domains target selector in blueprint (#15054)

* Fixes multiple domains target selector in blueprint

* Fixes lint
This commit is contained in:
Paul Bottein 2023-01-10 18:28:34 +01:00 committed by GitHub
parent dcedafaef4
commit 45e7f8ae06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -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}
></ha-target-picker>`;

View File

@ -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) ||

View File

@ -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) ||