Use toggle as default icon_tap_action for scenes and buttons in tile card (#14386)

This commit is contained in:
Paul Bottein 2022-11-28 12:37:27 +01:00 committed by GitHub
parent aa1e9cedca
commit d6fa1427f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,14 +73,17 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
throw new Error("Specify an entity");
}
const supportToggle = DOMAINS_TOGGLE.has(computeDomain(config.entity));
const domain = computeDomain(config.entity);
const supportsIconAction =
DOMAINS_TOGGLE.has(domain) ||
["button", "input_button", "scene"].includes(domain);
this._config = {
tap_action: {
action: "more-info",
},
icon_tap_action: {
action: supportToggle ? "toggle" : "more-info",
action: supportsIconAction ? "toggle" : "more-info",
},
...config,
};