Is it possible to execute an automation from a Lovelace button? I’m guess it is, but can’t figure it out.
Tap action is service, the service is homeassistant.turn_on
and the entity id is your automation.
If you’re using the button card, it should just be a call service with automation.trigger
.
tap_action:
action: call-service
service: automation.trigger
service_data:
entity_id: automation.xxxx
Thanks, but neither of those execute the automation. Using @petro’ solution, using the GUI interface, results in the following:
Failed to call service automation/trigger. must contain at least one of entity_id, area_id.
type: button
tap_action:
action: call-service
service: automation.trigger
hold_action:
action: more-info
show_icon: true
show_name: true
entity: automation.yogurt_maker
Because you didn’t provide service_data…
I know you deleted this, but unfortunately you need to specify the entity at the root level and entity_id inside the service_data. Service_data has no concept of the entity configured in the card.
I had missed the ‘r’ off the end of the ID, but when I realized and added it, then the automation started to work, so I deleted the post:
entity_id: automation.yogurt_make
The final working solution is:
type: button
tap_action:
action: call-service
service: automation.trigger
service_data:
entity_id: automation.yogurt_maker
hold_action:
action: more-info
show_icon: true
show_name: true
name: Yogurt Maker
icon: 'mdi:bowl'
Thank you for your help.