add action_name option for scene/script rows (#4571)

*  add action_name option for scene/script rows

* address review comments
This commit is contained in:
Ian Richardson
2020-01-24 16:01:01 -06:00
committed by Bram Kragten
parent ef6e468a7f
commit 1f38d13b3b
5 changed files with 20 additions and 10 deletions

View File

@@ -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`
<mwc-button @click="${this._callService}">
${this.hass!.localize("ui.card.script.execute")}
${this._config.action_name ||
this.hass!.localize("ui.card.script.execute")}
</mwc-button>
`}
</hui-generic-entity-row>