diff --git a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts index afbfb57b97..89c4e045f1 100644 --- a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts @@ -14,7 +14,7 @@ import "../../../components/entity/ha-entity-toggle"; import "../components/hui-warning"; import { HomeAssistant } from "../../../types"; -import { LovelaceRow, EntityConfig } from "./types"; +import { LovelaceRow, ActionRowConfig } from "./types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { activateScene } from "../../../data/scene"; @@ -22,9 +22,9 @@ import { activateScene } from "../../../data/scene"; class HuiSceneEntityRow extends LitElement implements LovelaceRow { @property() public hass!: HomeAssistant; - @property() private _config?: EntityConfig; + @property() private _config?: ActionRowConfig; - public setConfig(config: EntityConfig): void { + public setConfig(config: ActionRowConfig): void { if (!config) { throw new Error("Configuration error"); } @@ -65,7 +65,8 @@ class HuiSceneEntityRow extends LitElement implements LovelaceRow { ` : html` - ${this.hass!.localize("ui.card.scene.activate")} + ${this._config.action_name || + this.hass!.localize("ui.card.scene.activate")} `} diff --git a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts index 18d7ec016b..f981fa7c17 100644 --- a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts @@ -14,16 +14,16 @@ import "../../../components/entity/ha-entity-toggle"; import "../components/hui-warning"; import { HomeAssistant } from "../../../types"; -import { LovelaceRow, EntityConfig } from "./types"; +import { LovelaceRow, ActionRowConfig } from "./types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; @customElement("hui-script-entity-row") class HuiScriptEntityRow extends LitElement implements LovelaceRow { public hass?: HomeAssistant; - @property() private _config?: EntityConfig; + @property() private _config?: ActionRowConfig; - public setConfig(config: EntityConfig): void { + public setConfig(config: ActionRowConfig): void { if (!config) { throw new Error("Configuration error"); } @@ -64,7 +64,8 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow { ` : html` - ${this.hass!.localize("ui.card.script.execute")} + ${this._config.action_name || + this.hass!.localize("ui.card.script.execute")} `} diff --git a/src/panels/lovelace/entity-rows/types.ts b/src/panels/lovelace/entity-rows/types.ts index 95fdd683c3..28c740e719 100644 --- a/src/panels/lovelace/entity-rows/types.ts +++ b/src/panels/lovelace/entity-rows/types.ts @@ -8,6 +8,9 @@ export interface EntityConfig { icon?: string; image?: string; } +export interface ActionRowConfig extends EntityConfig { + action_name?: string; +} export interface EntityFilterEntityConfig extends EntityConfig { state_filter?: Array<{ key: string } | string>; } 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 fb724bce81..4d5624d649 100644 --- a/src/panels/lovelace/special-rows/hui-call-service-row.ts +++ b/src/panels/lovelace/special-rows/hui-call-service-row.ts @@ -26,7 +26,7 @@ class HuiCallServiceRow extends LitElement implements LovelaceRow { throw new Error("Error in card configuration."); } - this._config = { icon: "hass:remote", action_name: "Run", ...config }; + this._config = { icon: "hass:remote", ...config }; } protected render(): TemplateResult | void { @@ -39,7 +39,9 @@ class HuiCallServiceRow extends LitElement implements LovelaceRow {
${this._config.name}
${this._config.action_name}${this._config.action_name + ? this._config.action_name + : this.hass!.localize("ui.card.service.run")}
`; diff --git a/src/translations/en.json b/src/translations/en.json index b71add4930..4530b8a2e8 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -460,6 +460,9 @@ "script": { "execute": "Execute" }, + "service": { + "run": "Run" + }, "timer": { "actions": { "start": "start",