diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 81b56f58c5..3634db2e2c 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -627,7 +627,7 @@ export class HaServiceControl extends LitElement { const fieldDataHasTemplate = this._value?.data && hasTemplate(this._value.data[dataField.key]); - let selector = + const selector = fieldDataHasTemplate && typeof this._value!.data![dataField.key] === "string" ? { template: null } @@ -637,16 +637,6 @@ export class HaServiceControl extends LitElement { : (this._stickySelector[dataField.key] ?? dataField?.selector ?? { text: null }); - if ("state" in selector) { - selector = { - ...selector, - state: { - ...selector.state, - entity_id: targetEntities || undefined, - }, - }; - } - if (fieldDataHasTemplate) { // Hold this selector type until the field is cleared this._stickySelector[dataField.key] = selector; @@ -685,6 +675,7 @@ export class HaServiceControl extends LitElement { ) || dataField?.description} ({ + filter_entity: targetEntities || undefined, + })); + private _localizeValueCallback = (key: string) => { if (!this._value?.action) { return ""; diff --git a/src/data/selector.ts b/src/data/selector.ts index b8ae831dc4..3dfba90532 100644 --- a/src/data/selector.ts +++ b/src/data/selector.ts @@ -98,7 +98,7 @@ export interface AreasDisplaySelector { export interface AttributeSelector { attribute: { - entity_id?: string; + entity_id?: string | string[]; hide_attributes?: readonly string[]; } | null; }