Files
fresh-home/automations/people/kids_awake.yaml
T
2025-12-03 23:21:30 -05:00

235 lines
7.6 KiB
YAML

alias: Kids Awake
id: automation_kids_awake
mode: restart
trigger:
# Consider the kids awake if it is after 6:00AM and any of them that are home are also awake
- platform: state
entity_id:
- input_boolean.emmett_is_awake
- input_boolean.bridget_is_awake
- input_boolean.ebin_is_awake
- input_boolean.kids_away
- binary_sensor.morning
to: "on"
- platform: state
entity_id:
- binary_sensor.emmetts_bed
- binary_sensor.bridgets_bed
to: "off"
for: "00:05:00"
- platform: homeassistant
event: start
condition:
- alias: "Kids should only be considered awake if they get out of bed after 6:00 AM and before 7:00 PM"
condition: time
before: "19:00:00"
after: "06:00:00"
- alias: "Go through all the kids that are considered home and see if their bed is occupied"
condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.emmett_home
state: "off"
- condition: and
conditions:
- condition: state
entity_id: input_boolean.emmett_is_awake
state: "off"
- condition: state
entity_id: input_boolean.emmett_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "off"
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "unavailable"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bridget_home
state: "off"
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bridget_is_awake
state: "off"
- condition: state
entity_id: input_boolean.bridget_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "off"
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "unavailable"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.ebin_home
state: "off"
- condition: and
conditions:
- condition: state
entity_id: input_boolean.ebin_is_awake
state: "off"
- condition: state
entity_id: input_boolean.ebin_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "off"
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "unavailable"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "off"
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "unavailable"
action:
- action: input_boolean.turn_off
entity_id:
- input_boolean.kids_bedtime
- input_boolean.kids_asleep
- choose:
- conditions:
- condition: state
entity_id: input_boolean.emmett_is_awake
state: "off"
- condition: state
entity_id: input_boolean.emmett_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "off"
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "unavailable"
sequence:
- action: input_boolean.turn_off
entity_id:
- input_boolean.emmett_in_bed
- input_boolean.boys_room_asleep
- action: input_boolean.turn_on
entity_id: input_boolean.emmett_is_awake
- choose:
- conditions:
- condition: state
entity_id: input_boolean.bridget_is_awake
state: "off"
- condition: state
entity_id: input_boolean.bridget_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "off"
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "unavailable"
sequence:
- action: input_boolean.turn_off
entity_id:
- input_boolean.bridget_in_bed
- input_boolean.girls_room_asleep
- action: input_boolean.turn_on
entity_id: input_boolean.bridget_is_awake
- choose:
- conditions:
- condition: state
entity_id: input_boolean.ebin_is_awake
state: "off"
- condition: state
entity_id: input_boolean.ebin_home
state: "on"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "off"
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "unavailable"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "off"
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "unavailable"
sequence:
- action: input_boolean.turn_off
entity_id: input_boolean.ebin_in_bed
- action: input_boolean.turn_on
entity_id: input_boolean.ebin_is_awake
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "off"
- condition: state
entity_id: binary_sensor.bridgets_bed
state: "unavailable"
- condition: not
conditions:
- condition: state
entity_id: input_select.girls_room_mode
state: "Manual"
- condition: state
entity_id: input_select.house
state: "Away"
sequence:
- action: input_select.select_option
data:
entity_id: input_select.girls_room_mode
option: Auto
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "off"
- condition: state
entity_id: binary_sensor.emmetts_bed
state: "unavailable"
- condition: not
conditions:
- condition: state
entity_id: input_select.boys_room_mode
state: "Manual"
- condition: state
entity_id: input_select.house
state: "Away"
sequence:
- action: input_select.select_option
data:
entity_id: input_select.boys_room_mode
option: Auto