alias: Master Bedroom Status id: automation_master_bedroom_status trigger: - id: master_bed_not_occupied platform: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either to: "off" for: "00:10:00" - id: phone_charging platform: state entity_id: sensor.pixel_7_charger_type to: "wireless" - id: master_bed_right_occupied platform: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_right to: "on" for: "00:00:05" condition: - alias: Okay to turn off or on condition: or conditions: - alias: "Is the room awake?" condition: and conditions: - alias: "The room is currently asleep" condition: state entity_id: input_boolean.master_bedroom_asleep state: "on" - alias: "An adult is home" condition: or conditions: - condition: state entity_id: input_boolean.clint_home state: "on" - condition: state entity_id: input_boolean.kristy_home state: "on" - alias: "It is before 10:00PM and after 4:00AM" condition: time before: "22:00:00" after: "04:00:00" - alias: "No one on master bed" condition: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either state: "off" - alias: "Is the room asleep?" condition: and conditions: - alias: "The room is currently awake" condition: state entity_id: input_boolean.master_bedroom_asleep state: "off" - alias: "Adult Home" condition: or conditions: - condition: state entity_id: input_boolean.clint_home state: "on" - condition: state entity_id: input_boolean.kristy_home state: "on" - alias: "After 10:00PM and before 4:00AM" condition: time after: "21:00:00" before: "04:00:00" - alias: "Someone on master bed" condition: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either state: "on" action: - choose: - conditions: - alias: "The room is currently asleep" condition: state entity_id: input_boolean.master_bedroom_asleep state: "on" - alias: "An adult is home" condition: or conditions: - condition: state entity_id: input_boolean.clint_home state: "on" - condition: state entity_id: input_boolean.kristy_home state: "on" - alias: "It is before 10:00PM and after 4:00AM" condition: time before: "21:00:00" after: "04:00:00" - alias: "No one on master bed" condition: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either state: "off" sequence: - action: input_boolean.turn_off entity_id: input_boolean.master_bedroom_asleep - conditions: - alias: "The room is currently awake" condition: state entity_id: input_boolean.master_bedroom_asleep state: "off" - alias: "Adult Home" condition: or conditions: - condition: state entity_id: input_boolean.clint_home state: "on" - condition: state entity_id: input_boolean.kristy_home state: "on" - alias: "After 10:00PM and before 4:00AM" condition: time after: "21:00:00" before: "04:00:00" - alias: "Someone on master bed" condition: state entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either state: "on" sequence: - choose: - conditions: - condition: not conditions: - condition: state entity_id: input_select.master_bedroom_mode state: "Manual" sequence: - action: input_select.select_option data: option: Auto target: entity_id: input_select.master_bedroom_mode # From Master Bedroom Asleep - action: input_boolean.turn_on entity_id: input_boolean.master_bedroom_asleep