alias: Front Room Lights to Off id: automation_front_room_lights_to_off mode: restart trigger: - platform: state entity_id: input_select.front_room_mode - platform: state entity_id: input_boolean.front_room_occupied to: "off" - platform: state entity_id: binary_sensor.front_room_naturally_lit from: "off" to: "on" #- platform: time_pattern # minutes: "/5" condition: - alias: "Front room light cycle not on" condition: state entity_id: input_boolean.front_room_light_cycle state: "off" - condition: or conditions: - condition: state entity_id: input_select.front_room_mode state: "Off" - condition: state entity_id: input_boolean.front_room_occupied state: "off" - "{{ is_state('binary_sensor.front_room_naturally_lit','on') }}" action: - choose: - conditions: - condition: or conditions: - condition: and conditions: - condition: state entity_id: input_boolean.lighting_automations state: "on" - condition: or conditions: - condition: state entity_id: input_select.front_room_mode state: "Off" - condition: state entity_id: input_boolean.front_room_occupied state: "off" - condition: not conditions: - condition: state entity_id: input_select.front_room_mode state: "Manual" - "{{ is_state('binary_sensor.front_room_naturally_lit','on') }}" sequence: - action: scene.turn_on data: transition: 5 target: entity_id: scene.front_room_hue_off - choose: - conditions: - condition: state entity_id: input_boolean.guest_mode state: "on" sequence: - alias: "Turn off z-wave switch since all lights are off" action: homeassistant.turn_off target: entity_id: switch.front_room_motion_switch