Hi
Trying to setup a automation based on multiple conditions.
I want to, if the clock are after 13 and it is a workday if the lightsensor are set to on to turn on the lights.
If the lightsensor are off nothing should happend but if the conditions above are fullfilled and the lightsensor turns on, the light will do the same
is it possible?
- alias: 'skoldag'
trigger:
- platform: state
entity_id: group.skoldag
to: 'home'
condition:
- condition: time
after: '13:00:00'
- condition: state
entity_id: 'binary_sensor.workday'
state: 'on'
- condition: state
entity_id: 'binary_sensor.lightsensor'
to : 'on'
action:
service: scene.turn_on
entity_id: scene.uppe_on
alias: 'skoldag'
trigger:
# Prefix the first line of each trigger configuration
# with a '-' to enter multiple
- platform: state
entity_id: group.skoldag
to: 'home'
condition:
- condition: and
conditions:
- condition: time
after: '13:00:00'
- condition: state
entity_id: 'binary_sensor.arbetsdag'
state: 'on'
- condition: state
entity_id: 'binary_sensor.ljusensor'
to : 'on'
action:
service: scene.turn_on
entity_id: scene.uppe_on
also, conditions are automatically โandโ so you dont need that and statement, simply list then all
alias: 'skoldag'
trigger:
# Prefix the first line of each trigger configuration
# with a '-' to enter multiple
- platform: state
entity_id: group.skoldag
to: 'home'
condition:
- condition: time
after: '13:00:00'
- condition: state
entity_id: 'binary_sensor.arbetsdag'
state: 'on'
- condition: state
entity_id: 'binary_sensor.ljusensor'
state : 'on'
action:
service: scene.turn_on
entity_id: scene.uppe_on
It may help if you can think of it like the difference between the trigger and the condition.
The trigger only happens when something changes state from something to something else.
The condition then checks what the actual state of the entity is at that moment in time and decides if the automation can continue. Itโs not looking for a change in state but just what the state is now.