Files
fresh-home/automations/rooms/girls_room/girls_room_out_of_bed.yaml
T
2025-10-10 20:24:52 -04:00

163 lines
4.2 KiB
YAML

alias: Nursery Out of Bed
id: automation_nursery_out_of_bed
mode: single
# Hide warnings when triggered while in delay.
max_exceeded: silent
trigger:
- trigger: state
entity_id: binary_sensor.black_bed_occupied
from: "on"
to: "off"
for: "00:00:05"
- trigger: state
entity_id: binary_sensor.white_bed_occupied
from: "on"
to: "off"
for: "00:00:05"
- trigger: state
entity_id: binary_sensor.nursery_door
from: "off"
to: "on"
condition:
- alias: "Do we want to be alerted?"
condition: state
entity_id: input_boolean.out_of_bed_alert
state: "on"
- alias: "Is the home occupied or in guest mode?"
condition: or
conditions:
- condition: state
entity_id: input_boolean.home_occupied
state: "on"
- condition: state
entity_id: input_boolean.guest_mode
state: "on"
- alias: "Are any of the kids considered home?"
condition: or
conditions:
- condition: state
entity_id: input_boolean.emmett_home
state: "on"
- condition: state
entity_id: input_boolean.bridget_home
state: "on"
- condition: state
entity_id: input_boolean.ebin_home
state: "on"
- alias: "Is at a time of day when the kids should be sleeping?"
condition: or
conditions:
- condition: state
entity_id: binary_sensor.evening
state: "on"
- condition: state
entity_id: binary_sensor.late_evening
state: "on"
- condition: state
entity_id: binary_sensor.night
state: "on"
- condition: state
entity_id: binary_sensor.early_morning
state: "on"
- alias: "Is Nursery Light Cycle turned off?"
condition: state
entity_id: input_boolean.nursery_light_cycle
state: "off"
- alias: "Are the kids asleep?"
condition: state
entity_id: input_boolean.kids_asleep
state: "on"
- alias: "Is an adult awake?"
condition: state
entity_id: binary_sensor.adults_asleep
state: "off"
variables:
computer_area: "{{ states('binary_sensor.computer_area_person_occupancy') }}"
front_room: "{{ states('binary_sensor.front_room_person_occupancy') }}"
entryway: "{{ states('input_boolean.entryway_occupied') }}"
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.garage_occupied
state: "on"
sequence:
- action: script.blink_garage_lights
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.computer_area_occupied
state: "on"
sequence:
- action: webrtc.dash_cast
data:
entity_id: media_player.computer_area_hub
url: rtsp_cam08_sub
force: true
extra:
mode: webrtc
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.front_room_occupied
state: "on"
sequence:
- action: webrtc.dash_cast
data:
entity_id: media_player.front_room_hub
url: rtsp_cam08_sub
force: true
extra:
mode: webrtc
- delay: "00:10:00"
- action: media_player.turn_off
entity_id: media_player.front_room_hub, media_player.computer_area_hub
# - alias: "Flash some lights"
# repeat:
# count: 6
# sequence:
# - delay: 1
# - action: light.toggle
# target:
# entity_id:
# - light.entryway_hue
# - light.computer_area_hue
# - light.front_room_hue
#- delay: '00:00:02'
# - alias: "Fix computer area lights"
# action: automation.trigger
# target:
# entity_id: "automation.computer_area_lights_to_{{ computer_area }}"
# data:
# skip_condition: true
# - alias: "Fix front room lights"
# action: automation.trigger
# target:
# entity_id: "automation.front_room_lights_to_{{ front_room }}"
# data:
# skip_condition: true
# - alias: "Fix entryway lights"
# action: automation.trigger
# target:
# entity_id: "automation.entryway_lights_to_{{ entryway }}"
# data:
# skip_condition: true