How to trigger an automation with UI button

Hi

can someone tell me how link this button with the automation? I whant to trigger an automation with one UI button

this is my code:

entity: switch.cuarto_luis
hold_action:
  action: call-service
  service: automation.trigger
show_icon: true
show_name: true
tap_action:
  action: toggle
type: entity-button
1 Like

You are missing the automation itself:

- entity_id: automation.whatever
1 Like

Specifically entityid needs to go in the service data field

Thanks, but istill dont work. do I do something wrong?

entity: switch.cuarto_luis
hold_action:
 action: call-service
 service: automation.trigger
 entity_id: automation.porton_test
show_icon: true
show_name: true
tap_action:
 action: toggle
type: entity-button

yes, you still haven’t put the entity_id inside service_data yet :wink: hint, you’re missing service_data…

I´m duumy it is working now:

- entity: switch.portones_luis
        tap_action:
          action: call-service
          service: automation.trigger
          service_data:
            entity_id: automation.porton_test
        type: entity-button

thanks for the help :slight_smile:

3 Likes

Does your automation contain conditions? And if so, do you want this button to run the automation’s actions only if those conditions are true? If so you should change it to:

        tap_action:
          action: call-service
          service: automation.trigger
          service_data:
            entity_id: automation.porton_test
            skip_condition: false

For those that might not know, the skip_condition parameter is new since 0.104.

1 Like

Is that new?

1 Like

Yes, because that I switch to use a script, I don´t know that…

did you put it in configuration file or UI dashboard editor?

all that is in config.