Virtual button to call automation

Hi, in configuration.yaml I would like something like this:

  - platform: switch
    name: Modalità romantica
    entity_id: automation.romantico_script

I would like to have a virtual button that activates the automation

You can use a tap_action like this:

                        - entity: input_boolean.a_helper
                          tap_action:
                            action: call-service
                            service: script.romantico

I need it to be shown as a button on lovelace and also on google home and alexa so i can do routins that call that button

If you are only ever activating this automation.romantico_script manually (via Lovelace or a voice assistant) it should be a script, not an automation.

You can assign a script to a button tap action in Lovelace as Russell said. You can also call your scripts (i think) from your voice assistant.

If you can wait a few days, the next version of Home Assistant (2022.02) will have a new input_button - I think that will give you what you need… and it’s a real thing, not virtual :slight_smile:

1 Like

It’s nice and all, but totally not required.

It is actually a script, I tried to look for a way how to create a virtual button that call the script but I did not find anything, then I created an automation that call the script, but nothing I cannot find a solution for that either.

But how do I make a script appear inside in Google Home and Alexa? where is it?

We’ve told you twice now:

Look here:

https://www.home-assistant.io/lovelace/button/

https://www.home-assistant.io/lovelace/button/#tap-action

No idea I don’t use voice assistants, so I did what you should have and used Google. Very first search result:

Google thinks a script is a scene, and so you activate it by simply saying “Hey Google, activate (script name)”. I do this every single night to activate my Goodnight House script.