alias: Master Bathroom Lights to Off id: automation_master_bathrom_lights_to_off mode: restart trigger: - platform: state entity_id: input_select.master_bathroom_mode - platform: state entity_id: input_boolean.bathroom_occupied to: "off" #- platform: time_pattern # minutes: "/5" condition: - condition: state entity_id: input_boolean.lights_off_manually state: "off" - condition: state entity_id: light.master_bathroom_hue state: "on" - condition: or conditions: - condition: state entity_id: input_select.master_bathroom_mode state: "Off" - condition: state entity_id: input_boolean.bathroom_occupied state: "off" action: - choose: - conditions: - condition: state entity_id: input_boolean.lighting_automations state: "on" - condition: or conditions: - condition: state entity_id: input_select.master_bathroom_mode state: "Off" - condition: state entity_id: input_boolean.bathroom_occupied state: "off" - condition: not conditions: - condition: state entity_id: input_select.master_bathroom_mode state: "Manual" sequence: - action: scene.turn_on data: transition: 5 target: entity_id: scene.master_bathroom_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.master_bathroom_motion_switch, switch.master_bathroom_switch