Nutti85
(Nutti85)
March 24, 2017, 9:19pm
1
Hey, I have an automation to trigger a script, but I want to cancel the script at a specific step if the sun is below the horizon. I was under the impression that you could use conditions as you can in automations but I’m getting an error saying conditions are not allowed.
Here is my yaml:
sequence:
- alias: Turn on lights
service: homeassistant.turn_on
data:
entity_id: scene.normal
- alias: Condition
condition:
condition: state
entity_id: sun.sun
state: below_horizon
- alias: Turn on Vitrine
service: homeassistant.turn_on
data:
entity_id: switch.mote_amber
What is the correct way to cancel the script if the sun is below the horizon?
1 Like
bbrendon
(bbrendon)
April 6, 2017, 5:07am
2
Don’t you not want to run then based on a condition?
Here is an example of a script with a condition.
script:
door_front_lock:
sequence:
- condition: state
entity_id: binary_sensor.front_door
state: 'off'
- service: shell_command.door_front_lock
And multiple conditions
script:
hello_world:
sequence:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.temperature
below: 25
- condition: sun
after: sunrise
- service: homeassistant.turn_on
entity_id: group.living_room
6 Likes
cooljimy84
(James Crook)
September 27, 2017, 3:13pm
3
wouldn’t that be like the other and conditions, like in automations ?
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: time
after: '06:00:00'
before: '22:00:00'
action: