I really would like to have an activate- button on my hass dashboard that triggers a series of automations. i.e. when i go to bed:
turn off all lights in the living room
Close the gate, when it’s open
send a message when the garagedoor is open
etc…
How do i create a button on my dashboard and use the button-press as trigger for the automations?
With a scene? or a input_boolean? It both doesn’t exactly what i want.
I don’t know if “dashboard” is different somehow than the “regular frontend”, but it sounds like you want to write a script, and then you can put that script on your dashboard. It will have a button to press to run the script (or a toggle, if the script contains any delays or waits.) E.g., here’s what a couple of scripts look like in my frontend:
night_routine:
alias: Nachtmodus
sequence:
- condition: state
entity_id: binary_sensor.schuurdeur
state: on
- service: notify.pushbullet_rudolf
data:
title: Schuurdeur
message: De schuurdeur staat nog open
But it gives me the error:
Invalid config for [script]: [condition] is an invalid option for [script]. Check: script->script->night_routine->sequence->0->condition. (See /config/configuration.yaml, line 131). Please check the docs at https://home-assistant.io/components/script/
What is the context of that snippet of YAML? I.e., is it directly in configuration.yaml, or in a separate scripts.yaml file, etc.? The reason I ask is, this is a bit suspicious: script->script->night_routine.... Seems to imply this structure:
script:
script:
night_routine:
...
which wouldn’t be right. Otherwise, a condition step is perfectly legal in a script sequence.
Wow, I’m stumped. That looks perfectly fine. Although I now use a more complex structure of files, I went back and looked at my first versions, and I had it exactly like you do. Hmm.
The only slight difference I see is that I tend to indent list items, even though I know it’s not supposed to matter. I.e., I do this:
name_of_script:
alias: Alias for script
sequence:
- condition: ...
Maybe someone else will see something we’re missing.
D’oh! I should have noticed that. Unfortunately, that error message, although it seemed to point in the right direction, was still kind of misleading. I’m glad you’ve solved it.