I come from a Control4 background and in Control4 I can nest IFs. An example
If motion not detected
→ turn off light
If TV on
→ turn off TV
This essentially says when motion not detected turn off the light… optionally also turn off the TV if it is on.
So I have this existing automation and I want to put in a similar conditional that says if the TV is also on, turn it off without having to create a whole separate CHOOSE section. Is this possible? Or am I creating a third Choose?
alias: Front Parlor Occupancy Monitor
description: ''
trigger:
- platform: state
entity_id: binary_sensor.front_parlor_foyer_occupancy_monitors
id: state
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.front_parlor_occupancy_timer
id: timer
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.front_parlor_foyer_occupancy_monitors
state: 'on'
- condition: state
entity_id: timer.front_parlor_occupancy_timer
state: active
- condition: trigger
id: state
sequence:
- service: timer.cancel
data: {}
target:
entity_id: timer.front_parlor_occupancy_timer
- conditions:
- condition: state
entity_id: binary_sensor.front_parlor_foyer_occupancy_monitors
state: 'off'
- condition: state
entity_id: timer.front_parlor_occupancy_timer
state: idle
- condition: trigger
id: state
sequence:
- service: timer.start
data: {}
target:
entity_id: timer.front_parlor_occupancy_timer
- conditions:
- condition: trigger
id: timer
sequence:
- service: rest_command.deshler_front_parlor_unoccupied
data: {}
default: []
mode: single