From 52b85f7b822afa410b3234e649c81f3024431d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sun, 8 May 2022 14:45:40 +0000 Subject: [PATCH 1/6] Change service_data to just data --- src/components/ha-service-control.ts | 4 +--- src/data/lovelace.ts | 5 ++--- src/panels/lovelace/cards/types.ts | 1 + .../lovelace/common/compute-unused-entities.ts | 12 ++++++++---- src/panels/lovelace/common/handle-action.ts | 2 +- src/panels/lovelace/components/hui-action-editor.ts | 4 ++-- .../config-elements/hui-entities-card-editor.ts | 1 + src/panels/lovelace/editor/structs/action-struct.ts | 1 + .../lovelace/elements/hui-service-button-element.ts | 2 +- src/panels/lovelace/elements/types.ts | 1 + src/panels/lovelace/entity-rows/types.ts | 1 + .../lovelace/special-rows/hui-call-service-row.ts | 2 +- src/translations/en.json | 2 +- 13 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 966052e4a694..54cca6a76500 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -287,9 +287,7 @@ export class HaServiceControl extends LitElement { ${shouldRenderServiceDataYaml ? html`; + data?: Record; } export interface NavigateActionConfig extends BaseActionConfig { diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index f596046e6360..a308ce6aa9e5 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -55,6 +55,7 @@ export interface EntitiesCardEntityConfig extends EntityConfig { action_name?: string; service?: string; service_data?: Record; + data?: Record; url?: string; tap_action?: ActionConfig; hold_action?: ActionConfig; diff --git a/src/panels/lovelace/common/compute-unused-entities.ts b/src/panels/lovelace/common/compute-unused-entities.ts index a6759235412e..2408aac2ea2c 100755 --- a/src/panels/lovelace/common/compute-unused-entities.ts +++ b/src/panels/lovelace/common/compute-unused-entities.ts @@ -6,16 +6,20 @@ export const EXCLUDED_DOMAINS = ["zone", "persistent_notification"]; const addFromAction = (entities: Set, actionConfig: ActionConfig) => { if ( actionConfig.action !== "call-service" || - !actionConfig.service_data || - !actionConfig.service_data.entity_id + (!actionConfig.target?.entity_id && + !actionConfig.service_data?.entity_id && + !actionConfig.data?.entity_id) ) { return; } - let entityIds = actionConfig.service_data.entity_id; + let entityIds = + actionConfig.service_data?.entity_id ?? + actionConfig.data?.entity_id ?? + actionConfig.target?.entity_id; if (!Array.isArray(entityIds)) { entityIds = [entityIds]; } - for (const entityId of entityIds) { + for (const entityId of entityIds as Array) { entities.add(entityId); } }; diff --git a/src/panels/lovelace/common/handle-action.ts b/src/panels/lovelace/common/handle-action.ts index 7bdbea4f4927..22132f04c9fb 100644 --- a/src/panels/lovelace/common/handle-action.ts +++ b/src/panels/lovelace/common/handle-action.ts @@ -148,7 +148,7 @@ export const handleAction = async ( hass.callService( domain, service, - actionConfig.service_data, + actionConfig.service_data ?? actionConfig.data, actionConfig.target ); forwardHaptic("light"); diff --git a/src/panels/lovelace/components/hui-action-editor.ts b/src/panels/lovelace/components/hui-action-editor.ts index 3ec925e58f89..be9cb9b50fff 100644 --- a/src/panels/lovelace/components/hui-action-editor.ts +++ b/src/panels/lovelace/components/hui-action-editor.ts @@ -45,7 +45,7 @@ export class HuiActionEditor extends LitElement { private _serviceAction = memoizeOne( (config: CallServiceActionConfig): ServiceAction => ({ service: this._service, - data: config.service_data, + data: config.service_data ?? config.data, target: config.target, }) ); @@ -183,7 +183,7 @@ export class HuiActionEditor extends LitElement { value: { ...this.config!, service: ev.detail.value.service || "", - service_data: ev.detail.value.data || {}, + data: ev.detail.value.data || {}, target: ev.detail.value.target || {}, }, }); diff --git a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts index 536eede67c17..20e7720802f8 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts @@ -77,6 +77,7 @@ const callServiceEntitiesRowConfigStruct = object({ icon: optional(string()), action_name: optional(string()), service_data: optional(any()), + data: optional(any()), }); const conditionalEntitiesRowConfigStruct = object({ diff --git a/src/panels/lovelace/editor/structs/action-struct.ts b/src/panels/lovelace/editor/structs/action-struct.ts index cee149e6d224..ef7a479bb2e0 100644 --- a/src/panels/lovelace/editor/structs/action-struct.ts +++ b/src/panels/lovelace/editor/structs/action-struct.ts @@ -32,6 +32,7 @@ const actionConfigStructService = object({ action: literal("call-service"), service: string(), service_data: optional(object()), + data: optional(object()), target: optional( object({ entity_id: optional(union([string(), array(string())])), diff --git a/src/panels/lovelace/elements/hui-service-button-element.ts b/src/panels/lovelace/elements/hui-service-button-element.ts index 4fc28e705159..cc1d456a63ed 100644 --- a/src/panels/lovelace/elements/hui-service-button-element.ts +++ b/src/panels/lovelace/elements/hui-service-button-element.ts @@ -45,7 +45,7 @@ export class HuiServiceButtonElement .hass=${this.hass} .domain=${this._domain} .service=${this._service} - .serviceData=${this._config.service_data} + .serviceData=${this._config.service_data ?? this._config.data} >${this._config.title} `; diff --git a/src/panels/lovelace/elements/types.ts b/src/panels/lovelace/elements/types.ts index 1894946a1313..17ab69f1984b 100644 --- a/src/panels/lovelace/elements/types.ts +++ b/src/panels/lovelace/elements/types.ts @@ -52,6 +52,7 @@ export interface ServiceButtonElementConfig extends LovelaceElementConfigBase { title?: string; service?: string; service_data?: Record; + data?: Record; } export interface StateBadgeElementConfig extends LovelaceElementConfigBase { diff --git a/src/panels/lovelace/entity-rows/types.ts b/src/panels/lovelace/entity-rows/types.ts index 47131f09e6fb..6ec33ac5ec8a 100644 --- a/src/panels/lovelace/entity-rows/types.ts +++ b/src/panels/lovelace/entity-rows/types.ts @@ -42,6 +42,7 @@ export interface CallServiceConfig extends EntityConfig { type: "call-service"; service: string; service_data?: Record; + data?: Record; action_name?: string; } export interface ButtonRowConfig extends EntityConfig { diff --git a/src/panels/lovelace/special-rows/hui-call-service-row.ts b/src/panels/lovelace/special-rows/hui-call-service-row.ts index 5f461d518018..8b3591fb8444 100644 --- a/src/panels/lovelace/special-rows/hui-call-service-row.ts +++ b/src/panels/lovelace/special-rows/hui-call-service-row.ts @@ -23,7 +23,7 @@ export class HuiCallServiceRow extends HuiButtonRow { tap_action: { action: "call-service", service: callServiceConfig.service, - service_data: callServiceConfig.service_data, + data: callServiceConfig.service_data ?? callServiceConfig.data, }, ...callServiceConfig, type: "button", diff --git a/src/translations/en.json b/src/translations/en.json index 3d9ec3ff9e7c..9c4f4e1261d0 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -518,7 +518,7 @@ "required": "This field is required", "target": "Targets", "target_description": "What should this service use as targeted areas, devices or entities.", - "service_data": "Service data", + "data": "Service data", "integration_doc": "Integration documentation" }, "related-items": { From 276faf130a31fe8904b0dd3e524b052384d1c0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sat, 21 May 2022 17:49:32 +0000 Subject: [PATCH 2/6] Automatically replace service_data with data on update --- .../lovelace/components/hui-action-editor.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/panels/lovelace/components/hui-action-editor.ts b/src/panels/lovelace/components/hui-action-editor.ts index be9cb9b50fff..ba7878bf6cde 100644 --- a/src/panels/lovelace/components/hui-action-editor.ts +++ b/src/panels/lovelace/components/hui-action-editor.ts @@ -179,14 +179,18 @@ export class HuiActionEditor extends LitElement { private _serviceValueChanged(ev: CustomEvent) { ev.stopPropagation(); - fireEvent(this, "value-changed", { - value: { - ...this.config!, - service: ev.detail.value.service || "", - data: ev.detail.value.data || {}, - target: ev.detail.value.target || {}, - }, - }); + const value = { + ...this.config!, + service: ev.detail.value.service || "", + data: ev.detail.value.data || {}, + target: ev.detail.value.target || {}, + }; + // "service_data" is allowed for backwards compatibility but replaced with "data" on write + if ("service_data" in value) { + delete value.service_data; + } + + fireEvent(this, "value-changed", { value }); } static get styles(): CSSResultGroup { From 9b9ee5f993d8f702ec05597178cf79b4e995c9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sat, 21 May 2022 17:54:10 +0000 Subject: [PATCH 3/6] Flip priority of data and service_data --- src/data/lovelace.ts | 1 + src/panels/lovelace/common/handle-action.ts | 2 +- src/panels/lovelace/components/hui-action-editor.ts | 2 +- src/panels/lovelace/elements/hui-service-button-element.ts | 2 +- src/panels/lovelace/elements/types.ts | 1 + src/panels/lovelace/special-rows/hui-call-service-row.ts | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/data/lovelace.ts b/src/data/lovelace.ts index cf6efa0d1836..aeabf1a05d62 100644 --- a/src/data/lovelace.ts +++ b/src/data/lovelace.ts @@ -131,6 +131,7 @@ export interface CallServiceActionConfig extends BaseActionConfig { action: "call-service"; service: string; target?: HassServiceTarget; + // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; data?: Record; } diff --git a/src/panels/lovelace/common/handle-action.ts b/src/panels/lovelace/common/handle-action.ts index 22132f04c9fb..ef489d49ca2d 100644 --- a/src/panels/lovelace/common/handle-action.ts +++ b/src/panels/lovelace/common/handle-action.ts @@ -148,7 +148,7 @@ export const handleAction = async ( hass.callService( domain, service, - actionConfig.service_data ?? actionConfig.data, + actionConfig.data ?? actionConfig.service_data, actionConfig.target ); forwardHaptic("light"); diff --git a/src/panels/lovelace/components/hui-action-editor.ts b/src/panels/lovelace/components/hui-action-editor.ts index ba7878bf6cde..0874c7e3b8c3 100644 --- a/src/panels/lovelace/components/hui-action-editor.ts +++ b/src/panels/lovelace/components/hui-action-editor.ts @@ -45,7 +45,7 @@ export class HuiActionEditor extends LitElement { private _serviceAction = memoizeOne( (config: CallServiceActionConfig): ServiceAction => ({ service: this._service, - data: config.service_data ?? config.data, + data: config.data ?? config.service_data, target: config.target, }) ); diff --git a/src/panels/lovelace/elements/hui-service-button-element.ts b/src/panels/lovelace/elements/hui-service-button-element.ts index cc1d456a63ed..e0da159b58bc 100644 --- a/src/panels/lovelace/elements/hui-service-button-element.ts +++ b/src/panels/lovelace/elements/hui-service-button-element.ts @@ -45,7 +45,7 @@ export class HuiServiceButtonElement .hass=${this.hass} .domain=${this._domain} .service=${this._service} - .serviceData=${this._config.service_data ?? this._config.data} + .serviceData=${this._config.data ?? this._config.service_data} >${this._config.title} `; diff --git a/src/panels/lovelace/elements/types.ts b/src/panels/lovelace/elements/types.ts index 17ab69f1984b..2c2f7429c8c8 100644 --- a/src/panels/lovelace/elements/types.ts +++ b/src/panels/lovelace/elements/types.ts @@ -51,6 +51,7 @@ export interface ImageElementConfig extends LovelaceElementConfigBase { export interface ServiceButtonElementConfig extends LovelaceElementConfigBase { title?: string; service?: string; + // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; data?: Record; } diff --git a/src/panels/lovelace/special-rows/hui-call-service-row.ts b/src/panels/lovelace/special-rows/hui-call-service-row.ts index 8b3591fb8444..4946d31f81af 100644 --- a/src/panels/lovelace/special-rows/hui-call-service-row.ts +++ b/src/panels/lovelace/special-rows/hui-call-service-row.ts @@ -23,7 +23,7 @@ export class HuiCallServiceRow extends HuiButtonRow { tap_action: { action: "call-service", service: callServiceConfig.service, - data: callServiceConfig.service_data ?? callServiceConfig.data, + data: callServiceConfig.data ?? callServiceConfig.service_data, }, ...callServiceConfig, type: "button", From e936f415d6fbbd51aa8b157a3d3e2ede5387af62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sat, 21 May 2022 17:59:24 +0000 Subject: [PATCH 4/6] Update gallery and demo --- demo/src/configs/jimpower/lovelace.ts | 2 +- demo/src/configs/teachingbirds/lovelace.ts | 18 +++++++++--------- gallery/src/data/traces/basic_trace.ts | 8 ++++---- gallery/src/pages/lovelace/entities-card.ts | 2 +- gallery/src/pages/lovelace/glance-card.ts | 2 +- .../pages/lovelace/picture-elements-card.ts | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/demo/src/configs/jimpower/lovelace.ts b/demo/src/configs/jimpower/lovelace.ts index 3f9ba918cb61..934dfa7d10fb 100644 --- a/demo/src/configs/jimpower/lovelace.ts +++ b/demo/src/configs/jimpower/lovelace.ts @@ -194,7 +194,7 @@ export const demoLovelaceJimpower: DemoConfig["lovelace"] = () => ({ type: "state-icon", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "group.downstairs_lights", }, service: "homeassistant.toggle", diff --git a/demo/src/configs/teachingbirds/lovelace.ts b/demo/src/configs/teachingbirds/lovelace.ts index 9fbf61202399..1ff4ff8807be 100644 --- a/demo/src/configs/teachingbirds/lovelace.ts +++ b/demo/src/configs/teachingbirds/lovelace.ts @@ -377,7 +377,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ name: "AC bed", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "script.air_cleaner_quiet", }, service: "script.turn_on", @@ -390,7 +390,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ name: "AC bed", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "script.air_cleaner_auto", }, service: "script.turn_on", @@ -403,7 +403,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ name: "AC bed", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "script.air_cleaner_turbo", }, service: "script.turn_on", @@ -416,7 +416,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ name: "AC", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "script.ac_off", }, service: "script.turn_on", @@ -429,7 +429,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ name: "AC", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "script.ac_on", }, service: "script.turn_on", @@ -629,7 +629,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ entity: "scene.morning_lights", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "scene.morning_lights", }, service: "scene.turn_on", @@ -641,7 +641,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ entity: "scene.movie_time", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "scene.movie_time", }, service: "scene.turn_on", @@ -702,7 +702,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ entity: "light.downstairs_lights", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "light.downstairs_lights", }, service: "light.toggle", @@ -714,7 +714,7 @@ export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ entity: "light.upstairs_lights", tap_action: { action: "call-service", - service_data: { + data: { entity_id: "light.upstairs_lights", }, service: "light.toggle", diff --git a/gallery/src/data/traces/basic_trace.ts b/gallery/src/data/traces/basic_trace.ts index 6345b4f84520..8fbd720e127c 100644 --- a/gallery/src/data/traces/basic_trace.ts +++ b/gallery/src/data/traces/basic_trace.ts @@ -119,7 +119,7 @@ export const basicTrace: DemoTrace = { params: { domain: "input_boolean", service: "toggle", - service_data: {}, + data: {}, target: { entity_id: ["input_boolean.toggle_4"], }, @@ -164,7 +164,7 @@ export const basicTrace: DemoTrace = { params: { domain: "input_boolean", service: "toggle", - service_data: {}, + data: {}, target: { entity_id: ["input_boolean.toggle_2"], }, @@ -182,7 +182,7 @@ export const basicTrace: DemoTrace = { params: { domain: "input_boolean", service: "toggle", - service_data: {}, + data: {}, target: { entity_id: ["input_boolean.toggle_3"], }, @@ -200,7 +200,7 @@ export const basicTrace: DemoTrace = { params: { domain: "input_boolean", service: "toggle", - service_data: {}, + data: {}, target: { entity_id: ["input_boolean.toggle_4"], }, diff --git a/gallery/src/pages/lovelace/entities-card.ts b/gallery/src/pages/lovelace/entities-card.ts index ce13f327b5af..a4fc76a510d8 100644 --- a/gallery/src/pages/lovelace/entities-card.ts +++ b/gallery/src/pages/lovelace/entities-card.ts @@ -249,7 +249,7 @@ const CONFIGS = [ name: Bed light action_name: Toggle light service: light.toggle - service_data: + data: entity_id: light.bed_light - type: section label: Links diff --git a/gallery/src/pages/lovelace/glance-card.ts b/gallery/src/pages/lovelace/glance-card.ts index 1e4d0755dfb6..14941aaa4ed7 100644 --- a/gallery/src/pages/lovelace/glance-card.ts +++ b/gallery/src/pages/lovelace/glance-card.ts @@ -199,7 +199,7 @@ const CONFIGS = [ tap_action: action: call-service service: light.turn_on - service_data: + data: entity_id: light.ceiling_lights - entity: sun.sun name: Regular diff --git a/gallery/src/pages/lovelace/picture-elements-card.ts b/gallery/src/pages/lovelace/picture-elements-card.ts index f1f594115705..588d6be9bfec 100644 --- a/gallery/src/pages/lovelace/picture-elements-card.ts +++ b/gallery/src/pages/lovelace/picture-elements-card.ts @@ -40,7 +40,7 @@ const CONFIGS = [ left: 90% padding: 0px service: light.turn_off - service_data: + data: entity_id: group.all_lights - type: icon icon: mdi:cctv @@ -88,7 +88,7 @@ const CONFIGS = [ left: 90% padding: 0px service: light.turn_off - service_data: + data: entity_id: group.all_lights - type: icon icon: mdi:cctv From b5e9e79a07f4183b47c6576a48fdd64cc9369d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Sat, 21 May 2022 18:02:11 +0000 Subject: [PATCH 5/6] Add more deprecation explanations --- src/panels/lovelace/cards/types.ts | 1 + .../lovelace/editor/config-elements/hui-entities-card-editor.ts | 1 + src/panels/lovelace/entity-rows/types.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index a308ce6aa9e5..e6189150e17a 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -54,6 +54,7 @@ export interface EntitiesCardEntityConfig extends EntityConfig { | "brightness"; action_name?: string; service?: string; + // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; data?: Record; url?: string; diff --git a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts index 20e7720802f8..78b18d7230ef 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts @@ -76,6 +76,7 @@ const callServiceEntitiesRowConfigStruct = object({ service: string(), icon: optional(string()), action_name: optional(string()), + // "service_data" is kept for backwards compatibility. Replaced by "data". service_data: optional(any()), data: optional(any()), }); diff --git a/src/panels/lovelace/entity-rows/types.ts b/src/panels/lovelace/entity-rows/types.ts index 6ec33ac5ec8a..bf6a4798fc89 100644 --- a/src/panels/lovelace/entity-rows/types.ts +++ b/src/panels/lovelace/entity-rows/types.ts @@ -41,6 +41,7 @@ export interface TextConfig { export interface CallServiceConfig extends EntityConfig { type: "call-service"; service: string; + // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; data?: Record; action_name?: string; From 3bb739255868e2911d10993ff2acae554b46a332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Tue, 24 May 2022 10:19:45 +0000 Subject: [PATCH 6/6] Don't change service-button-element and call-service row. --- src/panels/lovelace/elements/hui-service-button-element.ts | 2 +- src/panels/lovelace/elements/types.ts | 2 -- src/panels/lovelace/entity-rows/types.ts | 2 -- src/panels/lovelace/special-rows/hui-call-service-row.ts | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/panels/lovelace/elements/hui-service-button-element.ts b/src/panels/lovelace/elements/hui-service-button-element.ts index e0da159b58bc..4fc28e705159 100644 --- a/src/panels/lovelace/elements/hui-service-button-element.ts +++ b/src/panels/lovelace/elements/hui-service-button-element.ts @@ -45,7 +45,7 @@ export class HuiServiceButtonElement .hass=${this.hass} .domain=${this._domain} .service=${this._service} - .serviceData=${this._config.data ?? this._config.service_data} + .serviceData=${this._config.service_data} >${this._config.title} `; diff --git a/src/panels/lovelace/elements/types.ts b/src/panels/lovelace/elements/types.ts index 2c2f7429c8c8..1894946a1313 100644 --- a/src/panels/lovelace/elements/types.ts +++ b/src/panels/lovelace/elements/types.ts @@ -51,9 +51,7 @@ export interface ImageElementConfig extends LovelaceElementConfigBase { export interface ServiceButtonElementConfig extends LovelaceElementConfigBase { title?: string; service?: string; - // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; - data?: Record; } export interface StateBadgeElementConfig extends LovelaceElementConfigBase { diff --git a/src/panels/lovelace/entity-rows/types.ts b/src/panels/lovelace/entity-rows/types.ts index bf6a4798fc89..47131f09e6fb 100644 --- a/src/panels/lovelace/entity-rows/types.ts +++ b/src/panels/lovelace/entity-rows/types.ts @@ -41,9 +41,7 @@ export interface TextConfig { export interface CallServiceConfig extends EntityConfig { type: "call-service"; service: string; - // "service_data" is kept for backwards compatibility. Replaced by "data". service_data?: Record; - data?: Record; action_name?: string; } export interface ButtonRowConfig extends EntityConfig { diff --git a/src/panels/lovelace/special-rows/hui-call-service-row.ts b/src/panels/lovelace/special-rows/hui-call-service-row.ts index 4946d31f81af..249debf09532 100644 --- a/src/panels/lovelace/special-rows/hui-call-service-row.ts +++ b/src/panels/lovelace/special-rows/hui-call-service-row.ts @@ -23,7 +23,7 @@ export class HuiCallServiceRow extends HuiButtonRow { tap_action: { action: "call-service", service: callServiceConfig.service, - data: callServiceConfig.data ?? callServiceConfig.service_data, + data: callServiceConfig.service_data, }, ...callServiceConfig, type: "button",