Action buttons
Action buttons is a card feature for the cards in Home Assistant that take features: the tile card, the area card, the thermostat card and the humidifier card. A row of buttons under the card, and you decide what each one does.
Per button:
- An icon, a label, or both.
- An optional entity. The button lights up while it is on, in the colour Home Assistant gives that state.
- An action: anything a card can do when you tap it. Perform an action, toggle, open more info, navigate to another dashboard, open a URL, or start Assist.
- An optional "are you sure?". Home Assistant asks first, and only acts on a yes.
The buttons do not care what the card shows. A tile of the garage door can have a button that turns on the driveway lights. An area card can have a button that runs your "good night" script.
It needs Spook on your dashboards switched on.
Adding it to a card
- Open the dashboard, and edit it.
- Edit a tile, area, thermostat or humidifier card, or add one.
- Open Features, select Add feature, and select Action buttons (Spook).
- Select the pencil next to it, and select Add for every button you want.
- Select Save.
It starts empty. A feature without buttons shows nothing.
Options
Per button:
| Option | What it does |
|---|---|
| Label | Shown on the button, and read out by a screen reader. On a narrow card, a button with an icon too shows only the icon. |
| Icon | Shown on the button. |
| Entity | The button lights up while this one is on, and Toggle and More info act on it. Without one, they act on the card's own entity. |
| Action | What pressing the button does. The same choice of actions as the tap action of any card. Left on the default, the button does nothing. |
| Ask before it runs | Home Assistant asks "are you sure?" first, and only acts on a yes. |
Drag the buttons in the list to change their order: left to right on the card.
In YAML
type: tile
entity: cover.garage_door
features:
- type: custom:spook-action-buttons-feature
buttons:
- label: Open
icon: mdi:garage-open
confirmation: true
tap_action:
action: perform-action
perform_action: cover.open_cover
target:
entity_id: cover.garage_door
- label: Driveway
icon: mdi:car-light-high
tap_action:
action: perform-action
perform_action: light.turn_on
target:
entity_id: light.driveway
- icon: mdi:information-outline
label: Details
tap_action:
action: more-info
tap_action takes what the tap action of any Home Assistant card takes, written the same way. See actions on dashboards in the Home Assistant documentation.
confirmation: true asks with Home Assistant's own question. To ask in your own words, give it what a card's confirmation takes:
confirmation:
text: The car is still in there. Open anyway?
exemptions:
- user: 59a1a7b5e3e14f4a9d0e1b6a3c9e8f21
The people under exemptions, by user ID, are not asked. A confirmation inside tap_action works too, the way it does on any card. When a button has both, the one on the button wins.
On an area card
An area card is about an area, not about one entity. Give a button an Entity, and it acts like a light switch on the wall: Toggle switches that entity, and the button lights up while it is on.
type: area
area: living_room
features:
- type: custom:spook-action-buttons-feature
buttons:
- label: Reading lamp
icon: mdi:floor-lamp
entity: light.reading_lamp
tap_action:
action: toggle
Without an Entity, Toggle and More info have nothing to act on there, and say so when pressed. Perform action brings its own target, and needs none.
On a tile, thermostat or humidifier card, a button without an Entity acts on the entity of that card. It does not light up for it: the card shows that state already.
Home Assistant has an Area controls feature of its own for the area card, which switches all the lights, or all the fans, of the area at once. Action buttons are for the one lamp, or for anything else.
When a button says no
When an action fails, Home Assistant says why, at the bottom of the screen. An action that no longer exists, a target that is gone, or a device that does not answer: you see it the moment you press the button.
