Hello!
I have 2 separate lights in my kitchen that I am trying to open differently based on the time of the day. The thing is that the automation seems to disregard my condition and goes to a default that I haven’t set up. So for example instead of opening the left kitchen lights it always open the right side lights.
Is there a way to remove that default, or to force the automation to go trough the options and evaluate the conditions?
I would really much appreciate your help.
Check out my code below:
alias: Kitchen Lights - Automation - Sensor + Man
description: ''
trigger:
- type: motion
platform: device
device_id: 73f5a8ea469412fa63612b051aaa75e4
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
domain: binary_sensor
id: sensor_detected_motion
- type: no_motion
platform: device
device_id: 73f5a8ea469412fa63612b051aaa75e4
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
domain: binary_sensor
id: sensor_stoped_detecting_motion
- platform: state
entity_id: light.kitchen_lights_left_side
from: 'off'
to: 'on'
id: manually_status_from_off_to_on_left_side
- platform: state
entity_id: light.kitchen_lights_right_side
from: 'off'
to: 'on'
id: manually_status_from_off_to_on_right_side
- platform: state
entity_id: light.kitchen_lights_right_side
id: manually_status_from_on_to_off_right_side
from: 'on'
to: 'off'
- platform: state
entity_id: light.kitchen_lights_left_side
id: manually_status_from_on_to_off_left_side
from: 'on'
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: sensor_detected_motion
- condition: or
conditions:
- condition: state
entity_id: light.kitchen_lights_right_side
state: 'off'
- condition: state
entity_id: light.kitchen_lights_left_side
state: 'off'
- condition: time
after: '10:30:00'
before: '18:00:00'
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'off'
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.kitchen_switch_sensor
- type: turn_on
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_right_side
domain: light
- conditions:
- condition: trigger
id: sensor_detected_motion
- condition: or
conditions:
- condition: state
entity_id: light.kitchen_lights_right_side
state: 'off'
- condition: state
entity_id: light.kitchen_lights_left_side
state: 'off'
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'off'
- condition: time
after: '18:01:00'
before: '22:00:00'
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.kitchen_switch_sensor
- type: turn_on
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_right_side
domain: light
- type: turn_on
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_left_side
domain: light
- conditions:
- condition: trigger
id: sensor_detected_motion
- condition: or
conditions:
- condition: state
entity_id: light.kitchen_lights_right_side
state: 'off'
- condition: state
entity_id: light.kitchen_lights_left_side
state: 'off'
- condition: time
after: '22:01:00'
before: '08:00:00'
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'off'
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.kitchen_switch_sensor
- type: turn_on
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_left_side
domain: light
- conditions:
- condition: trigger
id: sensor_stoped_detecting_motion
- condition: or
conditions:
- condition: state
entity_id: light.kitchen_lights_left_side
state: 'on'
- condition: state
entity_id: light.kitchen_lights_right_side
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_switch_sensor
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'off'
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.kitchen_switch_sensor
- type: turn_off
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_right_side
domain: light
- type: turn_off
device_id: 6bc73152ef02b50ac1bf9a444145cb77
entity_id: light.kitchen_lights_left_side
domain: light
- conditions:
- condition: or
conditions:
- condition: trigger
id: manually_status_from_off_to_on_left_side
- condition: trigger
id: manually_status_from_off_to_on_right_side
- condition: state
entity_id: input_boolean.kitchen_switch_sensor
state: 'off'
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'off'
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.kitchen_switch_manual
- conditions:
- condition: or
conditions:
- condition: trigger
id: manually_status_from_on_to_off_right_side
- condition: trigger
id: manually_status_from_on_to_off_left_side
- condition: state
entity_id: input_boolean.kitchen_switch_manual
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_switch_sensor
state: 'off'
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.kitchen_switch_manual
- conditions:
- condition: or
conditions:
- condition: trigger
id: manually_status_from_on_to_off_right_side
- condition: trigger
id: manually_status_from_on_to_off_left_side
- condition: state
state: 'on'
entity_id: input_boolean.kitchen_switch_sensor
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.kitchen_switch_sensor
default: []
mode: single