AutomationDataset/johnkoht/johnkoht_automations.yaml

17642 lines
501 KiB
YAML

- id: air_quality_alert_good
alias: Air Quality - Alert for Good Conditions
initial_state: true
trigger:
- trigger: state
entity_id: input_select.air_quality_state
to: Good
actions:
- action: script.air_quality_alert_set_air_purifier_auto
- id: air_quality_alert_unhealthy
alias: Air Quality - Alert for Unhealthy Conditions
initial_state: true
trigger:
- trigger: state
entity_id: input_select.air_quality_state
from:
- Good
- Moderate
- Slightly Unhealthy
to: Unhealthy
for:
minutes: 5
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.air_quality_alert_unhealthy'',''last_triggered''),
0) ) | int > 7200 }}'
actions:
- action: script.voice_announcement
data:
media_players: auto
sound: one-chime
priority: high
expires_in: 60
speech_message: Hey Fam, the air quality is looking unhealthy, please keep windows
closed and make sure to take precautions.
- action: script.air_quality_alert_turn_on_air_purifiers
data:
speed: 25
- id: air_quality_alert_very_unhealthy
alias: Air Quality - Alert for Very Unhealthy Conditions
initial_state: true
trigger:
- trigger: state
entity_id: input_select.air_quality_state
from:
- Good
- Moderate
- Slightly Unhealthy
- Unhealthy
to: Very Unhealthy
for:
minutes: 5
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.air_quality_alert_very_unhealthy'',''last_triggered''),
0) ) | int > 7200 }}'
actions:
- action: script.voice_announcement
data:
media_players: auto
sound: one-chime
priority: high
expires_in: 60
speech_message: Hey Fam, the air quality is looking very unhealthy, please keep
windows closed and make sure to take precautions.
- action: script.air_quality_alert_turn_on_air_purifiers
data:
speed: 50
- id: air_quality_alert_hazardous
alias: Air Quality - Alert for Very Unhealthy Conditions
initial_state: true
triggers:
- trigger: state
entity_id: input_select.air_quality_state
to: Hazardous
for:
minutes: 2
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.air_quality_alert_hazardous'',''last_triggered''),
0) ) | int > 7200 }}'
actions:
- action: script.voice_announcement
data:
media_players: auto
sound: nuclear
priority: critical
speech_message: Attention! The air quality is hazardous today. Please stay indoors
as much as possible.
- action: script.air_quality_alert_turn_on_air_purifiers
data:
speed: 100
- id: update_air_quality_state
alias: Update Air Quality State
mode: single
triggers:
- trigger: state
entity_id: sensor.desplns_illinois_usa_air_quality_index
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
action:
- action: input_select.select_option
data:
entity_id: input_select.air_quality_state
option: "{% set aqi = states.sensor.desplns_illinois_usa_air_quality_index.state\
\ | int %} {% if aqi <= 50 %}\n Good\n{% elif aqi <= 100 %}\n Moderate\n\
{% elif aqi <= 150 %}\n Slightly Unhealthy\n{% elif aqi <= 200 %}\n Unhealthy\n\
{% elif aqi <= 300 %}\n Very Unhealthy\n{% else %}\n Hazardous\n{% endif\
\ %}\n"
- id: alarm_arm_at_bedtime
alias: Alarm - Arm at Bedtime
mode: single
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
conditions:
- condition: state
entity_id: alarm_control_panel.panel
state: disarmed
- condition: time
after: '20:00:00'
before: 05:00:00
actions:
- action: script.alarm_arm_home
- id: alarm_arm_away_when_vacation_mode
alias: Alarm - Arm Away When Vacation Mode
mode: single
triggers:
- trigger: state
entity_id: input_select.house
to: Vacation
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
actions:
- action: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.panel
- action: script.general_notification
data:
message: Home is armed Away since the house is in Vacation mode.
title: Security System
devices: jk
priority: time-sensitive
tag: home-security
- id: alarm_arm_if_john_away
alias: Alarm - Arm if John Away
mode: single
initial_state: false
triggers:
- trigger: time
at: '21:30:00'
conditions:
- condition: state
entity_id: alarm_control_panel.panel
state: disarmed
- condition: state
entity_id: input_boolean.john_home
state: 'off'
actions:
- action: script.alarm_arm_home
- action: script.general_notification
data:
message: Home is ARMED for stay since John's not home.
title: Security System
devices: cfalb
priority: time-sensitive
tag: home-security
- action: script.voice_announcement
data:
media_players: auto
sound: default
priority: high
speech_message: I'm arming the security system since John's out of town. Make
sure to disarm before opening an exterior door.
- id: active_alarm_automation_if_john_away
alias: Activate Alarm Automation if John Away
mode: single
triggers:
- trigger: state
entity_id: input_boolean.john_home
to: 'off'
for:
hours: 2
- trigger: state
entity_id: input_select.john_status
to: Extended Away
actions:
- action: automation.turn_on
entity_id: automation.alarm_arm_if_john_away
- id: deactive_alarm_automation_if_john_home
alias: Deactivate Alarm Automation if John Home
mode: single
triggers:
- trigger: state
entity_id: input_boolean.john_home
to: 'on'
conditions:
- condition: state
entity_id: automation.alarm_arm_if_john_away
state: 'on'
actions:
- action: automation.turn_off
entity_id: automation.alarm_arm_if_john_away
- id: alarm_arm_when_house_empty
alias: Alarm - Arm When House is Empty
mode: single
trigger:
- platform: state
entity_id: input_select.house
to: Away
for:
minutes: 5
- platform: zone
entity_id:
- person.john_koht
- person.cristina_falbo
zone: zone.neighborhood
event: leave
- platform: numeric_state
entity_id: sensor.home_nearest_distance
above: 5
condition:
- condition: state
entity_id: alarm_control_panel.panel
state: disarmed
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- action: script.alarm_arm_home
- id: alarm_disarm_in_morning
alias: Alarm - Disarm in Morning
mode: single
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
for:
minutes: 3
- platform: state
entity_id: input_select.house
from: Bedtime
to: Auto
for:
minutes: 3
condition:
- condition: state
entity_id: alarm_control_panel.panel
state: armed_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.panel
- service: script.general_notification
data:
message: Home is now disarmed!
title: Security System
devices: all
priority: active
tag: home-security
- id: alarm_disarm_when_house_becomes_occupied
alias: Alarm - Disarm When House Becomes Occupied
mode: single
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
conditions:
- condition: state
entity_id: alarm_control_panel.panel
state:
- armed_home
- armed_away
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
actions:
- action: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.panel
- action: script.general_notification
data:
message: Home is now disarmed upon the arrival of somebody.
title: Home Security System
devices: jk
priority: active
tag: home-security
- id: alarm_disarm_when_somebody_arrives_and_house_occupied
alias: Alarm - Disarm When Somebody Arrives and House Occupied
mode: single
triggers:
- trigger: state
entity_id:
- sensor.john_person
- sensor.cristina_person
- sensor.nonna_person
- sensor.tayta_person
- sensor.jido_person
- sensor.katia_person
- sensor.joe_person
- sensor.alex_person
to: home
conditions:
- condition: state
entity_id: alarm_control_panel.panel
state: armed_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ state_attr(trigger.entity_id, ''unlock_privilege'') == "on"
}}
'
actions:
- action: script.alarm_arm_home
- id: security_alarm_trigger
alias: Security Alarm - Triggered
mode: single
triggers:
- trigger: state
entity_id: alarm_control_panel.panel
to: triggered
actions:
- action: script.security_alarm_alert
data: {}
- id: '1672413097885'
alias: Hello World Response
trigger:
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: hello_world
variables:
response_type: '{{ trigger.event.data.event_response_type }}'
response: '{{ trigger.event.data.event_response }}'
action:
- service: input_text.set_value
data:
value: '{{ response_type }}'
target:
entity_id: input_text.l
- service: input_text.set_value
data:
value: '{{ response }}'
target:
entity_id: input_text.hello_world_response
- id: alexa_volume_control
initial_state: true
alias: Alexa Volume Control
trigger:
- platform: state
entity_id: input_boolean.quiet_mode
to: 'on'
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: media_player.volume_set
data:
entity_id:
- media_player.john_s_echo_dot
- media_player.john_s_2nd_echo_dot
- media_player.kohbo_dot_main_bedroom
- media_player.john_s_echo_show
volume_level: 0.3
- id: alexa_volume_control_turn_up
initial_state: true
alias: Alexa Volume Control - Turn Up
trigger:
- platform: state
entity_id: input_boolean.quiet_mode
to: 'off'
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: media_player.volume_set
data:
entity_id:
- media_player.john_s_echo_dot
- media_player.john_s_2nd_echo_dot
- media_player.kohbo_dot_main_bedroom
- media_player.john_s_echo_show
volume_level: 0.6
- id: alex_announce_arrival
alias: Alex Presence - Announce Arrival
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.alex
from: not_home
to: home
conditions:
- condition: state
entity_id: person.alex
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: alex
announcement_type: arrival
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- action: input_boolean.turn_on
entity_id: input_boolean.guest_mode_announced
- id: alex_announce_departure
alias: Alex Presence - Announce Departure
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.alex
from: home
conditions:
- condition: state
entity_id: person.alex
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: alex
announcement_type: departure
- id: alex_is_away
alias: Alex Presence - Away
initial_state: true
triggers:
- trigger: state
entity_id: person.alex
to: not_home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.alex_status
state: Just Left
- or:
- condition: state
entity_id: person.alex
state: not_home
- condition: state
entity_id: device_tracker.alex_iphone_detect
state: not_home
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.alex_home
- id: alex_is_home
initial_state: true
alias: Alex Presence - Home
triggers:
- trigger: state
entity_id: person.alex
to: home
- trigger: state
entity_id: device_tracker.alex_iphone_detect
to: home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: person.alex
state: home
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.alex_home
- id: alex_presence_just_arrived
alias: Alex Presence - Just Arrived
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.alex_home
to: 'on'
actions:
- action: input_select.select_option
data:
entity_id: input_select.alex_status
option: '{{ ''Home'' if states.input_select.alex_status.state else ''Just Arrived''
}}'
- id: alex_presence_home
alias: Alex Presence - Home
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_select.alex_status
to: Just Arrived
for:
minutes: 5
- trigger: state
entity_id: input_select.alex_status
from: Just Left
to: Just Arrived
actions:
- action: input_select.select_option
data:
entity_id: input_select.alex_status
option: Home
- id: alex_presence_just_left
alias: Alex Presence - Just Left
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.alex_home
to: 'off'
actions:
- action: input_select.select_option
data:
entity_id: input_select.alex_status
option: Just Left
- id: alex_presence_away
alias: Alex Presence - Away
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_select.alex_status
to: Just Left
for:
minutes: 5
actions:
- action: input_select.select_option
data:
entity_id: input_select.alex_status
option: Away
- id: all_away_media_off
alias: All away media off
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
condition: or
conditions:
- condition: state
entity_id: media_player.sonos_office
state: playing
- condition: state
entity_id: media_player.sonos_family_room
state: playing
- condition: state
entity_id: media_player.sonos_kitchen
state: playing
- condition: state
entity_id: media_player.sony_bravia_tv
state: playing
- condition: state
entity_id: media_player.kohbo_echo
state: playing
- condition: state
entity_id: media_player.john_s_echo_show
state: playing
- condition: state
entity_id: media_player.kohbo_dot_main_bedroom
state: playing
action:
service: media_player.media_pause
- id: announcement_queue_append
alias: Announcement Queue - Append
mode: single
trigger:
- trigger: mqtt
topic: home/announcement_queue/append
variables:
new_item: "{% set item = trigger.payload | from_json %} {% if item.expires_in\
\ is defined %}\n {% set expires_at = now() + timedelta(minutes=item.expires_in)\
\ %}\n {{ item | combine({'expires_at': expires_at.isoformat()}) }}\n{% else\
\ %}\n {{ item }}\n{% endif %}"
queue_data_topic: home/announcement_queue/data
queue_state_topic: home/announcement_queue/state
action:
- variables:
current_queue: "{% set q = state_attr('sensor.announcement_queue', 'queue')\
\ %} {% if q is iterable %}\n {{ q }}\n{% else %}\n []\n{% endif %}"
updated: "{% if new_item.priority == 'critical' %}\n {# Keep only critical\
\ messages and add new critical message at start #}\n {% set critical_msgs\
\ = current_queue | selectattr('priority', 'eq', 'critical') | list %}\n \
\ {{ [new_item] + critical_msgs }}\n{% else %}\n {# For non-critical messages,\
\ sort by priority #}\n {% set high_priority = current_queue | selectattr('priority',\
\ 'eq', 'high') | list %}\n {% set normal_priority = current_queue | selectattr('priority',\
\ 'eq', 'normal') | list %}\n {% set low_priority = current_queue | selectattr('priority',\
\ 'eq', 'low') | list %}\n {% set critical_msgs = current_queue | selectattr('priority',\
\ 'eq', 'critical') | list %}\n \n {# Add new message to appropriate priority\
\ list #}\n {% if new_item.priority == 'high' %}\n {% set high_priority\
\ = high_priority + [new_item] %}\n {% elif new_item.priority == 'low' %}\n\
\ {% set low_priority = low_priority + [new_item] %}\n {% else %}\n \
\ {% set normal_priority = normal_priority + [new_item] %}\n {% endif %}\n\
\ \n {# Combine all lists in priority order #}\n {{ critical_msgs + high_priority\
\ + normal_priority + low_priority }}\n{% endif %}"
payload_json: '{{ {"queue": updated} | to_json }}'
- action: system_log.write
data:
level: warning
message: 'Appended item. New queue: {{ payload_json }}
'
- action: mqtt.publish
data:
topic: '{{ queue_data_topic }}'
payload: '{{ payload_json }}'
retain: true
- action: mqtt.publish
data:
topic: '{{ queue_state_topic }}'
payload: queue
retain: true
- id: audi_is_away
alias: Audi is Away
initial_state: true
trigger:
- platform: state
entity_id: sensor.audi_presence
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: sensor.audi_presence
state: not_home
action:
- service: input_boolean.turn_off
entity_id: input_boolean.audi_home
- id: audi_is_home
initial_state: true
alias: Audi is Home
trigger:
- platform: state
entity_id: sensor.audi_presence
from: not_home
- platform: state
entity_id: sensor.audi_presence
to: garage
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.audi_presence
state: garage
- condition: template
value_template: '{{ states.sensor.audi_presence.state != ''not_home''}}'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.audi_home
- id: '1623896972382'
alias: Start DnD via Webhook
description: ''
trigger:
- platform: webhook
webhook_id: 71c672f8399aad2ccec8769e9ce75f46b7260ddb308de102224b9fe03ebb21f0
condition: []
action:
- type: turn_on
device_id: cdddd3246291229c09cb7cc75ff1feb1
entity_id: light.hue_play_1
domain: light
- service: hue.hue_activate_scene
data:
group_name: Office Signal
scene_name: John DnD
- repeat:
count: '3'
sequence:
- service: light.turn_on
target:
area_id: office
data:
brightness_step_pct: -50
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 750
- service: light.turn_on
target:
area_id: office
data:
brightness_step_pct: 50
mode: single
- id: '1623985104359'
alias: Garbage Day Reminder
description: ''
trigger:
- platform: time
at: '18:15:00'
condition:
- condition: time
weekday:
- thu
before: 00:00:00
after: 00:00:00
action:
- service: script.speech_engine
data:
speech_message: It's garbage day. Don't forget to collect garbage from the bathrooms
and diaper bin!
mode: single
- id: '1624048450884'
alias: Front Door Alert
description: ''
trigger:
- type: motion
platform: device
device_id: 92b464fee4dab94c831b8ff8686f330a
entity_id: binary_sensor.front_door_camera_motion
domain: binary_sensor
condition: []
action:
- service: script.set_doorbell_message
data:
message: "{% if states('input_boolean.quiet_mode') == 'on' %}\n quiet_mode\n\
{% else %}\n welcome\n{% endif %}"
- service: script.display_doorbell_snapshot_on_tvs
data: {}
mode: single
- id: '1644810800643'
alias: Vacation Faux Home On
description: Make it appear as if people are home when we're out of town
trigger:
- platform: sun
event: sunset
offset: 00:01:00
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
- type: turn_on
device_id: 44fcccda63e4e38e416babd3f3e1fded
entity_id: light.family_room_main_lights
domain: light
- type: turn_on
device_id: 59ca60e52d36629d4f1c5cca974d0cfa
entity_id: light.kitchen_main_light_switch
domain: light
mode: single
- id: '1644810923409'
alias: Vacation Faux Home Off
description: ''
trigger:
- platform: time
at: '22:01:00'
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
- type: turn_off
device_id: 59ca60e52d36629d4f1c5cca974d0cfa
entity_id: light.kitchen_main_light_switch
domain: light
- type: turn_off
device_id: 44fcccda63e4e38e416babd3f3e1fded
entity_id: light.family_room_main_lights
domain: light
mode: single
- id: '1645246661438'
alias: Mudroom Light Automation
description: Automatically turn on the Mudroom lights when motion is detected.
use_blueprint:
path: homeassistant/motion_light.yaml
input:
light_target:
device_id:
- 37ab5381dccd0ec08d2043d4cf433d72
no_motion_wait: 240
motion_entity: binary_sensor.mudroom_trisensor_home_security_motion_detection
- id: '1646251632973'
alias: Doorbell Ring (Duplicate)
description: ''
trigger:
- type: occupied
platform: device
device_id: 92b464fee4dab94c831b8ff8686f330a
entity_id: binary_sensor.front_door_camera_doorbell
domain: binary_sensor
condition: []
action:
- service: camera.snapshot
data:
filename: /config/www/images/doorbell_camera_alert.jpg
target:
device_id: 92b464fee4dab94c831b8ff8686f330a
- service: script.display_doorbell_snapshot_on_tvs
data: {}
- service: script.play_doorbell
data: {}
- service: notify.ios_family
data:
message: ' Somebody is at the front door!'
title: Kohbo Front Door
data:
image: /config/www/images/doorbell_camera_alert.jpg
mode: single
- id: '1646272122915'
alias: Turn on Outdoor Lights
description: ''
trigger:
- platform: sun
event: sunset
offset: 00:15:00
condition: []
action:
- service: homeassistant.turn_on
data: {}
target:
entity_id: group.exterior_lights
- service: script.speech_engine
data:
speech_message: The sun has set, turning on the exterior lights.
mode: single
- id: '1646272166786'
alias: Turn off Outdoor Lights
description: ''
trigger:
- platform: sun
event: sunrise
offset: -00:30:00
condition: []
action:
- service: homeassistant.turn_off
data: {}
target:
entity_id: group.exterior_lights
mode: single
- id: '1646280009884'
alias: 'Weather: Bad Weather Lighting'
description: Extra interior lights when the weather is bad
trigger:
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: '199'
below: '233'
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: '500'
below: '532'
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: '761'
below: '782'
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: '311'
below: '322'
condition:
- condition: and
conditions:
- condition: sun
before: sunset
after: sunset
- condition: time
before: '22:00:00'
after: 07:00:00
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- condition: state
entity_id: group.family
state: home
action:
- service: homeassistant.turn_on
data: {}
target:
entity_id:
- group.kitchen_lights
- light.family_room_main_lights
- service: notify.mobile_app_jk
data:
title: Weather Automation
message: The weather isn't looking to great so turning some interior lights
on.
- service: script.speech_engine
data:
speech_message: The weather isn't looking great so turning on the some interior
lights.
mode: single
- id: '1646884521741'
alias: Nino Pickup
description: ''
trigger:
- platform: time
at: '12:30:00'
condition:
- condition: time
before: 00:00:00
weekday:
- tue
- wed
- thu
action:
- service: script.notify_engine
data:
title: Kohbo Reminder
message: Time to pick up Nino from school!
who: family
- service: script.speech_engine
data:
speech_message: Time to pick up Nino from school!
mode: single
- id: '1647462190395'
alias: Quiet Mode - Enable
description: ''
trigger:
- type: not_opened
platform: device
device_id: b68b546103678f1b18954634f33f230b
entity_id: binary_sensor.gianlucas_door_sensor_ias_zone
domain: binary_sensor
condition:
- condition: state
entity_id: input_boolean.quiet_mode
state: 'off'
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.quiet_mode
mode: single
- id: '1647462317728'
alias: Quite Mode - Disable
description: ''
trigger:
- type: opened
platform: device
device_id: b68b546103678f1b18954634f33f230b
entity_id: binary_sensor.gianlucas_door_sensor_ias_zone
domain: binary_sensor
for:
hours: 0
minutes: 5
seconds: 0
condition:
- condition: state
entity_id: input_boolean.quiet_mode
state: 'on'
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.quiet_mode
mode: single
- id: '1703382935999'
alias: Playroom play time
description: ''
trigger:
- platform: conversation
command:
- Play mode
condition: []
action:
- service: media_player.play_media
target:
entity_id: media_player.sonos_playroom
data:
media_content_id: spotify://1ab9efdddfcfad61a69054a109320f8a/spotify:playlist:47VW3DAzyva9wf0o505XFq
media_content_type: spotify://playlist
metadata:
title: Nino Songs
thumbnail: https://mosaic.scdn.co/640/ab67616d00001e0219ae9f2ac27cfa4de951e56eab67616d00001e0258d16d8402fd5d1c2289ec65ab67616d00001e02774249cfb4814cce97478521ab67616d00001e027f9c9b62b5c266ec1f484397
media_class: playlist
children_media_class: track
navigateIds:
- {}
- media_content_type: spotify://library
media_content_id: spotify://1ab9efdddfcfad61a69054a109320f8a
- media_content_type: spotify://current_user_playlists
media_content_id: spotify://1ab9efdddfcfad61a69054a109320f8a/current_user_playlists
- media_content_type: spotify://playlist
media_content_id: spotify://1ab9efdddfcfad61a69054a109320f8a/spotify:playlist:47VW3DAzyva9wf0o505XFq
- service: light.turn_on
target:
entity_id: light.playroom_lights
data: {}
mode: single
- id: '1705228787929'
alias: New automation
description: ''
trigger:
- platform: time
at: 05:05:00
condition: []
action:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.hue_smart_plug_1
mode: single
- id: '1708729229186'
alias: Jumpy House Toggle New
description: ''
trigger:
- device_id: 8f2fc00a55d6328dc30ed2d53372a1f4
domain: zha
platform: device
type: remote_button_short_press
subtype: remote_button_short_press
condition: []
action:
- type: toggle
device_id: 7468fd0c889aba8fcd895aa3387c3795
entity_id: e96ec63d4a34cf5ed92370e69442c31c
domain: switch
mode: single
- id: '1710176506867'
alias: Playroom button Test
description: ''
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
device_id: cd626e869b9ddd77c680a7c1b1bd9bfc
context: {}
condition: []
action: []
mode: single
- id: '1726030107950'
alias: Toggle garage door 2
description: ''
trigger:
- event_data:
actionID: 6EE7ECA3-E8C5-4603-B741-F2B23A89C131
platform: event
event_type: ios.action_fired
condition: []
action:
- action: cover.toggle
metadata: {}
data: {}
target:
device_id: fbe1f9961737e541fa5e35c420d63bfd
mode: single
- id: '1728564743404'
alias: Temp auto - unlock garage door
description: ''
trigger:
- platform: state
entity_id:
- input_boolean.bedtime
from: 'on'
to: 'off'
for:
hours: 0
minutes: 2
seconds: 0
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: lock.garage_entry_door
state: locked
action:
- action: lock.unlock
metadata: {}
data: {}
target:
entity_id: lock.garage_entry_door
mode: single
- id: '1745156745937'
alias: ' Notify Cristina of Event'
description: ''
triggers:
- trigger: calendar
entity_id: calendar.kohbocal
event: start
offset: '-1:0:0'
conditions: []
actions: null
mode: single
- id: '1754455487847'
alias: custom assist weather test
description: ''
triggers:
- trigger: conversation
command: tell me the weather
conditions: []
actions:
- set_conversation_response: It's currently {{ states.weather.pirateweather.attributes.temperature
}} degrees with {{ states.weather.pirateweather.attributes.humidity }} percent
humidity
mode: single
- id: '1754970331821'
alias: Music Assistant Voice Command
description: Play music through voice commands
use_blueprint:
path: music-assistant/mass_assist_blueprint_en.yaml
input:
default_player_entity_id_input: media_player.office_3
- id: backyard_porch_camera_detections_animal
alias: Backyard Porch Camera Detections - Animal
mode: single
trigger:
- platform: state
entity_id: binary_sensor.backyard_porch_camera_animal_detected
to: 'on'
variables:
camera_name: Backyard Porch Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_backyard_porch_camera_high_resolution_channel
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.backyard_porch_camera_detections_animal'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
- condition: and
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''binary_sensor.kitchen_door'',''last_changed''),
0) ) | int > 600 }}'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: animal
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: backyard_porch_camera_detections_person
alias: Backyard Porch Camera Detections - Person
mode: single
trigger:
- platform: state
entity_id: binary_sensor.backyard_porch_camera_person_detected
to: 'on'
variables:
camera_name: Backyard Porch Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_backyard_porch_camera_high_resolution_channel
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.backyard_porch_camera_detections_person'',''last_triggered''),
0) ) | int > 180 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
- condition: and
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''binary_sensor.kitchen_door'',''last_changed''),
0) ) | int > 600 }}'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: person
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: backyard_south_camera_detections_animal
alias: Backyard South Camera Detections - Animal
mode: single
trigger:
- platform: state
entity_id: binary_sensor.backyard_south_camera_animal_detected
to: 'on'
variables:
camera_name: Backyard South Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_backyard_south_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.backyard_south_camera_detections_animal'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: animal
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: backyard_south_camera_detections_person
alias: Backyard South Camera Detections - Person
mode: single
trigger:
- platform: state
entity_id: binary_sensor.backyard_south_person_detected
to: 'on'
variables:
camera_name: Backyard South Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_backyard_south_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.backyard_south_camera_detections_person'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: person
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: bad_weather_mode_off
initial_state: 'on'
alias: Bad Weather Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: sensor.pirateweather_summary
to: sunny
- platform: numeric_state
entity_id: sensor.pirateweather_cloud_coverage
above: '41'
- platform: numeric_state
entity_id: sensor.tempest_illuminance
above: 150
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bad_weather
state: 'on'
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: or
conditions:
- condition: state
entity_id: sensor.pirateweather_summary
state: sunny
- condition: state
entity_id: sensor.pirateweather_summary
state: clear
- condition: state
entity_id: sensor.pirateweather_summary
state: party cloudy
- condition: numeric_state
entity_id: sensor.pirateweather_cloud_coverage_1h
below: '40'
- condition: numeric_state
entity_id: sensor.pirateweather_cloud_coverage
above: '41'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.bad_weather
- id: bad_weather_mode_on
initial_state: 'on'
alias: Bad Weather Mode On
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id: sensor.pirateweather_summary
to:
- exceptional
- lightning
- rainy
- snowy
- snowy rainy
- platform: state
entity_id: sensor.pirateweather_alerts
- platform: numeric_state
entity_id: sensor.pirateweather_cloud_coverage
above: 75
- platform: numeric_state
entity_id: sensor.tempest_illuminance
below: 50
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bad_weather
state: 'off'
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: or
conditions:
- condition: state
entity_id: sensor.pirateweather_summary
state:
- exceptional
- lightning
- rainy
- snowy
- snowy rainy
- condition: numeric_state
entity_id: sensor.pirateweather_alerts
above: 1
- condition: and
conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.tempest_precipitation
above: '.01'
- condition: numeric_state
entity_id: sensor.tempest_precipitation_intensity
above: '.25'
- condition: numeric_state
entity_id: sensor.tempest_illuminance
below: 150
action:
- service: input_boolean.turn_on
entity_id: input_boolean.bad_weather
- id: basement_mode_auto
initial_state: true
alias: Basement mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.basement'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.basement
option: Auto
- id: basement_mode_off
initial_state: true
alias: Basement mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.basement'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.basement
option: 'Off'
- id: basement_not_occupied
initial_state: true
alias: Basement not occupied
trigger:
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''basement'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.basement_motion_sensor
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.basement_occupancy_sensor
to: 'off'
- platform: state
entity_id: binary_sensor.basement_occupancy_sensor
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.basement_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
- condition: state
entity_id: binary_sensor.basement_occupancy_sensor
state: 'off'
for:
minutes: 5
- condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: binary_sensor.basement_occupancy_sensor
state: 'off'
for:
minutes: 2
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''basement'')|map(attribute=''name'')|list | length == 0 }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.basement_occupied
- id: basement_occupied
initial_state: true
alias: Basement occupied
trigger:
- platform: state
entity_id: binary_sensor.basement_motion_sensor
to: 'on'
- platform: state
entity_id: binary_sensor.basement_occupancy_sensor
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.basement_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''basement'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: binary_sensor.basement_occupancy_sensor
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.basement_occupied
- id: bedtime_mode_off
alias: Bedtime Mode - Off
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.everybody_in_bed
to: 'off'
- trigger: state
entity_id:
- input_boolean.cristina_is_awake
- input_boolean.john_is_awake
to: 'on'
- trigger: time
at: 06:30:00
- trigger: sun
event: sunrise
condition:
- condition: time
after: 05:00:00
- condition: or
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: state
entity_id: input_boolean.john_is_awake
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.cristina_home
state: 'on'
- condition: state
entity_id: input_boolean.cristina_is_awake
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.bedtime
- id: bedtime_mode_on
initial_state: true
alias: Bedtime Mode - On
triggers:
- trigger: state
entity_id: binary_sensor.everybody_in_bed
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- action: input_boolean.turn_on
entity_id: input_boolean.bedtime
- id: bedtime_mode_vacation_on
initial_state: true
alias: Bedtime Mode - Vacation On
triggers:
- trigger: time
at: '22:00:00'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- action: input_boolean.turn_on
entity_id: input_boolean.bedtime
- id: bedtime_mode_vacation_off
initial_state: true
alias: Bedtime Mode - Vacation Off
triggers:
- trigger: time
at: 07:00:00
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- action: input_boolean.turn_off
entity_id: input_boolean.bedtime
- id: bedtime_notifications
alias: Bedtime Notifications
mode: single
trigger:
- platform: state
entity_id: input_select.main_bedroom
to: Bedtime
condition:
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
action:
- service: input_text.set_value
entity_id: input_text.bedtime_notification_message
data:
value: ''
- if:
- condition: state
entity_id: lock.front_door
state: unlocked
then:
- service: input_text.set_value
entity_id: input_text.bedtime_notification_message
data:
value: The front door is unlocked.
- if:
- condition: state
entity_id: binary_sensor.jr_suite_door_status
state: 'off'
then:
- service: input_text.set_value
entity_id: input_text.bedtime_notification_message
data:
value: "{% set message = states.input_text.bedtime_notification_message.state\
\ %} {% set vac_message = \"the junior suite door is closed, so the vacuum\
\ will get stuck\" %} {% if message | length > 0 %}\n \"{{message}} and\
\ {{vac_message}}\"\n{% else %}\n {{vac_message}}\n{% endif %}"
- if:
- condition: state
entity_id: binary_sensor.windows
state: 'on'
then:
- service: input_text.set_value
entity_id: input_text.bedtime_notification_message
data:
value: "{% set open_windows = expand('binary_sensor.windows')|selectattr('state',\
\ 'eq', 'on')|map(attribute='name')|list|unique|join(', ') %} {% set window_message\
\ = \"The following windows are still open: \" + open_windows %}\n{% set\
\ message = states.input_text.bedtime_notification_message.state %} {% if\
\ message | length > 0 %}\n \"{{message}} and {{window_message}}\"\n{%\
\ else %}\n {{window_message}}\n{% endif %}"
- condition: template
value_template: '{{states.input_text.bedtime_notification_message.state | length
> 0}}'
- service: input_text.set_value
entity_id: input_text.bedtime_notification_message
data:
value: Hey there, just wanted to let you know {{states.input_text.bedtime_notification_message.state}}
- service: script.general_notification
data:
message: '{{states.input_text.bedtime_notification_message.state}}'
title: Bedtime Notifications
devices: jk
priority: time-sensitive
tag: bedtime-notifications
- service: media_player.volume_set
data:
entity_id: media_player.main_bedroom
volume_level: 0.25
- service: notify.alexa_media
data:
data:
type: tts
target: media_player.kohbo_dot_main_bedroom
message: '{{states.input_text.bedtime_notification_message.state}}'
- id: birthday_today_reminder
alias: Birthday Today Reminder
mode: single
trigger:
- platform: time
at: 07:35:00
- platform: time
at: '17:15:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: calendar.birthdays_2
state: 'on'
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: success-trumpets
priority: normal
speech_message: "{{ \n [\n \"Hey fam, just wanted to remind you that today\
\ is \" ~ states.calendar.birthdays_2.attributes.message,\n \"Just a quick\
\ reminder that it's \" ~ states.calendar.birthdays_2.attributes.message ~\
\ \" today!\",\n \"Pardon the interruption, don't forget that today is\
\ \" ~ states.calendar.birthdays_2.attributes.message\n ] | random\n}}"
- service: script.general_notification
data:
message: Today is {{states.calendar.birthdays_2.attributes.message}}
title: Birthday Reminder
devices: jk
priority: active
tag: birthday-reminder
- id: birthday_tomorrow_reminder
alias: Birthday Tomorrow Reminder
mode: single
trigger:
- platform: time
at: '18:30:00'
- platform: time
at: '20:05:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.birthday_tomorrow
state: 'on'
- condition: time
after: '17:00:00'
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: success-trumpets
priority: high
speech_message: "{{ \n [\n \"Hey fam, just wanted to remind you that tomorrow\
\ is \" ~ states.calendar.birthdays_2.attributes.message,\n \"Just a quick\
\ reminder that \" ~ states.calendar.birthdays_2.attributes.message ~ \" is\
\ tomorrow.\",\n \"Pardon the interruption, don't forget that tomorrow\
\ is \" ~ states.calendar.birthdays_2.attributes.message\n ] | random\n}}"
- service: script.general_notification
data:
message: Tomorrow is {{states.calendar.birthdays_2.attributes.message}}
title: Birthday Reminder
devices: jk
priority: active
tag: birthday-reminder
- id: bmw_is_away
alias: BMW is Away
initial_state: true
trigger:
- platform: state
entity_id: sensor.bmw_presence
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: sensor.bmw_presence
state: not_home
action:
- service: input_boolean.turn_off
entity_id: input_boolean.bmw_home
- id: bmw_is_home
initial_state: true
alias: BMW is Home
trigger:
- platform: state
entity_id: sensor.bmw_presence
from: not_home
- platform: state
entity_id: sensor.bmw_presence
to: garage
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: sensor.bmw_presence
state: garage
- condition: template
value_template: '{{ states.sensor.bmw_presence.state != ''not_home''}}'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.bmw_home
- id: camera_notifications_activate
alias: Camera Notifications - Activate
mode: single
initial_state: true
trigger:
- platform: state
entity_id: input_select.house
to: Away
- platform: time
at: '22:00:00'
- platform: sun
event: sunset
offset: 00:15:00
- platform: state
entity_id: binary_sensor.exterior_doors
to: 'off'
for:
minutes: 45
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id: input_boolean.camera_notifications
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.camera_notifications
- service: script.general_notification
data:
title: Security Cameras
message: Camera detections have been enabled.
devices: all
priority: time-sensitive
tag: camera-notifications
- id: camera_notifications_deactivate
alias: Camera Notifications - Deactivate
mode: single
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
for:
minutes: 15
- platform: state
entity_id: input_select.house
to: Auto
for:
minutes: 30
- platform: sun
event: sunrise
offset: 00:15:00
- platform: state
entity_id: binary_sensor.exterior_doors
to: 'on'
- platform: state
entity_id:
- input_boolean.cristina_home
- input_boolean.john_home
- input_boolean.joe_home
- input_boolean.nonna_home
- input_boolean.katia_home
to: 'on'
- platform: state
entity_id: cover.garage_doors
to: open
condition:
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
- condition: state
entity_id: group.family
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: sun.sun
state: above_horizon
action:
- service: input_boolean.turn_off
entity_id: input_boolean.camera_notifications
- service: script.general_notification
data:
title: Security Cameras
message: Camera detections have been disabled to cut down on notification overload.
devices: all
priority: time-sensitive
tag: camera-notifications
- id: christmas_activated
alias: Christmas Activated
mode: single
trigger:
- platform: state
entity_id: input_boolean.dark_outside
to: 'on'
- platform: time
at: '16:00:00'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.christmas_active
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '16:00:00'
- condition: time
after: '12:00:00'
before: '22:00:00'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.christmas_active
- id: christmas_disabled
alias: Christmas Disabled
mode: single
trigger:
- platform: homeassistant
event: start
- platform: time
at: 02:00:00
condition:
- condition: state
entity_id: input_boolean.christmas_season_active
state: 'on'
- condition: template
value_template: '{% set d = now() %} {{ (d.month == 1 and d.day > 7) or (d.month
> 2 and d.month < 12) }}
'
action:
- service: script.turn_on
entity_id: script.christmas_disable_automations
- id: christmas_enabled
alias: Christmas Enabled
mode: single
trigger:
- platform: homeassistant
event: start
- platform: time
at: 02:00:00
condition:
- condition: template
value_template: '{% set d = now() %} {{ d.month == 12 or (d.month == 1 and ( 1<=
d.day <= 7)) }}
'
- condition: state
entity_id: input_boolean.christmas_season_active
state: 'off'
action:
- service: script.turn_on
entity_id: script.christmas_enable_automations
- id: turn_on_christmas_lights
alias: Turn ON Christmas Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.christmas_active
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.christmas_lights
- id: turn_off_christmas_lights
alias: Turn OFF Christmas Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.christmas_active
to: 'off'
- platform: state
entity_id: input_boolean.christmas_active
to: 'off'
for:
minutes: 3
action:
- service: switch.turn_off
entity_id: switch.christmas_lights
- id: handle_ikea_unresponsive
alias: Handle IKEA Unresponsive
mode: single
trigger:
- platform: state
entity_id:
- switch.tradfri_smart_plug_1_switch
- switch.tradfri_smart_plug_2_switch
- switch.tradfri_smart_plug_3_switch
- switch.tradfri_smart_plug_4_switch
from: unresponsive
action:
choose:
- conditions:
- condition: state
entity_id: input_boolean.christmas_active
state: 'on'
sequence:
- service: switch.turn_on
target:
entity_id:
- switch.tradfri_smart_plug_1_switch
- switch.tradfri_smart_plug_2_switch
- switch.tradfri_smart_plug_3_switch
- switch.tradfri_smart_plug_4_switch
- conditions:
- condition: state
entity_id: input_boolean.christmas_active
state: 'off'
sequence:
- service: switch.turn_off
target:
entity_id:
- switch.tradfri_smart_plug_1_switch
- switch.tradfri_smart_plug_2_switch
- switch.tradfri_smart_plug_3_switch
- switch.tradfri_smart_plug_4_switch
- id: christmas_not_activated
alias: Christmas NOT Activated
mode: single
trigger:
- platform: state
entity_id: input_boolean.dark_outside
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_select.house
to: Bedtime
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.christmas_active
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_select.house
state: Bedtime
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.christmas_active
- service: notify.mobile_app_jk_2
data:
title: Holidays
message: Christmas is NO longer activate
- id: christmas_shortcut_button
alias: Christmas Shortcut Button
initial_state: false
trigger:
- device_id: d98b081e7991a6e9ce1672128dad93ae
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_on
action:
- service: input_boolean.toggle
entity_id: input_boolean.christmas_active
- alias: Wait 1 seconds
delay: 1
- id: vacuum_clean_dining_and_foyer_at_night
alias: Vacuum - Clean Dining and Foyer at Night
mode: single
triggers:
- trigger: time
at: '21:00:00'
id: nightly_check
- trigger: state
entity_id: input_boolean.guest_mode
to: 'off'
for:
minutes: 15
enabled: true
id: guest_mode_off
conditions:
- condition: or
conditions:
- condition: trigger
id: nightly_check
- condition: and
conditions:
- condition: trigger
id: guest_mode_off
- condition: time
after: '21:00:00'
before: '23:00:00'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'off'
- condition: template
value_template: "{% set vacation = states.input_boolean.vacation_mode %} {% if\
\ vacation.state == \"on\" %}\n {{ (now() - vacation.last_changed).total_seconds()\
\ < 86400 }}\n{% else %}\n true\n{% endif %}\n"
- condition: state
entity_id: binary_sensor.jr_suite_door_status
state: 'on'
- condition: template
value_template: "{% set last_run = state_attr('automation.vacuum_clean_dining_and_foyer_at_night',\
\ 'last_triggered') %} {% set yesterday_start = now().replace(hour=0, minute=0,\
\ second=0) - timedelta(days=1) %} {% set yesterday_end = now().replace(hour=0,\
\ minute=0, second=0) %} {% set entertainment_yesterday = states.input_boolean.entertainment_mode.last_changed.replace(hour=0,\
\ minute=0, second=0) >= yesterday_start \n and states.input_boolean.entertainment_mode.last_changed\
\ < yesterday_end %}\n\n{% if last_run != None %}\n {% set days_since_last_run\
\ = (now() - last_run).total_seconds() / 108000 %}\n {% if entertainment_yesterday\
\ %}\n {# Run if there was entertainment yesterday, regardless of last run\
\ #}\n {{ true }}\n {% else %}\n {# Otherwise run if it's been at least\
\ 2 days since last run #}\n {{ days_since_last_run >= 2 }}\n {% endif %}\n\
{% else %}\n {{ true }}\n{% endif %}\n"
- condition: template
value_template: "{{ states('input_boolean.sylvia_home') == 'off' \n and (now()\
\ - states.input_boolean.sylvia_home.last_changed).total_seconds() > 86400 }}\n"
actions:
- action: vacuum.send_command
target:
entity_id: vacuum.roborock_s7
data:
command: app_segment_clean
params:
- 20
- 23
- id: clean_kitchen_and_family_room_at_night
alias: Vacuum - Clean Kitchen and Family Room at Night
mode: single
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
for:
minutes: 30
- trigger: time
at: 01:01:00
conditions:
- condition: time
after: '22:00:00'
before: 07:00:00
- condition: state
entity_id: binary_sensor.jr_suite_door_status
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- condition: template
value_template: "{% set vacation_last_changed = states.input_boolean.vacation_mode.last_changed\
\ %} {% if states.input_boolean.vacation_mode.state == \"on\" %}\n {{ (now()\
\ - vacation_last_changed).total_seconds() < 86400 }}\n{% else %}\n {{ false\
\ }}\n{% endif %}\n"
actions:
- action: vacuum.send_command
target:
entity_id: vacuum.roborock_s7
data:
command: app_segment_clean
params:
- 24
- 25
- 26
- id: clean_kitchen_when_unoccupied
alias: Vacuum - Clean Kitchen When Unoccupied
mode: single
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
for:
minutes: 5
conditions:
- condition: state
entity_id: vacuum.roborock_s7
state: docked
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: 08:00:00
before: 09:30:00
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: and
conditions:
- condition: time
after: 08:30:00
before: '10:30:00'
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: binary_sensor.jr_suite_door_status
state: 'on'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
actions:
- action: vacuum.send_command
target:
entity_id: vacuum.roborock_s7
data:
command: app_segment_clean
params:
- 24
- id: return_vacuum_when_occupied
alias: Vacuum - Return to Dock When House Occupied
mode: single
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
conditions:
- condition: state
entity_id: vacuum.roborock_s7
state: cleaning
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: 08:00:00
before: 09:30:00
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: and
conditions:
- condition: time
after: 08:30:00
before: '10:30:00'
- condition: time
weekday:
- sat
- sun
actions:
- action: vacuum.return_to_base
target:
entity_id: vacuum.roborock_s7
- id: cristina_announce_arrival
alias: Cristina Announce Arrival
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.cristina_status_dropdown
from: Away
to: Just Arrived
- platform: state
entity_id: input_select.cristina_status_dropdown
from: Extended Away
to: Just Arrived
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- service: script.voice_announcement
data:
media_players: auto
sound: fanfare
speech_message: "{{\n [\n \"Guess who's home? It's Mamma!\",\n \"Stop\
\ what you're doing, mamma is home!\",\n \"Mamma is home! Yay!\",\n \
\ \"And the house becomes a home. Welcome back Mamma!\",\n \"Pardon the\
\ interruption but Mamma is home!\",\n \"Knock knock. Who's there? It's\
\ Mamma!\",\n \"Yo hey! Mamma is home!\",\n \"Our queen has arrived!\
\ Welcome Mamma!\",\n \"Ciao! Mamma is home!\"\n ] | random\n}}"
- id: cristina_announce_departure
alias: Cristina Announce Departure
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.cristina_home
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- service: script.voice_announcement
data:
media_players: auto
expires_in: 2
speech_message: "{{\n [\n \"Arrivederci! Mamma has left the house.\",\n\
\ \"Ciao Mamma! See you later.\",\n \"Mamma just left, but she misses\
\ you dearly!\",\n \"Mamma just left, but don't worry, she'll be back soon.\"\
,\n \"Pardon the interruption but Mamma has left the house.\",\n \"\
Attention! Mamma left the house.\"\n ] | random\n}}"
- id: cristina_arrived_work
alias: Cristina arrived at work
initial_state: 'on'
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.cristina_s_work
event: enter
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
- condition: time
before: '10:00:00'
- condition: state
entity_id: person.cristina_falbo
state: Cristina's Work
action:
- service: script.cristina_arrived_work
data:
who: cfalb
- service: script.general_notification
data:
title: Cristina is at work
message: Cristina has arrived at work!
devices: jk
priority: passive
tag: cristina-arrived-work
- id: cristina_away
alias: Cristina away
initial_state: 'on'
trigger:
- platform: zone
entity_id:
- person.cristina_falbo
- device_tracker.cfalb_iphone_14
zone: zone.home
event: leave
- platform: state
entity_id:
- person.cristina_falbo
- device_tracker.cfalb_iphone_14
to: not_home
- platform: state
entity_id: binary_sensor.cristina_presence
to: 'off'
- platform: state
entity_id: binary_sensor.cristina_presence
to: 'off'
for:
minutes: 3
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: template
value_template: '{{ not is_state(''input_select.cristina_status_dropdown'', ''Just
Arrived'') }}'
- condition: state
entity_id: input_boolean.cristina_home
state: 'on'
- condition: state
entity_id: person.cristina_falbo
state: not_home
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.cristina_presence
state: 'off'
- condition: state
entity_id: device_tracker.cfalb_iphone_14
state: not_home
action:
- service: script.turn_on
data:
entity_id: script.cristina_away
- id: cristina_bed_awake
alias: Cristina Bed - Awake
mode: single
trigger:
- platform: state
entity_id: input_select.cristina_sleep_state
to: Just Got Up
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.cristina_sleep_state
option: Awake
- id: cristina_bed_just_got_up
alias: Cristina Bed - Just Got Up
mode: single
trigger:
- platform: state
entity_id: binary_sensor.cristina_bed_occupied
to: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.cristina_sleep_state
option: Just Got Up
- id: cristina_bed_just_laid_down
alias: Cristina Bed - Just Laid Down
mode: single
trigger:
- platform: state
entity_id: binary_sensor.cristina_bed_occupied
to: 'on'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.cristina_sleep_state'',''Sleep'')
}}'
action:
- service: input_select.select_option
data:
entity_id: input_select.cristina_sleep_state
option: Just Laid Down
- id: cristina_bed_sleep
alias: Cristina Bed - Sleep
mode: single
trigger:
- platform: state
entity_id: input_select.cristina_sleep_state
to: Just Laid Down
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.cristina_sleep_state
option: Sleep
- id: cristina_commute_arrived_glenview_station
alias: Cristina Commute - Arrived at Glenview Station
initial_state: false
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.glenview_train_station
event: enter
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.cristina_commuting
state: 'on'
action:
- service: automation.turn_off
entity_id:
- automation.cristina_commute_departed_union_station
- automation.cristina_commute_passing_morton_grove_station
- automation.cristina_commute_arrived_at_glenview_station
- id: cristina_commute_arrived_union_station
alias: Cristina Commute - Arrived at Union Station
initial_state: true
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.union_station
event: enter
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: state
entity_id: person.cristina_falbo
state: Union Station
- condition: time
before: '12:00:00'
action:
- service: automation.turn_on
entity_id:
- automation.cristina_commute_departed_union_station
- automation.cristina_commute_passing_morton_grove_station
- automation.cristina_commute_arrived_at_glenview_station
- service: script.voice_announcement
data:
media_players: auto
priority: normal
speech_message: "{{\n [\n \"Attention! Mamma just arrived at Union Station.\"\
,\n \"Pardon the interruption, just wanted to let you know Mamma's train\
\ arrived downtown.\"\n ] | random\n}}"
- id: cristina_commute_departed_union_station
alias: Cristina Commute - Departed Union Station
initial_state: false
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.union_station
event: leave
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.cristina_commuting
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
priority: normal
speech_message: "{{\n [\n \"Attention! Mamma just left Union Station.\"\
,\n \"Pardon the interruption, but Mamma is on the train headed home.\"\
,\n \"Just a friendly note that Mamma's train has departed.\"\n ] | random\n\
}}"
- id: cristina_commute_passing_morton_grove_station
alias: Cristina Commute - Passing Morton Grove Station
initial_state: false
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.morton_grove_train_station
event: enter
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.cristina_commuting
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
priority: normal
expires_in: 3
speech_message: "{{\n [\n \"Attention! Mamma's train will arrive within\
\ five minutes!\",\n \"Pardon the interruption, but Mamma's train is arriving\
\ soon.\",\n \"Just a friendly note that Mamma's train is arriving shortly.\"\
\n ] | random\n}}"
- id: cristina_daily_medication_reminder
alias: Cristina Daily Medication Reminder
trigger:
- trigger: time
at: 07:30:00
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.cristina_daily_medication_timer
- trigger: state
entity_id: input_boolean.cristina_home
to: 'on'
for:
minutes: 15
conditions:
- condition: state
entity_id: input_boolean.cristina_daily_medication_taken
state: 'off'
- condition: state
entity_id: timer.cristina_daily_medication_timer
state: idle
- condition: state
entity_id: input_boolean.cristina_is_awake
state: 'on'
- or:
- condition: state
entity_id: input_boolean.cristina_home
state: 'on'
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Extended Away
actions:
- variables:
action_taken: '{{ ''TAKEN_'' ~ context.id }}'
action_snooze: '{{ ''SNOOZE_'' ~ context.id }}'
- action: notify.mobile_app_cfalb2
data:
message: Cristina, it's time to take your morning medication.
title: Medication Reminder
data:
tag: cristina-morning-medication
push:
interruption-level: critical
actions:
- action: '{{ action_taken }}'
title: Medication Taken
- action: '{{ action_snooze }}'
title: Snooze 30 Minutes
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_taken }}'
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_snooze }}'
timeout:
minutes: 30
- if:
- '{{ not wait.completed }}'
then:
- action: timer.start
entity_id: timer.cristina_daily_medication_timer
else:
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_taken }}'
then:
- action: input_boolean.turn_on
entity_id: input_boolean.cristina_daily_medication_taken
- action: timer.cancel
entity_id: timer.cristina_daily_medication_timer
- action: automation.turn_off
entity_id: automation.cristina_daily_medication_reminder
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_snooze }}'
then:
- action: timer.start
entity_id: timer.cristina_daily_medication_timer
- id: cristina_medication_reminder_reset
alias: Cristina Medication Reminder Reset
trigger:
- trigger: time
at: 03:00:01
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.cristina_daily_medication_taken
- action: timer.cancel
entity_id: timer.cristina_daily_medication_timer
- action: automation.turn_on
entity_id: automation.cristina_daily_medication_reminder
- id: cristina_departed_work
alias: Cristina has left the office
initial_state: 'on'
trigger:
- platform: zone
entity_id: person.cristina_falbo
zone: zone.cristina_s_work
event: leave
- platform: numeric_state
entity_id: sensor.paramount_cristina_distance
above: 1
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
- condition: time
after: '16:00:00'
- condition: state
entity_id: sensor.paramount_cristina_direction_of_travel
state: away_from
action:
- service: script.cristina_left_work
data:
who: cfalb
- id: cristina_extended_away
alias: Cristina - Extended Away
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.cristina_status_dropdown
to: Away
for:
hours: 24
- platform: numeric_state
entity_id: sensor.home_cristina_distance
above: 200
action:
- service: input_select.select_option
target:
entity_id: input_select.cristina_status_dropdown
data:
option: Extended Away
- id: cristina_friday_medication_reminder
alias: Cristina Friday Medication Reminder
triggers:
- trigger: time
at: '21:30:00'
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.cristina_friday_medication_timer
conditions:
- condition: template
value_template: '{{ now().isoweekday() == 5 }}'
- condition: state
entity_id: input_boolean.cristina_friday_medication_taken
state: 'off'
action:
- variables:
action_taken: '{{ ''FRIDAY_TAKEN_'' ~ context.id }}'
action_snooze: '{{ ''FRIDAY_SNOOZE_'' ~ context.id }}'
- action: notify.mobile_app_cfalb2
data:
message: Cristina, it's time to take your Friday evening medication.
title: Friday Medication Reminder
data:
tag: cristina-friday-medication
push:
interruption-level: critical
actions:
- action: '{{ action_taken }}'
title: Medication Taken
- action: '{{ action_snooze }}'
title: Snooze 30 Minutes
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_taken }}'
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_snooze }}'
timeout:
minutes: 30
- choose:
- conditions:
- condition: template
value_template: '{{ not wait.completed }}'
sequence:
- action: timer.start
entity_id: timer.cristina_friday_medication_timer
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_taken }}'
sequence:
- action: input_boolean.turn_on
entity_id: input_boolean.cristina_friday_medication_taken
- action: timer.cancel
entity_id: timer.cristina_friday_medication_timer
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_snooze }}'
sequence:
- action: timer.start
entity_id: timer.cristina_friday_medication_timer
- id: cristina_friday_medication_reminder_reset
alias: Cristina Friday Medication Reminder Reset
triggers:
- trigger: time
at: 03:00:01
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.cristina_friday_medication_taken
- action: timer.cancel
entity_id: timer.cristina_friday_medication_timer
- id: cristina_home
initial_state: 'on'
alias: Cristina Home
trigger:
- platform: state
entity_id: binary_sensor.cristina_presence
to: 'on'
- platform: zone
entity_id:
- person.cristina_falbo
- device_tracker.cfalb_iphone_14
zone: zone.home
event: enter
- platform: state
entity_id:
- person.cristina_falbo
- device_tracker.cfalb_iphone_14
to: home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.cristina_presence
state: 'on'
- condition: state
entity_id: person.cristina_falbo
state: home
- condition: state
entity_id: device_tracker.cfalb_iphone_14
state: home
- condition: zone
entity_id:
- person.cristina_falbo
- device_tracker.cfalb_iphone_14
zone: zone.home
action:
- service: script.turn_on
entity_id: script.cristina_home
- id: cristina_in_bed
alias: Cristina in bed
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.cristina_sleeping
to: 'on'
for:
minutes: 1
- platform: state
entity_id: input_select.cristina_sleep_state
to: Sleep
- platform: state
entity_id: input_select.cristina_sleep_state
to: Just Laid Down
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.cristina_sleep_state
state: Sleep
- condition: state
entity_id: input_select.cristina_sleep_state
state: Just Laid Down
- condition: state
entity_id: input_boolean.cristina_home
state: 'on'
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.cristina_in_bed
- service: input_boolean.turn_off
entity_id: input_boolean.cristina_is_awake
- id: cristina_is_commuting
alias: Cristina is Commuting
initial_state: true
trigger:
- platform: state
entity_id: person.cristina_falbo
to:
- Morton Grove Train Station
- Union Station
for:
minutes: 2
condition:
- condition: state
entity_id: input_boolean.cristina_home
state: 'off'
- condition: state
entity_id: input_boolean.cristina_commuting
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.cristina_commuting
- service: automation.turn_on
entity_id: automation.cristina_is_not_commuting
- id: cristina_is_not_commuting
alias: Cristina is Not Commuting
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.cristina_home
to: 'on'
condition:
- condition: state
entity_id: input_boolean.cristina_commuting
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.cristina_commuting
- service: automation.turn_off
entity_id: automation.cristina_is_not_commuting
- id: cristina_wake_up
alias: Cristina wake up
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.cristina_sleeping
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_select.cristina_sleep_state
to: Awake
- platform: state
entity_id: input_select.cristina_sleep_state
to: Just Got Up
for:
minutes: 2
condition:
- condition: state
entity_id: binary_sensor.cristina_sleeping
state: 'off'
- condition: state
entity_id: input_boolean.cristina_home
state: 'on'
- condition: state
entity_id: input_boolean.cristina_in_bed
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.cristina_in_bed
- service: input_boolean.turn_on
entity_id: input_boolean.cristina_is_awake
- id: turn_on_dark_outside
alias: Turn on Dark Outside
mode: single
trigger:
- platform: sun
event: sunset
- platform: sun
event: sunset
offset: 00:10:00
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- platform: numeric_state
entity_id: sensor.tempest_illuminance
below: 30
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.dark_outside
state: 'off'
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4.0
- condition: numeric_state
entity_id: sensor.tempest_illuminance
below: 30
action:
- service: input_boolean.turn_on
entity_id: input_boolean.dark_outside
- id: turn_off_dark_outside
alias: Turn off Dark Outside
mode: single
trigger:
- platform: sun
event: sunrise
- platform: sun
event: sunrise
offset: -00:10:00
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: -4.0
- platform: numeric_state
entity_id: sensor.tempest_illuminance
above: 51
for:
minutes: 2
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
above: -4.0
- condition: numeric_state
entity_id: sensor.tempest_illuminance
above: 31
action:
- service: input_boolean.turn_off
entity_id: input_boolean.dark_outside
- id: dining_room_lights_off
initial_state: true
alias: Dining Room lights off
trigger:
- platform: state
entity_id: input_select.dining_room
to: 'Off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.dining_room_lights
state: 'on'
- condition: state
entity_id: input_select.dining_room
state: 'Off'
action:
- service: light.turn_off
entity_id: light.dining_room_lights
- id: dining_room_mode_auto
initial_state: true
alias: Dining Room mode Auto
trigger:
- platform: state
entity_id: input_boolean.dining_room_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.dining_room'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.dining_room
option: Auto
- id: dining_room_mode_off
initial_state: true
alias: Dining Room mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.dining_room'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.dining_room
option: 'Off'
- id: dining_room_not_occupied
initial_state: true
alias: Dining Room not occupied
trigger:
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''living_room'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.dining_room_north_motion_sensor_motion
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.dining_room_north_motion_sensor_occupancy
to: 'off'
- platform: state
entity_id: binary_sensor.dining_room_north_motion_sensor_occupancy
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.dining_room_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
- condition: state
entity_id: binary_sensor.dining_room_north_motion_sensor_occupancy
state: 'off'
for:
minutes: 5
- condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: binary_sensor.dining_room_north_motion_sensor_motion
state: 'off'
for:
minutes: 5
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''living_room'')|map(attribute=''name'')|list | length == 0 }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.dining_room_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.dining_room_lighting_automations
- id: dining_room_occupied
initial_state: true
alias: Dining Room occupied
trigger:
- platform: state
entity_id: binary_sensor.dining_room_north_motion_sensor_motion
to: 'on'
- platform: state
entity_id: binary_sensor.dining_room_north_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: light.dining_room_lights
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.dining_room_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''living_room'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: binary_sensor.dining_room_north_motion_sensor_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.dining_room_occupied
- id: district_school_year_activate
alias: District School Year - Activate
mode: single
trigger:
- platform: time
at: input_datetime.district_34_first_day_of_school
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: template
value_template: "{{ \n states.input_datetime.district_34_first_day_of_school.attributes.timestamp\
\ < (now() | as_timestamp)\n and\n states.input_datetime.district_34_last_day_of_school.attributes.timestamp\
\ > (now() | as_timestamp)\n}}"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.district_school_year_active
- service: automation.turn_on
entity_id:
- automation.primary_school_day_on
- automation.primary_school_day_off
- automation.nino_school_day_on
- automation.nino_school_day_off
- automation.school_departure_reminder
- automation.school_day_reminder
- id: district_school_year_deactivate
alias: District School Year - Deactivate
mode: single
trigger:
- platform: time
at: input_datetime.district_34_last_day_of_school
condition:
- condition: state
entity_id: input_boolean.district_school_year_active
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.district_school_year_active
- service: automation.turn_off
entity_id:
- automation.primary_school_day_on
- automation.primary_school_day_off
- automation.school_departure_reminder
- automation.school_day_reminder
- id: doorbell_ring
alias: Doorbell Ring
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.front_door_camera_doorbell
to: 'on'
action:
- action: script.activate_doorbell_chime
data: {}
- action: script.display_doorbell_snapshot_on_tv
data: {}
- action: script.general_notification
data:
title: Front Door
message: Somebody is at the front door!
devices: all
priority: time-sensitive
tag: doorbell-ring
- id: door_left_open
alias: Door Left Open
mode: single
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.interior_garage_door
- binary_sensor.front_door_status
to: 'on'
for:
minutes: 5
- trigger: state
entity_id:
- binary_sensor.interior_garage_door
- binary_sensor.front_door_status
to: 'on'
for:
minutes: 10
- trigger: state
entity_id:
- binary_sensor.interior_garage_door
- binary_sensor.front_door_status
to: 'on'
for:
minutes: 15
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.snooze_door_left_open_automation
conditions:
- condition: state
entity_id: timer.snooze_door_left_open_automation
state: idle
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.interior_garage_door
state: 'on'
- condition: state
entity_id: binary_sensor.front_door_status
state: 'on'
actions:
- variables:
action_snooze: '{{ ''SNOOZE_'' ~ context.id }}'
- action: script.voice_announcement
data:
media_players: auto
sound: police-whistle
priority: high
speech_message: '{{ trigger.from_state.attributes.friendly_name }} has been
open for too long, please close the door!'
- action: script.general_notification
data:
title: Exterior House Doors
message: '{{ trigger.from_state.attributes.friendly_name }} has been open for
too long, please close the door!'
devices: all
priority: time-sensitive
tag: door-open
actions:
- action: '{{ action_snooze }}'
title: Snooze 30 Minutes
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_snooze }}'
timeout:
minutes: 3
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_snooze }}'
then:
- action: timer.start
entity_id: timer.snooze_door_left_open_automation
- id: driveway_front_camera_detections_animal
alias: Driveway Front Camera Detections - Animal
mode: single
trigger:
- platform: state
entity_id: binary_sensor.driveway_front_camera_animal_detected
to: 'on'
variables:
camera_name: Driveway Front Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_driveway_front_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.driveway_front_camera_detections_animal'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: animal
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: driveway_front_camera_detections_person
alias: Driveway Front Camera Detections - Person
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.driveway_front_camera_person_detected
to: 'on'
variables:
camera_name: Driveway Front Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_driveway_front_camera_high
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.driveway_front_camera_detections_person'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: state
entity_id: cover.garage_doors
state: closed
- condition: state
entity_id: binary_sensor.garage_ble_occupancy
state: 'off'
for:
minutes: 2
actions:
- action: script.camera_detection_alert
data:
detection_type: person
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: driveway_front_camera_detections_vehicle
alias: Driveway Front Camera Detections - Vehicle
mode: single
trigger:
- platform: state
entity_id: binary_sensor.driveway_front_camera_vehicle_detected
to: 'on'
variables:
camera_name: Driveway Front Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_driveway_front_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.driveway_front_camera_detections_vehicle'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: vehicle
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: energy_prices_are_negative
alias: Energy Prices Are Negative
mode: single
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.energy_prices_are_negative
to: 'on'
action:
- service: script.general_notification
data:
message: Energy prices are negative at {{ states.sensor.energy_price.state }}.
Turn on everything!!!
title: Energy Prices Are Negative
devices: jk
priority: time-sensitive
tag: energy_prices_are_negative
- id: entertainment_mode_activated
initial_state: true
alias: Entertainment Mode - Activated
trigger:
- platform: state
entity_id: input_boolean.entertainment_mode
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: switch.turn_off
entity_id:
- switch.adaptive_lighting_foyer
- switch.adaptive_lighting_kitchen
- switch.adaptive_lighting_office
- switch.adaptive_lighting_family_room
- switch.adaptive_lighting_main_bedroom
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- service: automation.turn_on
entity_id: automation.entertainment_mode_deactivated
- id: entertainment_mode_deactivated
initial_state: false
alias: Entertainment Mode - Deactivated
trigger:
- platform: state
entity_id: input_boolean.entertainment_mode
to: 'off'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
action:
- service: switch.turn_on
entity_id:
- switch.adaptive_lighting_foyer
- switch.adaptive_lighting_kitchen
- switch.adaptive_lighting_office
- switch.adaptive_lighting_family_room
- switch.adaptive_lighting_main_bedroom
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- service: automation.turn_off
entity_id: automation.entertainment_mode_deactivated
- id: entertainment_mode_turn_off
initial_state: false
alias: Entertainment Mode - Turn Off
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: time
at: '23:00:00'
- platform: time
at: '23:59:59'
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
below: 6
for:
minutes: 10
condition:
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'on'
- condition: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
below: 6
action:
- service: input_boolean.turn_off
entity_id: input_boolean.entertainment_mode
- service: automation.turn_off
entity_id: automation.entertainment_mode_turn_off
- id: entertainment_mode_turn_on
initial_state: false
alias: Entertainment Mode - Turn On
trigger:
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 30
for:
minutes: 1
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 25
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 20
for:
minutes: 10
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 15
for:
minutes: 10
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.entertainment_mode
- service: automation.turn_on
entity_id: automation.entertainment_mode_turn_off
- service: script.general_notification
data:
title: Entertainment Mode
message: Entertainment mode was trigger by {{state.sensor.indoor_bluetooth_device_count.state}}
devices.
devices: jk
priority: passive
tag: entertainment-mode-activated
- id: family_room_arrival
alias: Family room arrival
initial_state: 'off'
trigger:
- platform: state
entity_id: input_select.john_status
to: Just Arrived
- platform: state
entity_id: input_select.cristina_status_dropdown
to: Just Arrived
condition:
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.family_room
option: Dim
- id: family_room_speech_notifications_off
initial_state: true
alias: Family Room Speech Notifications Off
trigger:
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.family_room_speech_notifications
- id: family_room_lights_to_away
initial_state: 'on'
alias: Family room lights to away
trigger:
- platform: state
entity_id: input_select.family_room
to: Away
- platform: state
entity_id: input_select.house
to: Away
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.family_room
state: Away
- condition: and
conditions:
- condition: state
entity_id: input_select.family_room
state: Auto
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: light.family_room_main_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.family_room_main_lights
- id: family_room_lights_to_off
initial_state: 'on'
alias: Family room lights to off
trigger:
- platform: state
entity_id: input_select.family_room
to: 'Off'
- platform: state
entity_id: input_select.house
to: 'Off'
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.family_room
state: 'Off'
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: input_select.family_room
state: Auto
- condition: state
entity_id: input_select.house
state: 'Off'
- condition: state
entity_id: light.family_room_main_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.family_room_main_lights
- id: family_room_lights_to_on
initial_state: 'off'
alias: Family room lights to On
trigger:
- platform: state
entity_id: input_select.family_room
to: 'On'
- platform: state
entity_id: input_select.house
to: 'On'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.family_room
state: 'On'
- condition: and
conditions:
- condition: state
entity_id: input_select.family_room
state: Auto
- condition: state
entity_id: input_select.house
state: 'On'
- condition: state
entity_id: light.family_room_main_lights
state: 'off'
action:
- service: switch.turn_on
entity_id: light.family_room_main_lights
- id: family_room_mode_away
initial_state: 'off'
alias: Family room mode away
trigger:
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'off'
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'off'
for:
minutes: 10
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.family_room
option: Away
- id: family_room_mode_auto
initial_state: true
alias: Family Room Mode Auto
trigger:
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.family_room'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.family_room
option: Auto
- id: family_room_not_occupied
initial_state: 'on'
alias: Family room not occupied
trigger:
- platform: state
entity_id: binary_sensor.family_room_presence
to: 'off'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.family_room_ble_occupancy
to: 'off'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.family_room_motion_sensor
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.family_room_motion_sensor_occupancy
to: 'off'
- platform: state
entity_id: binary_sensor.family_room_motion_sensor_occupancy
to: 'off'
for:
minutes: 5
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.family_room_motion_sensor_occupancy
state: 'off'
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'off'
- condition: state
entity_id: media_player.sony_bravia_tv
state: 'off'
- condition: state
entity_id: binary_sensor.family_room_ble_occupancy
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.family_room_occupied
- service: script.general_notification
data:
title: Family Room Logger
message: The family room is NO LONGER occupied
devices: jk
priority: passive
tag: family-room-not-occupied
- id: family_room_occupied
initial_state: 'on'
alias: Family room occupied
trigger:
- platform: state
entity_id: binary_sensor.family_room_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.family_room_motion_sensor
to: 'on'
- platform: state
entity_id: device_tracker.family_room_tv
to: home
- platform: state
entity_id: media_player.sony_bravia_tv
to: playing
- platform: state
entity_id: media_player.sonos_family_room
to: playing
condition:
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.family_room_ble_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.family_room_motion_sensor_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.family_room_occupied
- service: script.general_notification
data:
title: Family Room Logger
message: The family room is occupied
devices: jk
priority: passive
tag: family-room-occupied
- id: family_room_mode_off
initial_state: 'on'
alias: Family Room Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.family_room'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.family_room
option: 'Off'
- id: family_room_mode_on
initial_state: 'off'
alias: Family room mode on
trigger:
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'on'
- platform: state
entity_id: light.family_room_main_lights
to: 'on'
condition:
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'on'
- condition: not
conditions:
- condition: state
entity_id: input_select.family_room
state: 'On'
action:
- service: input_select.select_option
data:
entity_id: input_select.family_room
option: 'On'
- id: family_room_lights_sleep_mode_off
initial_state: false
alias: Family Room Lights Sleep Mode Off
trigger:
- platform: sun
event: sunrise
offset: 00:15:00
- platform: time
at: 07:00:00
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: sun
after: sunrise
- condition: time
after: 07:00:00
action:
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_family_room
- service: automation.turn_off
entity_id: automation.family_room_lights_sleep_mode_off
- id: family_room_lights_sleep_mode_on
initial_state: true
alias: Family Room Lights Sleep Mode On
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: time
at: '23:00:00'
- platform: time
at: 03:00:00
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '20:00:00'
action:
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_family_room
- service: automation.turn_on
entity_id: automation.family_room_lights_sleep_mode_off
- id: family_room_speech_notifications_on
initial_state: true
alias: Family Room Speech Notifications On
trigger:
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'on'
- platform: state
entity_id: input_select.family_room
to: Auto
condition:
- condition: state
entity_id: input_boolean.family_room_occupied
state: 'on'
- condition: state
entity_id: input_select.family_room
state: Auto
action:
- service: input_boolean.turn_on
entity_id: input_boolean.family_room_speech_notifications
- id: family_room_turn_music_off
initial_state: 'on'
alias: Family room turn the music off
trigger:
- platform: state
entity_id: input_select.family_room
to: Away
- platform: state
entity_id: input_select.family_room
to: 'Off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.family_room
state: Away
- condition: state
entity_id: input_select.family_room
state: 'Off'
- condition: and
conditions:
- condition: state
entity_id: input_select.family_room
state: Auto
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: media_player.sonos_family_room
state: playing
action:
- service: media_player.turn_off
entity_id: media_player.sonos_family_room
- id: family_room_turn_tv_off
initial_state: 'on'
alias: Family Room Turn the TV Off
trigger:
- platform: state
entity_id: input_select.family_room
to: 'Off'
- platform: state
entity_id: input_boolean.family_room_occupied
to: 'off'
condition:
- condition: state
entity_id: input_select.family_room
state: 'Off'
- condition: state
entity_id: media_player.sony_bravia_tv
state: 'on'
action:
- service: media_player.turn_off
entity_id: media_player.sony_bravia_tv
- id: family_room_turn_tv_off
initial_state: 'off'
alias: Family room turn the TV off
trigger:
- platform: state
entity_id: input_select.family_room
to: Away
- platform: state
entity_id: input_select.family_room
to: 'Off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.family_room
state: Away
- condition: state
entity_id: input_select.family_room
state: 'Off'
- condition: and
conditions:
- condition: state
entity_id: input_select.family_room
state: Auto
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: media_player.sonos_family_room
state: playing
action:
- service: media_player.turn_off
entity_id: media_player.sony_bravia_tv
- id: fire_alarm_trigger
alias: Fire Alarm - Triggered
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.smoke_detector
from: 'off'
to: 'on'
actions:
- action: script.fire_alarm_alert
data: {}
- id: foyer_lights_days_off
initial_state: true
alias: Foyer Lights Day Off
trigger:
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.tempest_illuminance
above: 250
for:
minutes: 3
- platform: numeric_state
entity_id: sensor.tempest_illuminance
above: 500
for:
minutes: 3
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.foyer
state: Auto
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: time
before: '18:00:00'
- condition: or
conditions:
- condition: state
entity_id: light.foyer_chandelier
state: 'on'
action:
- service: light.turn_off
entity_id: light.foyer_chandelier
- id: foyer_lights_days_on
initial_state: true
alias: Foyer Lights Day On
trigger:
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
for:
minutes: 1
- platform: numeric_state
entity_id: sensor.tempest_illuminance
below: 40
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.foyer_motion_illuminance
below: 5
for:
minutes: 5
- platform: sun
event: sunrise
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.foyer
state: Auto
- condition: numeric_state
entity_id: sensor.foyer_motion_illuminance
below: 5
- condition: or
conditions:
- condition: state
entity_id: light.foyer_chandelier
state: 'off'
action:
- service: light.turn_on
entity_id: light.foyer_chandelier
- id: foyer_lights_nightlight
initial_state: true
alias: Foyer Lights Nightlight
triggers:
- trigger: sun
event: sunset
offset: -00:30:00
- trigger: state
entity_id: input_boolean.dark_outside
to: 'on'
- trigger: numeric_state
entity_id: sensor.tempest_illuminance
below: 250
- trigger: time
at: '18:00:00'
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: numeric_state
entity_id: sensor.tempest_illuminance
below: 250
- condition: or
conditions:
- condition: sun
before: sunset
before_offset: -00:30:00
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '18:00:00'
- condition: state
entity_id: light.foyer_chandelier
state: 'off'
actions:
- action: light.turn_on
entity_id: light.foyer_chandelier
- action: automation.turn_on
entity_id: automation.foyer_lights_nightlight_off
- id: foyer_lights_nightlight_off
initial_state: true
alias: Foyer Lights Nightlight Off
trigger:
- platform: sun
event: sunrise
- platform: state
entity_id: input_boolean.dark_outside
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: sun
after: sunrise
- condition: state
entity_id: input_boolean.dark_outside
state: 'off'
- condition: state
entity_id: light.foyer_chandelier
state: 'on'
action:
- service: light.turn_off
entity_id: light.foyer_chandelier
- service: automation.turn_off
entity_id: automation.foyer_lights_nightlight_off
- id: foyer_lights_sleep_mode_off
initial_state: false
alias: Foyer Lights Sleep Mode Off
trigger:
- platform: sun
event: sunrise
- platform: time
at: 08:00:00
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunrise
action:
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_foyer
- id: foyer_lights_sleep_mode_on
initial_state: false
alias: Foyer Lights Sleep Mode On
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: time
at: '23:00:00'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '20:00:00'
action:
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_foyer
- id: foyer_lights_to_dim
initial_state: true
alias: Foyer lights to dim
trigger:
- platform: state
entity_id: input_select.foyer
to: Dim
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.foyer
state: Dim
- condition: or
conditions:
- condition: state
entity_id: light.foyer_chandelier
state: 'off'
action:
- service: light.turn_on
entity_id: light.foyer_chandelier
- service: switch.turn_on
entity_id:
- switch.adaptive_lighting_foyer
- switch.adaptive_lighting_sleep_mode_foyer
- id: foyer_lights_to_off
initial_state: true
alias: Foyer lights to off
trigger:
- platform: state
entity_id: input_select.foyer
to: 'Off'
- platform: state
entity_id: input_select.foyer
to: Away
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.foyer
state: 'Off'
- condition: state
entity_id: input_select.foyer
state: Away
- condition: and
conditions:
- condition: state
entity_id: input_select.foyer
state: Auto
- condition: state
entity_id: input_select.house
state: 'Off'
- condition: state
entity_id: light.foyer_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.foyer_lights
data:
transition: 1
- id: foyer_mode_auto
initial_state: true
alias: Foyer mode auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.foyer'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.foyer
option: Auto
- id: foyer_mode_away
initial_state: true
alias: Foyer mode away
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.foyer'',''Away'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.foyer
option: Away
- id: foyer_mode_dim
initial_state: false
alias: Foyer mode dim
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: sun
event: sunset
- platform: time
at: '21:00:00'
- platform: state
entity_id: input_boolean.dark_outside
to: 'on'
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
- platform: state
entity_id: input_select.house
from: Bedtime
to: Auto
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ states(''input_select.house'') in (''Auto'', ''Bedtime'',
''Quiet'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: sun
after: sunset
- condition: template
value_template: '{{ not is_state(''input_select.foyer'',''Dim'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.foyer
option: Dim
- service: switch.turn_on
entity_id:
- switch.adaptive_lighting_foyer
- switch.adaptive_lighting_sleep_mode_foyer
- id: foyer_mode_off
initial_state: true
alias: Foyer mode off
trigger:
- platform: state
entity_id: input_select.house
to: bedtime
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.foyer'',''Off'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.foyer
option: 'Off'
- id: front_door_auto_lock
alias: Front Door - Auto Lock
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: state
entity_id: lock.front_door
state: unlocked
action:
- service: lock.lock
entity_id: lock.front_door
- id: front_door_camera_detections_animal
alias: Front Door Camera Detections - Animal
mode: single
trigger:
- platform: state
entity_id: binary_sensor.front_door_camera_animal_detected
to: 'on'
variables:
camera_name: Front Doorbell Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_front_door_camera_high_resolution_channel
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.front_door_camera_detections_animal'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: animal
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: front_door_camera_detections_person
alias: Front Door Camera Detections - Person
mode: single
trigger:
- platform: state
entity_id: binary_sensor.front_door_camera_person_detected
to: 'on'
variables:
camera_name: Front Doorbell Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_front_door_camera_high_resolution_channel
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.front_door_camera_detections_person'',''last_triggered''),
0) ) | int > 60 }}'
action:
- action: script.camera_detection_alert
data:
detection_type: person
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: front_door_camera_detections_vehicle
alias: Front Door Camera Detections - Vehicle
mode: single
trigger:
- platform: state
entity_id: binary_sensor.front_door_camera_vehicle_detected
to: 'on'
variables:
camera_name: Front Doorbell Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_front_door_camera_high_resolution_channel
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.front_door_camera_detections_vehicle'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: vehicle
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: front_door_lock_if_open_too_long
alias: Front Door - Lock If Open Too Long
initial_state: true
trigger:
- platform: state
entity_id: lock.front_door
to: unlocked
for:
minutes: 15
- platform: state
entity_id: input_boolean.entertainment_mode
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: lock.front_door
state: unlocked
- condition: or
conditions:
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'off'
- condition: time
after: '22:00:00'
action:
- service: lock.lock
entity_id: lock.front_door
- id: garage_doors_close_when_empty_house
alias: Garage doors close when empty house
initial_state: true
trigger:
- platform: state
entity_id: input_select.garage
to: Away
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: cover.garage_doors
state: open
- condition: state
entity_id: input_select.garage
state: Away
action:
- service: cover.close_cover
entity_id: cover.garage_doors
- service: script.general_notification
data:
title: Garage Doors Open!
message: The house is empty or off so I'm closing the garage doors
devices: jk
priority: time-sensitive
tag: garage-doors-closed-empty
- id: garage_doors_close_when_home
alias: Garage doors close when home
initial_state: true
triggers:
- trigger: state
entity_id: cover.garage_doors
to: open
for:
minutes: 30
- trigger: state
entity_id: input_select.garage
to: 'Off'
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
- trigger: state
entity_id: input_boolean.garage_occupied
to: 'off'
for:
minutes: 20
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
for:
minutes: 20
- condition: state
entity_id: input_boolean.garage_override
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: cover.garage_door_1
state: open
for:
minutes: 30
- condition: state
entity_id: cover.garage_door_2
state: open
for:
minutes: 30
- condition: state
entity_id: cover.garage_door_3
state: open
for:
minutes: 30
- condition: state
entity_id: binary_sensor.garage_ble_occupancy
state: 'off'
actions:
- action: script.voice_announcement
data:
media_players: auto
sound: police-whistle
priority: high
speech_message: '{{ expand(''cover.garage_doors'')|selectattr(''state'', ''eq'',
''open'')|map(attribute=''name'')|list|join('', '') }} has been open for a
while but nobody is around so I''m automaticallly closing.'
- action: script.general_notification
data:
title: Garage Doors Open!
message: '{{ expand(''cover.garage_doors'')|selectattr(''state'', ''eq'', ''open'')|map(attribute=''name'')|list|join('',
'') }} has been open for a while but nobody is around so I''m automaticallly
closing.'
devices: all
priority: time-sensitive
tag: garage-doors-open-home
- action: cover.close_cover
data: {}
target:
entity_id: cover.garage_doors
- action: light.turn_off
entity_id: light.garage_lights
- id: garage_doors_lock_remotes
alias: Garage Doors - Lock Remotes
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
for:
minutes: 5
- trigger: homeassistant
event: start
- trigger: event
event_type: automation_reloaded
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
actions:
- action: lock.lock
entity_id:
- lock.garage_door_1_lock_remotes
- lock.garage_door_2_lock_remotes
- lock.garage_door_3_lock_remotes
- id: garage_doors_unlock_remotes
alias: Garage Doors - Unlock Remotes
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'off'
for:
minutes: 5
- trigger: state
entity_id:
- person.john_koht
- person.cristina_falbo
- person.mary_falbo
- person.antoun_koht
- person.sonia_koht
- person.katia
- person.joe_falbo
to: home
- trigger: homeassistant
event: start
- trigger: event
event_type: automation_reloaded
conditions:
- condition: state
entity_id:
- lock.garage_door_1_lock_remotes
- lock.garage_door_2_lock_remotes
- lock.garage_door_3_lock_remotes
match: any
state: locked
actions:
- action: lock.unlock
entity_id:
- lock.garage_door_1_lock_remotes
- lock.garage_door_2_lock_remotes
- lock.garage_door_3_lock_remotes
- id: garage_door_2_open_upon_arrival
alias: Garage Door 2 - Open Upon Arrival
initial_state: false
trigger:
- platform: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
to: Just Arrived
- platform: state
entity_id: input_boolean.audi_home
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Just Arrived
- condition: state
entity_id: input_select.john_status
state: Just Arrived
- condition: and
conditions:
- condition: state
entity_id: input_boolean.audi_home
state: 'on'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.audi_home.last_updated))
| int < 120 }}'
- condition: state
entity_id: cover.garage_door_2
state: closed
action:
- service: notify.mobile_app_jk_2
data:
title: Garage Door 2
message: Garage door three is opening upon somebody's arrival
- id: garage_door_3_open_upon_arrival
alias: Garage Door 3 - Open Upon Arrival
initial_state: false
triggers:
- trigger: state
entity_id:
- input_select.john_status
to: Just Arrived
- trigger: state
entity_id: input_boolean.bmw_home
to: 'on'
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Just Arrived
- condition: state
entity_id: input_select.john_status
state: Just Arrived
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bmw_home
state: 'on'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.bmw_home.last_updated))
| int < 120 }}'
- condition: state
entity_id: cover.garage_door_3
state: closed
actions:
- action: cover.open_cover
entity_id: cover.garage_door_3
- action: script.general_notification
data:
title: Garage Door 3
message: Garage door three is opening upon somebody's arrival
devices: jk
priority: active
tag: garage-door-3-automation
- id: garage_driveway_camera_detections_animal
alias: Garage Driveway Camera Detections - Animal
mode: single
trigger:
- platform: state
entity_id: binary_sensor.garage_driveway_camera_animal_detected
to: 'on'
variables:
camera_name: Garage Driveway Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_garage_driveway_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.garage_driveway_camera_detections_animal'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: animal
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: garage_driveway_camera_detections_person
alias: Garage Driveway Camera Detections - Person
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.garage_driveway_person_detected
to: 'on'
variables:
camera_name: Garage Driveway Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_garage_driveway_camera_high
conditions:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.garage_driveway_camera_detections_person'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: state
entity_id: cover.garage_doors
state: closed
- condition: state
entity_id: binary_sensor.garage_ble_occupancy
state: 'off'
for:
minutes: 2
actions:
- action: script.camera_detection_alert
data:
detection_type: person
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: garage_driveway_camera_detections_vehicle
alias: Garage Driveway Camera Detections - Vehicle
mode: single
trigger:
- platform: state
entity_id: binary_sensor.garage_driveway_vehicle_detected
to: 'on'
variables:
camera_name: Garage Driveway Camera
nvr_id: '{{ config_entry_id(trigger.entity_id) }}'
event_id: '{{ trigger.to_state.attributes.event_id }}'
image_path: /api/unifiprotect/thumbnail/{{ nvr_id }}/{{ event_id }}
proxy_camera: camera.camera_proxy_camera_garage_driveway_camera_high
condition:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''automation.garage_driveway_camera_detections_vehicle'',''last_triggered''),
0) ) | int > 60 }}'
- condition: state
entity_id: input_boolean.camera_notifications
state: 'on'
action:
- action: script.camera_detection_alert
data:
detection_type: vehicle
camera_name: '{{ camera_name }}'
image_path: '{{ image_path }}'
proxy_camera: '{{ proxy_camera }}'
- id: garage_entry_door_lock_at_bedtime
alias: Garage Entry Door - Lock
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: state
entity_id: lock.garage_entry_door
state: unlocked
action:
- service: lock.lock
entity_id: lock.garage_entry_door
- id: garage_entry_door_unlock_upon_arrival
alias: Garage Entry Door - Unlock Upon Arrival
initial_state: true
trigger:
- platform: state
entity_id:
- person.john_koht
- person.cristina_falbo
- person.mary_falbo
- person.antoun_koht
- person.sonia_koht
- person.katia
- person.joe_falbo
to: home
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: lock.garage_entry_door
state: locked
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: lock.unlock
entity_id: lock.garage_entry_door
- id: garage_lights_motion_off
initial_state: true
alias: Garage lights motion off
trigger:
- platform: state
entity_id: binary_sensor.garage_motion_sensor_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
to: 'off'
- platform: state
entity_id: input_boolean.garage_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
state: 'off'
- condition: state
entity_id: light.garage_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.garage_lights
- id: garage_lights_motion_on
initial_state: true
alias: Garage lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.garage_motion_sensor_motion
to: 'on'
- platform: state
entity_id: binary_sensor.interior_garage_door
to: 'on'
- platform: state
entity_id: cover.garage_doors
to: open
condition:
- condition: state
entity_id: input_select.garage
state: Auto
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.garage_lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.garage_motion_sensor_illuminance
below: 100
- condition: state
entity_id: light.garage_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.garage_lights
- service: input_boolean.turn_on
entity_id: input_boolean.garage_lights_auto
- id: garage_lights_off
initial_state: true
alias: Garage lights off
trigger:
- platform: state
entity_id: input_select.garage
to: 'Off'
- platform: state
entity_id: input_select.garage
to: Away
- platform: state
entity_id: input_boolean.garage_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.garage
state: 'Off'
- condition: state
entity_id: input_select.garage
state: Away
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
action:
- service: light.turn_off
entity_id: light.garage_lights
- id: garage_lights_to_off
initial_state: 'off'
alias: Garage lights to off
trigger:
- platform: state
entity_id: input_select.house
to: 'Off'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: light.garage_lights
to: 'on'
for:
minutes: 30
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: light.garage_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.garage_lights
- id: garage_lights_turned_off
initial_state: true
alias: Garage lights Manually Turned Off
trigger:
- platform: state
entity_id: light.garage_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.garage_lights_auto
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.garage_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.garage_lighting_automations
- id: garage_mode_auto
initial_state: true
alias: Garage mode auto
trigger:
- platform: state
entity_id: input_boolean.garage_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.garage'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.garage
option: Auto
- id: garage_mode_away
initial_state: true
alias: Garage mode away
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
condition:
- condition: template
value_template: '{{ not is_state(''input_select.garage'',''Away'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
action:
- service: input_select.select_option
data:
entity_id: input_select.garage
option: Away
- id: garage_mode_off
initial_state: true
alias: Garage mode off
trigger:
- platform: state
entity_id: input_select.house
to: Bedtime
condition:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Bedtime
action:
- service: input_select.select_option
data:
entity_id: input_select.garage
option: 'Off'
- service: automation.turn_on
entity_id: automation.garage_doors_close_when_home
- id: garage_not_occupied
initial_state: true
alias: Garage not occupied
triggers:
- trigger: state
entity_id: binary_sensor.garage_ble_occupancy
to: 'off'
for:
minutes: 5
- trigger: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
to: 'off'
- trigger: state
entity_id: cover.garage_doors
to: closed
- trigger: state
entity_id: cover.garage_doors
to: open
for:
minutes: 15
conditions:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
state: 'off'
- condition: state
entity_id: binary_sensor.garage_ble_occupancy
state: 'off'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.garage_occupied
- delay: 00:00:30
- action: input_boolean.turn_on
entity_id: input_boolean.garage_lighting_automations
- id: garage_occupied
initial_state: true
alias: Garage occupied
triggers:
- trigger: state
entity_id: binary_sensor.garage_motion_sensor_motion
to: 'on'
- trigger: state
entity_id: light.garage_lights
to: 'on'
- trigger: state
entity_id: cover.garage_doors
to: open
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.garage_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.garage_ble_occupancy
state: 'off'
for:
minutes: 2
- condition: state
entity_id: binary_sensor.garage_motion_sensor_occupancy
state: 'on'
- condition: state
entity_id: light.garage_lights
state: 'on'
- condition: state
entity_id: cover.garage_doors
state: open
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.garage_occupied
- id: garbage_day_is_today_reminder
alias: Garbage Day Is Today Reminder
mode: single
initial_state: false
trigger:
- platform: time
at: 06:30:00
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'on'
for:
minutes: 15
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.garbage_day
state: 'on'
- condition: time
after: 06:00:00
before: 09:00:00
action:
- wait_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.kitchen_motion_sensor_occupancy.last_changed))
| int >= 900 }}'
timeout: 00:15:00
continue_on_timeout: false
- wait_template: '{{ is_state(''binary_sensor.kitchen_motion_sensor_status'', ''on'')
}}'
timeout: 00:15:00
continue_on_timeout: false
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: message-alert
speech_message: "{{\n [\n \"Hey there, today is garbage day, make sure the\
\ trash it out.\",\n \"Garbage day! Don't forget to take the trash out.\"\
\n ] | random\n}}"
- id: garbage_day_is_tomorrow_reminder
alias: Garbage Day Is Tomorrow Reminder
mode: single
trigger:
- platform: time
at: '17:30:00'
- platform: time
at: '20:00:00'
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
for:
minutes: 15
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.tomorrow_is_garbage_day
state: 'on'
- condition: time
after: '17:00:00'
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: message-alert
priority: high
speech_message: "{{\n [\n \"Tomorrow is garbage day. Don't forget to take\
\ out the trash.\",\n \"Hey fam, don't forget that tomorrow is garbage\
\ day.\"\n ] | random\n}}"
- service: script.general_notification
data:
message: Tomorrow is garbage day reminder!
title: Garbage Day
devices: jk
priority: time-sensitive
tag: garbage-day
- id: garbage_day_off
alias: Garbage Day Off
mode: single
trigger:
- platform: calendar
event: end
entity_id: calendar.garbage_day
condition:
- condition: state
entity_id: input_boolean.garbage_day
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.garbage_day
- service: automation.turn_off
entity_id: automation.garbage_day_is_today_reminder
- id: garbage_day_on
alias: Garbage Day On
mode: single
trigger:
- platform: calendar
event: start
entity_id: calendar.garbage_day
condition:
- condition: state
entity_id: input_boolean.garbage_day
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.garbage_day
- service: automation.turn_on
entity_id: automation.garbage_day_is_today_reminder
- id: notifications_activate_important_only
alias: Notifications - Activate Important Only
mode: single
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
- trigger: state
entity_id: input_boolean.entertainment_mode
to: 'on'
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: state
entity_id: input_select.notification_level
state: All
action:
- action: input_select.select_option
data:
entity_id: input_select.notification_level
option: Important
- id: gianlucas_bedroom_mode_auto
initial_state: true
alias: Gianluca's Bedroom - Mode Auto
triggers:
- trigger: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
- trigger: state
entity_id: input_select.house
to: Auto
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
- trigger: state
entity_id: input_boolean.gianluca_in_bed
to: 'off'
for:
minutes: 10
- trigger: state
entity_id: input_boolean.bedtime
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.gianlucas_bedroom'',''Auto'')
}}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state:
- Auto
- Quiet
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
- condition: state
entity_id: input_boolean.gianluca_in_bed
state: 'off'
actions:
- action: input_select.select_option
data:
entity_id: input_select.gianlucas_bedroom
option: Auto
- id: gianlucas_bedroom_mode_bedtime
initial_state: true
alias: Gianluca's Bedroom - Mode Bedtime
triggers:
- trigger: state
entity_id: input_boolean.gianluca_in_bed
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.gianlucas_bedroom'',''Bedtime'')
}}'
action:
- action: input_select.select_option
data:
entity_id: input_select.gianlucas_bedroom
option: Bedtime
- id: gianlucas_bedroom_mode_off
initial_state: true
alias: Gianluca's Bedroom - Mode Off
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.house
to: Away
- trigger: homeassistant
event: start
- trigger: event
event_type: automation_reloaded
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.gianlucas_bedroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
actions:
- action: input_select.select_option
data:
entity_id: input_select.gianlucas_bedroom
option: 'Off'
- id: gianlucas_room_not_occupied
initial_state: true
alias: Gianluca's room not occupied
triggers:
- trigger: state
entity_id: binary_sensor.gianlucas_door_sensor_status
to: 'on'
for:
minutes: 5
- trigger: state
entity_id: light.gianluca_bedroom_lights
to: 'off'
for:
minutes: 3
- trigger: state
entity_id: binary_sensor.gianluca_bed_occupied
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.gianlucas_door_sensor_status
state: 'on'
- condition: state
entity_id: light.gianluca_bedroom_lights
state: 'off'
- condition: state
entity_id: binary_sensor.gianluca_bed_occupied
state: 'off'
action:
- action: input_boolean.turn_off
entity_id: input_boolean.gianlucas_room_occupied
- id: gianlucas_room_occupied
initial_state: true
alias: Gianluca's room occupied
triggers:
- trigger: state
entity_id: binary_sensor.gianlucas_door_sensor_status
to: 'off'
- trigger: state
entity_id: light.gianluca_bedroom_lights
to: 'on'
- trigger: state
entity_id: binary_sensor.gianluca_bed_occupied
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.gianlucas_door_sensor_status
state: 'off'
- condition: state
entity_id: light.gianluca_bedroom_lights
state: 'on'
- condition: state
entity_id: binary_sensor.gianluca_bed_occupied
state: 'on'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.gianlucas_room_occupied
- id: gianluca_bedroom_turn_off_purifier
alias: Gianluca's Bedroom Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'off'
for:
minutes: 30
actions:
- action: fan.turn_off
target:
entity_id: fan.gianlucas_bedroom_air_purifier
- id: gianluca_bed_awake
alias: Gianluca Bed - Awake
mode: single
triggers:
- trigger: state
entity_id: input_select.gianluca_sleep_state
to: Just Got Up
for:
minutes: 5
action:
- action: input_select.select_option
data:
entity_id: input_select.gianluca_sleep_state
option: Awake
- action: input_boolean.turn_off
entity_id: input_boolean.gianluca_in_bed
- id: gianluca_bed_just_got_up
alias: Gianluca Bed - Just Got Up
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.gianluca_bed_occupied
to: 'off'
action:
- action: input_select.select_option
data:
entity_id: input_select.gianluca_sleep_state
option: Just Got Up
- id: gianluca_bed_just_laid_down
alias: Gianluca Bed - Just Laid Down
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.gianluca_bed_occupied
to: 'on'
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.gianluca_sleep_state'',''Sleep'')
}}'
action:
- action: input_select.select_option
data:
entity_id: input_select.gianluca_sleep_state
option: Just Laid Down
- id: gianluca_bed_sleep
alias: Gianluca Bed - Sleep
mode: single
triggers:
- trigger: state
entity_id: input_select.gianluca_sleep_state
to: Just Laid Down
for:
minutes: 5
action:
- action: input_select.select_option
data:
entity_id: input_select.gianluca_sleep_state
option: Sleep
- action: input_boolean.turn_on
entity_id: input_boolean.gianluca_in_bed
- id: gianluca_birthday_countdown_reminder
alias: Gianluca Birthday Countdown Reminder
mode: single
initial_state: false
trigger:
- platform: time
at: 07:05:00
- platform: time
at: 07:35:00
- platform: time
at: 08:05:00
- platform: time
at: 08:35:00
- platform: time
at: '18:05:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.gianluca_countdown_announced
state: 'off'
- condition: time
after: 07:00:00
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.gianluca_countdown_announced
- choose:
- conditions:
- condition: template
value_template: '{{ states.sensor.gianluca_days_to_birthday.state | int ==
0 }}'
sequence:
- service: script.voice_announcement
data:
speech_message: Hey, Gianluca! Guess what? Today's your birthday! Happy
Birthday!!!
media_players: auto
sound: success-trumpets
priority: high
- conditions:
- condition: template
value_template: '{{ states.sensor.gianluca_days_to_birthday.state | int ==
1 }}'
sequence:
- service: script.voice_announcement
data:
speech_message: Gianluca! Guess what tomorrow is? You're birthday!!! Are
you super excited to celebrate?
media_players: auto
sound: games-sfx
priority: high
default:
- service: script.voice_announcement
data:
speech_message: "{{\n [\n \"Hey Gianluca! Guess what? There's \" ~ states.sensor.gianluca_days_to_birthday.state\
\ ~ \" days until your birthday!\",\n \"Gianluca! I'm so excited! You're\
\ birthday is in \" ~ states.sensor.gianluca_days_to_birthday.state ~ \"\
\ days! How exciting is that?\"\n ] | random\n}}"
media_players: auto
sound: games-sfx
priority: high
- id: gianluca_birthday_daily_reset
alias: Gianluca Birthday Daily Reset
mode: single
initial_state: false
trigger:
- platform: time
at: 00:00:05
condition:
- condition: state
entity_id: input_boolean.gianluca_countdown_to_birthday
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.gianluca_countdown_announced
- id: gianluca_countdown_to_birthday_turn_off
alias: Gianluca Countdown to Birthday - Turn Off
mode: single
initial_state: false
trigger:
- platform: time
at: 00:00:01
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: numeric_state
entity_id: sensor.gianluca_days_to_birthday
above: 15
below: 0
action:
- service: input_boolean.turn_off
entity_id: input_boolean.gianluca_countdown_to_birthday
- service: automation.turn_off
entity_id:
- automation.gianluca_countdown_to_birthday_turn_off
- automation.gianluca_birthday_countdown_reminder
- automation.gianluca_birthday_daily_reset
- service: automation.turn_on
entity_id: automation.gianluca_countdown_to_birthday_turn_on
- id: gianluca_countdown_to_birthday_turn_on
alias: Gianluca Countdown to Birthday - Turn On
mode: single
initial_state: true
trigger:
- platform: time
at: 00:00:01
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: numeric_state
entity_id: sensor.gianluca_days_to_birthday
below: 16
action:
- service: input_boolean.turn_on
entity_id: input_boolean.gianluca_countdown_to_birthday
- service: automation.turn_on
entity_id:
- automation.gianluca_countdown_to_birthday_turn_off
- automation.gianluca_birthday_countdown_reminder
- automation.gianluca_birthday_daily_reset
- service: automation.turn_off
entity_id: automation.gianluca_countdown_to_birthday_turn_on
- id: gianluca_heater_off
alias: Gianluca heater off
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.gianlucas_door_sensor_status
to: 'on'
for:
minutes: 1
- platform: template
value_template: '{{ (states.sensor.gianluca_bedroom_awair_temperature.state |
float) > 71.5 }}'
- platform: template
value_template: '{{ (states.sensor.gianlucas_door_sensor_temperature.state | float)
> 72.7 }}'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'off'
condition:
- condition: or
conditions:
- condition: template
value_template: '{{ (states.sensor.gianluca_bedroom_awair_temperature.state
| float) >= 71.0 }}'
- condition: template
value_template: '{{ (states.sensor.gianlucas_door_sensor_temperature.state |
float) >= 72.1 }}'
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
- condition: state
entity_id: light.hue_smart_plug_1
state: 'on'
action:
- service: light.turn_off
entity_id: light.hue_smart_plug_1
- id: gianluca_heater_on
alias: Gianluca heater on
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
- platform: state
entity_id: group.gianlucas_room_lights
to: 'off'
- platform: numeric_state
entity_id: sensor.gianluca_bedroom_awair_temperature
below: 69
- platform: template
value_template: '{{ (states.sensor.gianlucas_door_sensor_temperature.state | float)
< 69.5 }}'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: or
conditions:
- condition: template
value_template: '{{ (states.sensor.gianluca_bedroom_awair_temperature.state
| float) <= 70 }}'
- condition: template
value_template: '{{ (states.sensor.gianlucas_door_sensor_temperature.state |
float) <= 71.0 }}'
action:
- service: light.turn_on
entity_id: light.hue_smart_plug_1
- id: gianluca_heater_turn_on_upon_arrival
alias: Gianluca Heater - Turn On Upon Arrival
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id: group.family
from: not_home
to: home
- platform: state
entity_id:
- person.cristina_falbo
- person.john_koht
to: Just Arrived
condition:
- condition: or
conditions:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.house_occupied.last_updated))
| int < 300 }}'
- condition: and
conditions:
- condition: state
entity_id: group.family
state: home
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.group.familiy.last_updated))
| int < 300 }}'
- condition: state
entity_id:
- person.cristina_falbo
- person.john_koht
state: Just Arrived
- condition: template
value_template: '{{ (states.sensor.gianluca_bedroom_awair_temperature.state |
float) < 69.5 }}'
- condition: time
after: '18:30:00'
action:
- service: light.turn_on
entity_id: light.hue_smart_plug_1
- id: gianluca_bedroom_lights_off
initial_state: true
alias: Gianluca Bedroom - Lights Off
trigger:
- platform: state
entity_id: input_select.gianlucas_bedroom
to: 'Off'
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.gianlucas_bedroom
state: 'Off'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
action:
- service: light.turn_off
entity_id: light.gianluca_bedroom_lights
- id: gianluca_nap_time
alias: Gianluca nap time
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
for:
minutes: 3
- platform: state
entity_id: group.gianlucas_room_lights
to: 'off'
- platform: state
entity_id: binary_sensor.gianlucas_door_sensor_status
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.gianlucas_door_sensor_status
state: 'off'
- condition: state
entity_id: input_boolean.quiet_mode
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.quiet_mode
- service: script.voice_announcement
data:
media_players: auto
sound: harp-flourish
priority: low
speech_message: "{{\n [\n \"Shhh...Gianluca is going to sleep.\",\n \"\
Quiet time, Gianluca is going to nap!\",\n \"Pardon the interruption but\
\ Gianluca is going to sleep, please be quiet.\",\n \"Attention! Quiet\
\ mode has been enabled for Gianluca's nap.\"\n ] | random\n}}"
- id: gianluca_nap_time_ended
alias: Gianluca nap time ended
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'off'
- platform: state
entity_id: group.gianlucas_room_lights
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.gianlucas_door_sensor_status
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
- condition: state
entity_id: input_boolean.quiet_mode
state: 'on'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.quiet_mode
- id: gianluca_bedroom_air_quality_detections
alias: Gianluca's Bedroom Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.gianluca_bedroom_air_quality
- trigger: state
entity_id: input_select.gianlucas_bedroom
to: Bedtime
- trigger: state
entity_id: input_boolean.gianlucas_room_occupied
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.gianlucas_bedroom_air_purifier
aqi_state: '{{ states.sensor.gianluca_bedroom_air_quality.state }}'
room_state: '{{ states.input_select.gianlucas_bedroom.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: gianluca_room_temperature_alert
alias: Gianluca Room Temperature Alert
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
for:
minutes: 5
- platform: numeric_state
entity_id:
- sensor.gianluca_bedroom_awair_temperature
- sensor.gianlucas_door_sensor_temperature
above: 78
for:
minutes: 1
- platform: numeric_state
entity_id:
- sensor.gianluca_bedroom_awair_temperature
- sensor.gianlucas_door_sensor_temperature
below: 67
for:
minutes: 1
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: or
conditions:
- condition: numeric_state
entity_id:
- sensor.gianluca_bedroom_awair_temperature
- sensor.gianlucas_door_sensor_temperature
below: 67
- condition: numeric_state
entity_id:
- sensor.gianluca_bedroom_awair_temperature
- sensor.gianlucas_door_sensor_temperature
above: 78
action:
- service: script.voice_announcement
data:
media_players: auto
speech_message: "{% set temp = states.sensor.gianluca_bedroom_awair_temperature.state\
\ %} {% set door_temp = states.sensor.gianlucas_door_sensor_temperature.state\
\ %} {% set low = temp if temp < door_temp else door_temp %} {% set high =\
\ temp if temp > door_temp else door_temp %}\n{% if (low | float) <= 67 %}\n\
\ \"Attention, Gianluca's room is too cold at {{low}} degrees!\"\n{% else\
\ %}\n \"Attention, Gianluca's room is too hot at {{high}} degrees!\"\n{%\
\ endif %}"
- id: gianluca_school_day_off
alias: Gianluca School Day Off
mode: single
trigger:
- platform: time
at: '23:59:00'
condition:
- condition: state
entity_id: input_boolean.gianluca_school_day
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.gianluca_school_day
- service: automation.turn_off
entity_id:
- automation.gianluca_school_day_reminder
- automation.gianluca_school_departure_reminder
- automation.gianluca_school_pickup_reminder
- id: gianluca_school_day_on
alias: Gianluca School Day On
mode: single
trigger:
- platform: time
at: 00:00:01
- platform: state
entity_id: binary_sensor.gianluca_is_today_school_day
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: binary_sensor.gianluca_is_today_school_day
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.gianluca_school_day
- service: automation.turn_on
entity_id:
- automation.gianluca_school_day_reminder
- automation.gianluca_school_departure_reminder
- automation.gianluca_school_pickup_reminder
- id: gianluca_school_pickup_reminder
alias: Gianluca School Pickup Reminder
mode: single
initial_state: true
trigger:
- platform: calendar
event: end
entity_id: calendar.gianluca_school
offset: -00:20:00
condition:
- condition: state
entity_id: input_boolean.gianluca_school_day
state: 'on'
- condition: template
value_template: '{{ ''reminder'' not in (trigger.calendar_event.summary | lower)
}}'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
priority: high
speech_message: "{% set event = trigger.calendar_event.summary | lower %}\n\
{% if \"school day\" in event %}\n {% set label = \"school\" %}\n{% else\
\ %}\n {% set label = event %}\n{% endif %}\n{{\n [\n label ~ \" is done!\
\ Time to pick up Gianluca!\",\n \"Hey there! It's time to pickup Gianluca\
\ from \" ~ label,\n \"Dont forget to pick up Gianluca from \" ~ label,\n\
\ \"Quick reminder that \" ~ label ~ \" is almost over, time to pick Gianluca\
\ up.\"\n ] | random\n}}"
- service: notify.ios_family
data:
message: School will be over soon, it's time to pick up Gianluca from school.
title: Gianluca's school is ending soon
- id: gianluca_school_reminder_notification
alias: Gianluca School Reminder Notification
mode: single
initial_state: true
trigger:
- platform: calendar
event: start
entity_id: calendar.gianluca_school
condition:
- condition: state
entity_id: input_boolean.gianluca_school_day
state: 'on'
- condition: template
value_template: '{{ ''reminder'' in trigger.calendar_event.summary }}'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
speech_message: '{{states.calendar.gianluca_school.attributes.message}}'
- id: grocery_store_announcement
alias: Grocery Store Announcement
mode: single
trigger:
- platform: state
entity_id:
- person.john_koht
- person.cristina_falbo
to:
- Marianos
- Heinen's Grocery Store
- Costco
- Costco Glenview
- Costco Niles
for:
minutes: 5
action:
- service: script.voice_announcement
data:
media_players: auto
sound: musical-flute
speech_message: "{% set person = \"\" %} {% set ent = trigger.entity_id %}\n\
{% if ent == \"person.john_koht\" %}\n {% set person = \"Baba\" %}\n{% else\
\ %}\n {% set person = \"Mama\" %}\n{% endif %}\n{% set store = trigger.to_state.state\
\ %}\n\"Just a friendly reminder that {{person}} is at {{store}} in case you\
\ need anything!\"\n"
- id: guest_announce_arrival
alias: Guest Announce Arrival
mode: queued
initial_state: 'off'
trigger:
- platform: state
entity_id: group.guests
to: home
condition:
- condition: state
entity_id: group.guests
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- delay: 00:02:00
- service: notify.mobile_app_jk_2
data:
title: Guest Arrived!
message: "{% for entity in trigger.to_state.attributes.entity_id %}\n {% if\
\ states(entity) == 'home' %}\n {{ state_attr(entity, 'friendly_name')\
\ }} has arrived\n {% endif %}\n{% endfor %}"
- id: guest_announce_departure
alias: Guest Announce Departure
mode: queued
initial_state: 'off'
trigger:
- platform: state
entity_id: group.guests
to: not_home
condition:
- condition: state
entity_id: group.guests
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''script.voice_announcement'',''last_triggered''))
) | int > 90 }}'
action:
- service: group.set
data:
object_id: arriving
add_entities: '{{ trigger.to_state.entity_id }}'
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{% set person = expand('group.arriving')|map(attribute='name')|join('\
\ and ') %} {% set peoplecount = expand('group.arriving') | count %} {% if\
\ peoplecount == 1 %}\n {% set is_are = ' is ' %}\n{% else %}\n {% set is_are\
\ = ' are ' %}\n{% endif %}"
- service: notify.mobile_app_jk_2
data:
title: Guest Arrived!
message: "{% for entity in trigger.to_state.attributes.entity_id %}\n {% if\
\ states(entity) == 'not_home' %}\n {{ state_attr(entity, 'friendly_name')\
\ }} has left\n {% endif %}\n{% endfor %}"
- id: guest_mode_off
initial_state: 'on'
alias: Guest mode off
trigger:
- platform: state
entity_id: group.guests
from: home
to: not_home
for:
seconds: 91
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
- condition: state
entity_id: group.guests
state: not_home
action:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode
- if:
- condition: template
value_template: '{{ ( now().timestamp() - as_timestamp(state_attr(''script.voice_announcement'',''last_triggered''))
) | int > 90 }}'
then:
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{{\n [\n \"Arrivederci guests! Guest mode disabled..\"\
,\n \"Guests are gone, it's just us now.\",\n \"Pardon the interruption\
\ but guest mode has been disabled.\",\n \"Attention! Guest mode is disabled.\"\
\n ] | random\n}}"
- if:
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'on'
then:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode_announced
- id: guest_mode_on
initial_state: 'on'
alias: Guest mode on
trigger:
- platform: state
entity_id: group.guests
from: not_home
to: home
- platform: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 13
for:
minutes: 5
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: group.guests
state: home
- condition: numeric_state
entity_id: sensor.indoor_bluetooth_device_count
above: 13
action:
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode
- delay: 00:02:00
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{{\n [\n \"Guest mode has been enabled.\",\n \"Guests\
\ have arrived, act accordingly.\",\n \"You're not alone. Guest mode enabled.\"\
,\n \"Pardon the interruption, but you have guests.\",\n \"Attention!\
\ Guest mode has been enabled.\"\n ] | random\n}}"
- id: halloween_lights_turn_on
alias: Halloween Lights - Turn On
mode: single
trigger:
- platform: homeassistant
event: start
- platform: time
at: 08:00:00
condition:
- condition: state
entity_id: input_boolean.halloween_season_active
state: 'on'
- condition: state
entity_id:
- switch.front_door_smart_plug_1
- switch.front_door_smart_plug_2
- switch.front_left_smart_plug_2
state: 'off'
action:
- action: switch.turn_on
entity_id:
- switch.front_door_smart_plug_1
- switch.front_door_smart_plug_2
- switch.front_left_smart_plug_2
- id: halloween_lights_turn_off
alias: Halloween Lights - Turn Off
mode: single
trigger:
- platform: homeassistant
event: start
- platform: time
at: '22:00:00'
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id:
- switch.front_door_smart_plug_1
- switch.front_door_smart_plug_2
- switch.front_left_smart_plug_2
state: 'on'
action:
- action: switch.turn_off
entity_id:
- switch.front_door_smart_plug_1
- switch.front_door_smart_plug_2
- switch.front_left_smart_plug_2
- id: hourly_dong
alias: Hourly Dong
mode: single
trigger:
- platform: time
at: 07:00:00
- platform: time
at: 08:00:00
- platform: time
at: 09:00:00
- platform: time
at: '10:00:00'
- platform: time
at: '11:00:00'
- platform: time
at: '12:00:00'
- platform: time
at: '15:00:00'
- platform: time
at: '16:00:00'
- platform: time
at: '17:00:00'
- platform: time
at: '18:00:00'
- platform: time
at: '19:00:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.house
state: Auto
- condition: state
entity_id: input_boolean.speech_notifications
state: 'on'
- condition: state
entity_id: binary_sensor.announceable_rooms_occupied
state: 'on'
action:
- alias: Sound File
variables:
media_players: "{% set media_players = [] %} {# Check which rooms are occupied\
\ and if speech notifications are turned #} {# on for them. If so, add them\
\ to an array of announceable rooms #} {% if states.input_boolean.office_occupied.state\
\ == \"on\" and states.input_boolean.office_speech_notifications.state ==\
\ \"on\" %}\n {% set media_players = media_players + [\"media_player.sonos_office\"\
] %}\n{% endif %}{% if states.input_boolean.family_room_occupied.state ==\
\ \"on\" and states.input_boolean.family_room_speech_notifications.state ==\
\ \"on\" %}\n {% set media_players = media_players + [\"media_player.sonos_family_room\"\
] %}\n{% endif %}{% if states.input_boolean.kitchen_occupied.state == \"on\"\
\ and states.input_boolean.kitchen_speech_notifications.state == \"on\" %}\n\
\ {% set media_players = media_players + [\"media_player.sonos_kitchen\"\
] %}\n{% endif %}{% if states.input_boolean.playroom_occupied.state == \"\
on\" %}\n {% set media_players = media_players + [\"media_player.sonos_playroom\"\
] %}\n{% endif %}{% if states.input_boolean.dining_room_occupied.state ==\
\ \"on\" %}\n {% set media_players = media_players + [\"media_player.sonos_living_room\"\
] %}\n{% endif %} {{ media_players}}"
primary_player: '{{media_players | first}}'
sound_file: /local/sounds/dong.mp3
sound_file_length: 4
sound_file_volume: "{% if states.input_boolean.quiet_mode.state == \"on\" %}\n\
\ 25\n{% elif now().strftime('%H')|int > 8 and now().strftime('%H')|int <\
\ 20 %}\n 50\n{% else %}\n 35\n{% endif %}"
- service: script.announcement_engine
data:
sound_file: '{{sound_file}}'
sound_length: '{{sound_file_length}}'
sound_volume: '{{sound_file_volume}}'
media_players: '{{ media_players}}'
- id: house_mode_auto
alias: House mode auto
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
- platform: state
entity_id: input_boolean.quiet_mode
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
sequence:
- action: input_select.select_option
data:
entity_id: input_select.house
option: Vacation
default:
- action: input_select.select_option
data:
entity_id: input_select.house
option: Auto
- service: select.select_option
data:
entity_id: select.front_door_camera_doorbell_text
option: WELCOME!
- if:
- alias: If speech notifications are off
condition: state
entity_id: input_boolean.speech_notifications
state: 'off'
then:
- service: input_boolean.turn_on
entity_id: input_boolean.speech_notifications
- id: house_mode_away
alias: House mode away
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.house
option: Away
- service: select.select_option
data:
entity_id: select.front_door_camera_doorbell_text
option: DO NOT DISTURB
- service: script.general_notification
data:
title: Away Mode
message: Nobody is home so away mode has been activated!
devices: jk
priority: passive
tag: house-mode-away
- id: house_mode_bedtime
alias: House mode bedtime
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.house
option: Bedtime
- service: select.select_option
data:
entity_id: select.front_door_camera_doorbell_text
option: DO NOT DISTURB
- id: house_mode_quiet
alias: House mode quiet
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.quiet_mode
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.house
option: Quiet
- service: select.select_option
data:
entity_id: select.front_door_camera_doorbell_text
option: SHHH…KIDS SLEEPING
- if:
- alias: It's an afternoon nap
condition: time
after: '12:00:00'
before: '15:00:00'
then:
- service: input_boolean.turn_off
entity_id: input_boolean.speech_notifications
- id: house_mode_quiet_off
alias: House mode quiet off
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.quiet_mode
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.house
option: Auto
- id: house_mode_vacation
alias: House Mode Vacation
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.vacation_mode
to: 'on'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.house
option: Vacation
- service: select.select_option
data:
entity_id: select.front_door_camera_doorbell_text
option: Please do not disturb!
- id: house_not_occupied
alias: House not occupied
initial_state: 'on'
triggers:
- trigger: state
entity_id: group.all_people
to: not_home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: group.all_people
state: not_home
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.house_occupied
- id: jido_announce_arrival
alias: Jido Presence - Announce Arrival
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.antoun_koht
from: not_home
to: home
conditions:
- condition: state
entity_id: person.antoun_koht
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: jido
announcement_type: arrival
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- action: input_boolean.turn_on
entity_id: input_boolean.guest_mode_announced
- id: jido_announce_departure
alias: Jido Presence - Announce Departure
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.antoun_koht
from: home
conditions:
- condition: state
entity_id: person.antoun_koht
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: jido
announcement_type: departure
- id: jido_is_away
alias: Jido Presence - Away
initial_state: true
triggers:
- trigger: state
entity_id: person.antoun_koht
to: not_home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.jido_status
state: Just Left
- or:
- condition: state
entity_id: person.antoun_koht
state: not_home
- condition: state
entity_id: device_tracker.antoun_iphone_detect
state: not_home
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.jido_home
- id: jido_is_home
initial_state: true
alias: Jido Presence - Home
triggers:
- trigger: state
entity_id: person.antoun_koht
to: home
- trigger: state
entity_id: device_tracker.antoun_iphone_detect
to: home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: person.antoun_koht
state: home
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.jido_home
- id: jido_presence_just_arrived
alias: Jido Presence - Just Arrived
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.jido_home
to: 'on'
actions:
- action: input_select.select_option
data:
entity_id: input_select.jido_status
option: '{{ ''Home'' if states.input_select.jido_status.state else ''Just Arrived''
}}'
- id: jido_presence_home
alias: Jido Presence - Home
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_select.jido_status
to: Just Arrived
for:
minutes: 5
- trigger: state
entity_id: input_select.jido_status
from: Just Left
to: Just Arrived
actions:
- action: input_select.select_option
data:
entity_id: input_select.jido_status
option: Home
- id: jido_presence_just_left
alias: Jido Presence - Just Left
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.jido_home
to: 'off'
actions:
- action: input_select.select_option
data:
entity_id: input_select.jido_status
option: Just Left
- id: jido_presence_away
alias: Jido Presence - Away
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_select.jido_status
to: Just Left
for:
minutes: 5
actions:
- action: input_select.select_option
data:
entity_id: input_select.jido_status
option: Away
- id: joe_announce_arrival
alias: Joe Announce Arrival
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.joe_falbo
from: not_home
to: home
conditions:
- condition: state
entity_id: person.joe_falbo
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- action: script.person_announcement
data:
person: joe
announcement_type: arrival
- id: joe_announce_departure
alias: Joe Announce Departure
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.joe_home
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: joe
announcement_type: departure
- id: joe_away
alias: Joe away
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.joe_presence
to: 'off'
- platform: state
entity_id: person.joe_falbo
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: not
conditions:
- condition: state
entity_id: input_select.joe_status_dropdown
state: Just Left
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.joe_presence
state: 'off'
- condition: state
entity_id: person.joe_falbo
state: not_home
action:
- service: script.turn_on
entity_id: script.joe_away
- id: joe_home
initial_state: 'on'
alias: Joe Home
trigger:
- platform: state
entity_id: binary_sensor.joe_presence
to: 'on'
- platform: state
entity_id: person.joe_falbo
to: home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.joe_home
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.joe_presence
state: 'on'
- condition: state
entity_id: person.joe_falbo
state: home
action:
- service: script.turn_on
entity_id: script.joe_home
- id: john_announce_arrival
alias: John Announce Arrival
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.john_status
from: Away
to: Just Arrived
- platform: state
entity_id: input_select.john_status
from: Extended Away
to: Just Arrived
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- action: script.person_announcement
data:
person: john
announcement_type: arrival
- id: john_announce_departure
alias: John Announce Departure
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.john_home
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- action: script.person_announcement
data:
person: john
announcement_type: departure
- id: john_arrived_glenview_station
alias: John Arrived at Glenview Station
initial_state: false
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.glenview_train_station
event: enter
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.john_commuting
state: 'on'
action:
- service: automation.turn_off
entity_id:
- automation.john_departed_union_station
- automation.john_passing_morton_grove_station
- automation.john_arrived_at_glenview_station
- id: john_arrived_union_station
alias: John Arrived at Union Station
initial_state: true
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.union_station
event: enter
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: state
entity_id: person.john_koht
state: Union Station
- condition: time
before: '12:00:00'
action:
- service: automation.turn_on
entity_id:
- automation.john_departed_union_station
- automation.john_passing_morton_grove_station
- automation.john_arrived_at_glenview_station
- service: script.voice_announcement
data:
media_players: auto
sound: arcade
priority: normal
speech_message: "{{\n [\n \"Attention! Baba just arrived at Union Station.\"\
,\n \"Pardon the interruption, just wanted to let you know Baba's train\
\ arrived downtown.\"\n ] | random\n}}"
- id: john_arrived_work
alias: John arrived at work
initial_state: 'on'
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.john_s_work
event: enter
- platform: numeric_state
entity_id: sensor.lpl_john_distance
below: 0.25
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
- condition: time
before: '10:30:00'
- condition: state
entity_id: person.john_koht
state: John's Work
action:
- service: script.voice_announcement
data:
media_players: auto
sound: one-chime
speech_message: "{{\n [\n \"Attention! Baba arrived at the office.\",\n\
\ \"Pardon the interruption, but Baba just go to work.\",\n \"Just a\
\ friendly note that Baba has arrived at the office.\"\n ] | random\n}}"
- id: john_away
alias: John away
initial_state: 'on'
trigger:
- platform: zone
entity_id:
- person.john_koht
- device_tracker.jk_iphone_14
zone: zone.home
event: leave
- platform: state
entity_id: binary_sensor.john_presence
to: 'off'
- platform: state
entity_id:
- person.john_koht
- device_tracker.jk_iphone_14
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: template
value_template: '{{ not is_state(''input_select.john_status'', ''Just Arrived'')
}}'
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.john_presence
state: 'off'
- condition: state
entity_id: person.john_koht
state: not_home
- condition: state
entity_id: device_tracker.jk_iphone_14
state: not_home
action:
- service: script.turn_on
data:
entity_id: script.john_away
- id: john_bed_awake
alias: John Bed - Awake
mode: single
trigger:
- platform: state
entity_id: input_select.john_sleep_state
to: Just Got Up
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.john_sleep_state
option: Awake
- id: john_bed_just_got_up
alias: John Bed - Just Got Up
mode: single
trigger:
- platform: state
entity_id: binary_sensor.john_bed_occupied
to: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.john_sleep_state
option: Just Got Up
- id: john_bed_just_laid_down
alias: John Bed - Just Laid Down
mode: single
trigger:
- platform: state
entity_id: binary_sensor.john_bed_occupied
to: 'on'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.john_sleep_state'',''Sleep'')
}}'
action:
- service: input_select.select_option
data:
entity_id: input_select.john_sleep_state
option: Just Laid Down
- id: john_bed_sleep
alias: John Bed - Sleep
mode: single
trigger:
- platform: state
entity_id: input_select.john_sleep_state
to: Just Laid Down
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.john_sleep_state
option: Sleep
- id: john_daily_report
alias: John Daily Report
mode: single
triggers:
- trigger: time
at: 08:05:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: person.john_koht
state: home
action:
- wait_template: '{{ is_state(''binary_sensor.johns_macbook_pro_active'', ''on'')
}}'
timeout: 02:30:00
continue_on_timeout: false
- delay: 00:02:00
- if:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.john_dnd
state: 'off'
- condition: state
entity_id: binary_sensor.john_laptop_audio_active
state: 'off'
then:
- action: script.john_daily_update_announcement
- id: john_departed_union_station
alias: John Departed Union Station
initial_state: false
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.union_station
event: leave
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.john_commuting
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: arcade
priority: normal
speech_message: "{{\n [\n \"Attention! Baba just left Union Station.\",\n\
\ \"Pardon the interruption, but Baba is on the train headed home.\",\n\
\ \"Just a friendly note that Baba's train has departed.\"\n ] | random\n\
}}"
- id: john_departed_work
alias: John has left the office
initial_state: 'on'
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.john_s_work
event: leave
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
- condition: time
after: '15:00:00'
- condition: state
entity_id: sensor.lpl_john_direction_of_travel
state: away_from
action:
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{{\n [\n \"Attention! Baba left the office.\",\n \"\
Pardon the interruption, but Baba just left work.\",\n \"Just a friendly\
\ note that Baba is headed home from the office.\"\n ] | random\n}}"
- id: john_dnd_off
initial_state: true
alias: John DnD Off
mode: queued
triggers:
- trigger: state
entity_id: binary_sensor.john_laptop_camera_active
to: 'off'
for:
seconds: 30
- trigger: state
entity_id: binary_sensor.john_laptop_audio_active
to: 'off'
for:
seconds: 30
conditions:
- condition: state
entity_id: binary_sensor.john_laptop_camera_active
state: 'off'
- condition: state
entity_id: binary_sensor.john_laptop_audio_active
state: 'off'
- condition: state
entity_id: input_boolean.john_dnd
state: 'on'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.john_dnd
- id: john_dnd_on
initial_state: true
alias: John DnD On
mode: queued
triggers:
- trigger: state
entity_id: binary_sensor.john_laptop_camera_active
to: 'on'
for:
seconds: 3
- trigger: state
entity_id: binary_sensor.john_laptop_audio_active
to: 'on'
for:
seconds: 5
conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.john_laptop_camera_active
state: 'on'
- condition: state
entity_id: binary_sensor.john_laptop_audio_active
state: 'on'
- condition: state
entity_id: input_boolean.john_dnd
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.john_dnd
- action: script.general_notification
data:
message: John's DnD mode has been turned on
title: John DnD On!
devices: jk
priority: passive
tag: john-dnd
- id: john_extended_away
alias: John - Extended Away
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.john_status
to: Away
for:
hours: 24
- platform: numeric_state
entity_id: sensor.home_john_distance
above: 200
action:
- service: input_select.select_option
target:
entity_id: input_select.john_status
data:
option: Extended Away
- id: john_home
initial_state: 'on'
alias: John Home
trigger:
- platform: state
entity_id: binary_sensor.john_presence
to: 'on'
- platform: zone
entity_id:
- person.john_koht
- device_tracker.jk_iphone_14
zone: zone.home
event: enter
- platform: state
entity_id:
- person.john_koht
- device_tracker.jk_iphone_14
to: home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.john_presence
state: 'on'
- condition: state
entity_id: person.john_koht
state: home
- condition: state
entity_id: device_tracker.jk_iphone_14
state: home
- condition: zone
entity_id:
- person.john_koht
- device_tracker.jk_iphone_14
zone: zone.home
- condition: state
entity_id: input_boolean.john_home
state: 'off'
action:
- service: script.turn_on
entity_id: script.john_home
- id: john_in_bed
alias: John in Bed
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.john_in_bed
to: 'on'
for:
minutes: 1
- platform: state
entity_id: input_select.john_sleep_state
to: Sleep
- platform: state
entity_id: input_select.john_sleep_state
to: Just Laid Down
condition:
- condition: state
entity_id: binary_sensor.john_in_bed
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.john_sleep_state
state: Sleep
- condition: state
entity_id: input_select.john_sleep_state
state: Just Laid Down
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_is_in_bed
- service: input_boolean.turn_off
entity_id: input_boolean.john_is_awake
- id: john_in_bed
alias: John in bed
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.john_in_bed
to: 'on'
for:
minutes: 1
- platform: state
entity_id: binary_sensor.bedtime
to: 'on'
- platform: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.john_in_bed
state: 'on'
for:
minutes: 1
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_is_in_bed
- service: input_boolean.turn_off
entity_id: input_boolean.john_is_awake
- id: john_is_commuting
alias: John is Commuting
initial_state: true
trigger:
- platform: state
entity_id: person.john_koht
to:
- Morton Grove Train Station
- Union Station
for:
minutes: 2
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: state
entity_id: input_boolean.john_commuting
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_commuting
- service: automation.turn_on
entity_id: automation.john_is_not_commuting
- id: john_is_not_commuting
alias: John is Not Commuting
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.john_home
to: 'on'
condition:
- condition: state
entity_id: input_boolean.john_commuting
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.john_commuting
- service: automation.turn_off
entity_id: automation.john_is_not_commuting
- id: john_passing_morton_grove_station
alias: John Passing Morton Grove Station
initial_state: false
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.morton_grove_train_station
event: enter
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'off'
- condition: time
after: '12:00:00'
- condition: state
entity_id: input_boolean.john_commuting
state: 'on'
action:
- service: script.voice_announcement
data:
speech_message: "{{\n [\n \"Attention! Baba's train will arrive within five\
\ minutes!\",\n \"Pardon the interruption, but Baba's train is arriving\
\ soon.\",\n \"Just a friendly note that Baba's train is arriving shortly.\"\
\n ] | random\n}}"
media_players: auto
sound: arcade
priority: normal
expires_in: 3
- id: john_personal_time_off
initial_state: true
alias: John Personal Time Off
mode: queued
trigger:
- platform: calendar
event: end
entity_id: calendar.john_block
- platform: calendar
event: end
entity_id: calendar.john_gsd
- platform: calendar
event: end
entity_id: calendar.john_ooo
- platform: time
at: 00:00:00
condition:
- condition: state
entity_id: input_boolean.john_personal_time
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.john_personal_time
- service: script.general_notification
data:
message: John personal time turned OFF
title: John Personal Time
devices: jk
priority: passive
tag: john-personal-time
- id: john_person_time_on
initial_state: true
alias: John Personal Time On
mode: queued
trigger:
- platform: calendar
event: start
entity_id: calendar.john_block
offset: 00:00:05
- platform: calendar
event: start
entity_id: calendar.john_gsd
offset: 00:00:05
- platform: calendar
event: start
entity_id: calendar.john_ooo
offset: 00:00:05
condition:
- condition: state
entity_id: input_boolean.john_personal_time
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_personal_time
- service: script.general_notification
data:
message: John personal time turned ON
title: John Personal Time
devices: jk
priority: passive
tag: john-personal-time
- id: john_wake_up
alias: John wake up
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.john_in_bed
to: 'off'
- platform: state
entity_id: binary_sensor.john_in_bed
to: 'off'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
to: 'on'
- platform: state
entity_id: input_select.john_sleep_state
to: Just Got Up
for:
minutes: 2
- platform: state
entity_id: input_select.john_sleep_state
to: Awake
condition:
- condition: state
entity_id: binary_sensor.john_in_bed
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.john_sleep_state
state: Awake
- condition: state
entity_id: input_select.john_sleep_state
state: Just Got Up
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: state
entity_id: input_boolean.john_is_in_bed
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.john_is_in_bed
- service: input_boolean.turn_on
entity_id: input_boolean.john_is_awake
- id: john_work_call_off
initial_state: true
alias: John Work Call Off
mode: queued
trigger:
- platform: calendar
event: end
entity_id: calendar.john_launchpadlab_com
offset: 00:00:10
- platform: state
entity_id: binary_sensor.work_hours
to: 'off'
condition:
- condition: state
entity_id: input_boolean.john_work_call
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.john_work_call
- service: script.general_notification
data:
message: John's work call has been turned OFF
title: John Work Call OFF
devices: jk
priority: passive
tag: john-work-call
- id: john_work_call_on
initial_state: true
alias: John Work Call On
mode: queued
trigger:
- platform: calendar
event: start
entity_id: calendar.john_launchpadlab_com
condition:
- condition: template
value_template: '{% set summary = trigger.calendar_event.summary | lower %} {{
false if "gsd" in summary or "ooo" in summary or "block" in summary else true
}}'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_work_call
- service: script.general_notification
data:
message: John's work call has been turned ON
title: John Work Call ON
devices: jk
priority: passive
tag: john-work-call
- service: automation.turn_off
entity_id: automation.john_work_call_off
- delay: 00:01:00
- service: automation.turn_on
entity_id: automation.john_work_call_off
- id: jr_suite_air_quality_detections
alias: Jr. Suite Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.jr_suite_air_quality
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.jr_suite_air_purifier
aqi_state: '{{ states.sensor.jr_suite_air_quality.state }}'
room_state: '{{ states.input_select.jr_suite.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: jr_suite_lights_off
initial_state: true
alias: Jr. Suite lights off
trigger:
- platform: state
entity_id: input_select.jr_suite
to: 'Off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.jr_suite_bedroom_main_lights
state: 'on'
- condition: state
entity_id: input_select.jr_suite
state: 'Off'
action:
- service: light.turn_off
entity_id: light.jr_suite_bedroom_main_lights
- id: jr_suite_mode_auto
initial_state: true
alias: Jr. Suite mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.jr_suite'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.jr_suite
option: Auto
- id: jr_suite_mode_off
initial_state: true
alias: Jr. Suite mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.jr_suite'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.jr_suite
option: 'Off'
- id: jr_suite_turn_off_purifier
alias: Jr. Suite Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.jr_suite
to: 'Off'
actions:
- action: fan.turn_off
target:
entity_id: fan.jr_suite_air_purifier
- id: katie_announce_arrival
alias: Katia Announce Arrival
mode: queued
initial_state: true
trigger:
- platform: state
entity_id: person.katia
from: not_home
to: home
condition:
- condition: state
entity_id: person.katia
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- service: script.voice_announcement
data:
media_players: auto
speech_message: "{{\n [\n \"Guess who's here? It's Katia!\",\n \"Ciao!\
\ Katia is in the house!\",\n \"Pardon the interruption but Katia is here!\"\
,\n \"Knock knock. Who's there? Katia is here!\"\n ] | random\n}}"
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode_announced
- id: katia_announce_departure
alias: Katia Announce Departure
mode: queued
initial_state: true
trigger:
- platform: state
entity_id: person.katia
from: home
to: not_home
condition:
- condition: state
entity_id: person.katia
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
action:
- service: script.voice_announcement
data:
media_players: auto
speech_message: "{{\n [\n \"Katia has left the house!\",\n \"Arrivederci,\
\ Katia! See you next time!\",\n \"Ciao! Katia just left!\",\n \"Pardon\
\ the interruption but Katia just left\",\n ] | random\n}}"
- id: katie_bluetooth_detected_not_home
alias: Katia Bluetooth Detected Not Home
mode: queued
initial_state: false
trigger:
- platform: template
value_template: '{{ states.sensor.katia_room_presence.state == ''not_home''}}'
for:
minutes: 10
condition:
- condition: template
value_template: '{{ states.sensor.katia_room_presence.state == ''not_home''}}'
- condition: state
entity_id: person.katia
state: home
action:
- service: device_tracker.see
data:
dev_id: katias_iphone
location_name: not_home
- id: katia_is_away
alias: Katia Is Away
initial_state: true
triggers:
- trigger: state
entity_id: person.katia
to: not_home
- trigger: state
entity_id: binary_sensor.katia_presence
to: 'off'
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.katia_status
state: Just Left
- or:
- condition: state
entity_id: person.katia
state: not_home
- condition: state
entity_id: binary_sensor.katia_presence
state: 'off'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.katia_home
- id: katia_is_home
initial_state: true
alias: Katia is Home
triggers:
- trigger: state
entity_id: person.katia
to: home
- trigger: state
entity_id: binary_sensor.katia_presence
to: 'on'
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.katia_home
state: 'off'
- or:
- condition: state
entity_id: person.katia
state: home
- condition: state
entity_id: binary_sensor.katia_presence
state: 'on'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.katia_home
- id: katia_open_garage_upon_arrival
alias: Katia Open Garage Upon Arrival
mode: queued
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.katia_home
to: 'on'
for:
seconds: 3
condition:
- condition: state
entity_id: person.katia
state: home
- condition: state
entity_id: input_select.katia_status
state: Just Arrived
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.garage_driveway_camera_motion.last_updated))
| int < 60 }}'
- condition: state
entity_id: cover.garage_doors
state: closed
action:
- service: cover.open_cover
entity_id: cover.garage_door_2
- id: katie_bluetooth_detected_home
alias: Katia Bluetooth Detected Home
mode: queued
initial_state: true
trigger:
- platform: template
value_template: '{{ states.sensor.katia_room_presence.state != ''not_home''}}'
condition:
- condition: template
value_template: '{{ states.sensor.katia_room_presence.state != ''not_home''}}'
- condition: state
entity_id: person.katia
state: not_home
action:
- service: device_tracker.see
data:
dev_id: katias_iphone
location_name: home
- id: kids_activity_tomorrow_reminder
alias: Kids Activity Tomorrow Reminder
mode: single
trigger:
- platform: time
at: '17:30:00'
- platform: time
at: '20:00:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.kids_activity_tomorrow
state: 'on'
- condition: time
after: '17:00:00'
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: flute-cell-phone-alert
priority: normal
speech_message: "{% set time = states.calendar.kohbocal.attributes.start_time\
\ | as_datetime | as_local %} {% set time = time.timestamp() | timestamp_custom('%-I:%M\
\ %p') %}\n{{ \n [\n \"Hey fam, quick calendar reminder for tomorrow:\
\ \" ~ states.calendar.kohbocal.attributes.message ~ \" at \" ~ time,\n \
\ \"Just a quick reminder that \" ~ states.calendar.kohbocal.attributes.message\
\ ~ \" is tomorrow at \" ~ time,\n \"Heads up for tomorrow: \" ~ states.calendar.kohbocal.attributes.message\
\ ~ \" at \" ~ time\n ] | random\n}}"
- service: script.general_notification
data:
message: '{% set time = states.calendar.kohbocal.attributes.start_time | as_datetime
| as_local %} {% set time = time.timestamp() | timestamp_custom(''%-I:%M %p'')
%} "Tomorrow is {{states.calendar.kohbocal.attributes.message}} at {{time}}"'
title: Kids Activity Reminder
devices: jk
priority: active
tag: kids-activity-reminder
- id: kids_activity_upcoming_reminder
alias: Kids Activity Upcoming Reminder
mode: single
trigger:
- platform: calendar
event: start
entity_id: calendar.kohbocal
offset: -01:00:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: flute-cell-phone-alert
priority: normal
speech_message: "{{ \n [\n \"Hey fam, \" ~ states.calendar.kohbocal.attributes.message\
\ ~ \" is in one hour.\",\n \"Just a quick reminder that \" ~ states.calendar.kohbocal.attributes.message\
\ ~ \" is in one hour.\",\n \"Pardon the interruption, I just wanted to\
\ remind you that \" ~ states.calendar.kohbocal.attributes.message ~ \" is\
\ in one hour.\"\n ] | random\n}}"
- id: kitchen_air_quality_detections
alias: Kitchen Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.kitchen_air_quality
- trigger: state
entity_id: input_boolean.kitchen_occupied
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.kitchen_air_purifier
aqi_state: '{{ states.sensor.kitchen_air_quality.state }}'
room_state: '{{ states.input_select.kitchen.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: kitchen_fridge_door_left_open
initial_state: true
alias: Kitchen Fridge Door Left Open
trigger:
- platform: state
entity_id: binary_sensor.kitchen_fridge_door_status
to: 'on'
for:
minutes: 2
condition:
- condition: state
entity_id: binary_sensor.kitchen_fridge_door_status
state: 'on'
action:
- alias: Repeat until the fridge door is closed
repeat:
sequence:
- service: script.voice_announcement
data:
media_players: auto
sound: police-whistle
speech_message: Fridge is open
- delay: 00:01:00
until:
- condition: state
entity_id: binary_sensor.kitchen_fridge_door_status
state: 'off'
- id: kitchen_lights_day_off
initial_state: true
alias: Kitchen Lights Day Off
trigger:
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
above: 450
for:
minutes: 10
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
above: 500
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
above: 600
for:
minutes: 3
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.kitchen
state: Auto
- condition: state
entity_id: input_boolean.bad_weather
state: 'off'
- condition: state
entity_id: input_boolean.kitchen_lights_auto
state: 'on'
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.kitchen_motion_sensor_table_illuminance
above: 450
- condition: numeric_state
entity_id: sensor.kitchen_motion_sensor_main_illuminance
above: 450
- condition: state
entity_id: light.kitchen_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.kitchen_lights
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lights_auto
- id: kitchen_lights_day_on
initial_state: true
alias: Kitchen Lights Day On
trigger:
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
below: 150
for:
minutes: 2
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
below: 125
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.kitchen_illuminance
below: 100
for:
minutes: 10
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
- platform: state
entity_id: input_boolean.kitchen_lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.kitchen
state: Auto
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'on'
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: numeric_state
entity_id: sensor.kitchen_motion_sensor_main_illuminance
below: 150
- condition: state
entity_id: light.kitchen_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.kitchen_lights
data:
transition: 5
- service: input_boolean.turn_on
entity_id: input_boolean.kitchen_lights_auto
- id: kitchen_lights_dim_motion_off
initial_state: false
alias: Kitchen Lights Dim Motion Off
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'off'
for:
minutes: 3
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_select.kitchen
state: Dim
- condition: or
conditions:
- condition: state
entity_id: input_boolean.kitchen_lights_auto
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.kitchen_motion_sensor_status
state: 'off'
action:
- service: light.turn_off
entity_id: light.kitchen_lights
data:
brightness_pct: 5
transition: 1
- service: automation.turn_off
entity_id: automation.kitchen_lights_dim_motion_off
- id: kitchen_lights_dim_motion_on
initial_state: false
alias: Kitchen Lights Dim Motion On
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.kitchen
state: Dim
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id:
- light.kitchen_main_light_switch
- light.kitchen_table_light_switch
state: 'off'
action:
- service: light.turn_on
entity_id: light.kitchen_lights
data:
brightness_pct: 40
transition: 0.5
- service: automation.turn_on
entity_id: automation.kitchen_lights_dim_motion_off
- service: input_boolean.turn_on
entity_id: input_boolean.kitchen_lights_auto
- id: kitchen_lights_manually_turned_on
initial_state: true
alias: Kitchen lights Manually Turned On
trigger:
- platform: state
entity_id: light.kitchen_lights
to: 'on'
condition:
- condition: template
value_template: '{{ trigger.to_state.context.parent_id == none }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lighting_automations
- service: script.general_notification
data:
title: Kitchen Lights
message: The kitchen lights have been manually turned ON. The parent id is {{trigger.to_state.context.parent_id}}
and the user_id is {{trigger.to_state.context.user_id}}.
devices: jk
priority: passive
tag: kitchen-lighting-automation
- id: kitchen_lights_motion_on
initial_state: true
alias: Kitchen Lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.kitchen
state: Auto
- condition: state
entity_id: input_select.kitchen
state: Dim
- condition: or
conditions:
- condition: state
entity_id: light.kitchen_main_light_switch
state: 'off'
- condition: state
entity_id: light.kitchen_table_light_switch
state: 'off'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.kitchen_motion_sensor_main_illuminance
below: 150
- condition: numeric_state
entity_id: sensor.kitchen_motion_sensor_table_illuminance
below: 150
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.kitchen
state: Auto
sequence:
- service: light.turn_on
entity_id: light.kitchen_lights
data:
transition: 5
- conditions:
- condition: state
entity_id: input_select.kitchen
state: Dim
sequence:
- service: light.turn_on
entity_id: light.kitchen_lights
data:
brightness_pct: 35
transition: 1
- service: input_boolean.turn_on
entity_id: input_boolean.kitchen_lights_auto
- id: kitchen_lights_sleep_mode_off
initial_state: false
alias: Kitchen Lights Sleep Mode Off
trigger:
- platform: sun
event: sunrise
offset: 00:15:00
- platform: time
at: 07:00:00
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: sun
after: sunrise
- condition: time
after: 07:00:00
action:
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_kitchen
- service: automation.turn_off
entity_id: automation.kitchen_lights_sleep_mode_off
- id: kitchen_lights_sleep_mode_on
initial_state: true
alias: Kitchen Lights Sleep Mode On
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: time
at: '23:00:00'
- platform: time
at: 03:00:00
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '20:00:00'
action:
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_kitchen
- service: automation.turn_on
entity_id: automation.kitchen_lights_sleep_mode_off
- id: kitchen_lights_to_away
initial_state: true
alias: Kitchen lights to away
trigger:
- platform: state
entity_id: input_select.kitchen
to: Away
- platform: state
entity_id: input_select.house
to: Away
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.kitchen
state: Away
- condition: and
conditions:
- condition: state
entity_id: input_select.kitchen
state: Auto
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: light.kitchen_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.kitchen_lights
- id: kitchen_lights_to_dim
initial_state: false
alias: Kitchen lights to Dim
trigger:
- platform: state
entity_id: input_select.kitchen
to: Dim
- platform: state
entity_id: input_select.house
to: Dim
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_select.kitchen
state: Dim
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: light.turn_on
entity_id: light.kitchen_lights
data:
brightness_pct: 5
transition: 0.5
- id: kitchen_lights_to_off
initial_state: true
alias: Kitchen Lights to off
trigger:
- platform: state
entity_id: input_select.kitchen
to: 'Off'
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'off'
- condition: template
value_template: '{{ trigger.entity_id == ''input_boolean.kitchen_occupied''
}}'
- condition: or
conditions:
- condition: state
entity_id: input_select.kitchen
state: 'Off'
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'off'
- condition: state
entity_id: light.kitchen_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.kitchen_lights
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lights_auto
- id: kitchen_lights_manually_turned_off
initial_state: true
alias: Kitchen lights Manually Turned Off
trigger:
- platform: state
entity_id: light.kitchen_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.kitchen_lights_auto
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.context.parent_id == none }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_lighting_automations
- service: script.general_notification
data:
title: Kitchen Lights
message: The kitchen lights have been turned off. The parent id is {{trigger.to_state.context.parent_id}}
and the user_id is {{trigger.to_state.context.user_id}}.
devices: jk
priority: passive
tag: kitchen-lighting-automation
- id: kitchen_mode_auto
initial_state: true
alias: Kitchen mode Auto
trigger:
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.kitchen'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.kitchen
option: Auto
- id: kitchen_mode_dim
initial_state: true
alias: Kitchen Mode Dim
trigger:
- platform: state
entity_id: binary_sensor.evening_chill
to: 'on'
- platform: state
entity_id: media_player.sony_bravia_tv
to: playing
- platform: state
entity_id: light.family_room_main_lights
to: 'off'
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: state
entity_id: binary_sensor.evening_chill
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.kitchen'',''Dim'') }}'
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'off'
- condition: state
entity_id: media_player.sony_bravia_tv
state: playing
- condition: state
entity_id: light.family_room_main_lights
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.kitchen
option: Dim
- id: kitchen_mode_off
initial_state: true
alias: Kitchen mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.kitchen'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.kitchen
option: 'Off'
- id: kitchen_not_occupied
initial_state: true
alias: Kitchen not occupied
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_ble_occupancy
to: 'off'
for:
minutes: 2
- trigger: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'off'
for:
minutes: 5
- trigger: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'off'
- trigger: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'off'
for:
minutes: 5
- trigger: state
entity_id: binary_sensor.kitchen_presence_sensor
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.kitchen_presence_sensor
state: 'off'
- condition: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
state: 'off'
for:
minutes: 5
- condition: state
entity_id: binary_sensor.kitchen_ble_occupancy
state: 'off'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.kitchen_occupied
- alias: Wait 2 seconds
delay: 2
- action: input_boolean.turn_on
entity_id: input_boolean.kitchen_lighting_automations
- id: kitchen_occupied
initial_state: true
alias: Kitchen occupied
trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: light.kitchen_lights
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_presence_sensor
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.kitchen_ble_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.kitchen_presence_sensor
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.kitchen_occupied
- id: kitchen_speech_notifications_off
initial_state: true
alias: Kitchen Speech Notifications Off
trigger:
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.kitchen_speech_notifications
- id: kitchen_speech_notifications_on
initial_state: true
alias: Kitchen Speech Notifications On
trigger:
- platform: state
entity_id: input_boolean.kitchen_occupied
to: 'on'
- platform: state
entity_id: input_select.kitchen
to: Auto
condition:
- condition: state
entity_id: input_boolean.kitchen_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.kitchen
state: Auto
- condition: state
entity_id: input_select.kitchen
state: Dim
action:
- service: input_boolean.turn_on
entity_id: input_boolean.kitchen_speech_notifications
- id: kitchen_turn_off_purifier
alias: Kitchen Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.kitchen
to: 'Off'
actions:
- action: fan.turn_off
target:
entity_id: fan.kitchen_air_purifier
- id: late_night_reminders
alias: Late Night Reminders
mode: restart
trigger:
- platform: time
at: '21:00:00'
- platform: state
entity_id: media_player.sony_bravia_tv
to: 'off'
condition:
- condition: time
after: '21:00:00'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.kitchen_motion_sensor_main_motion_detection
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: media_player.sony_bravia_tv
state: 'off'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.media_player.sony_bravia_tv.last_updated))
| int < 360 }}'
action:
- wait_template: '{{ is_state(''binary_sensor.kitchen_motion_sensor_main_motion_detection'',
''on'') }}'
timeout: 00:05:00
- alias: Wait 5 seconds
delay: 5
- service: media_player.volume_set
data:
entity_id: media_player.john_s_echo_show
volume_level: 0.25
- service: notify.alexa_media
data:
data:
type: tts
target: media_player.john_s_echo_show
message: Hey there! Just wanted to remind you to run the dishwasher. Goodnight!
- id: laundry_room_lights_motion_on
initial_state: true
alias: Laundry Room lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
to: 'on'
condition:
- condition: state
entity_id: input_select.laundry_room
state: Auto
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.laundry_room_motion_sensor_illuminance
below: 40
- condition: state
entity_id: light.laundry_room_main_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.laundry_room_main_lights
- service: input_boolean.turn_on
entity_id: input_boolean.laundry_room_lights_auto
- id: laundry_room_lights_off
initial_state: true
alias: Laundry Room lights off
trigger:
- platform: state
entity_id: input_select.laundry_room
to: 'Off'
- platform: state
entity_id: input_boolean.laundry_room_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.laundry_room_main_lights
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.laundry_room
state: 'Off'
- condition: state
entity_id: input_boolean.laundry_room_occupied
state: 'off'
action:
- service: light.turn_off
entity_id: light.laundry_room_main_lights
- service: input_boolean.turn_off
entity_id: input_boolean.laundry_room_lights_auto
- id: laundry_room_mode_auto
initial_state: true
alias: Laundry Room mode Auto
trigger:
- platform: state
entity_id: input_boolean.laundry_room_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.laundry_room'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.laundry_room
option: Auto
- id: laundry_room_mode_off
initial_state: true
alias: Laundry Room mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.laundry_room'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.laundry_room
option: 'Off'
- id: laundry_room_not_occupied
initial_state: true
alias: Laundry Room not occupied
trigger:
- platform: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
to: 'off'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.laundry_room_motion_sensor_occupancy
to: 'off'
condition:
- condition: state
entity_id: input_boolean.laundry_room_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''mudroom'')|map(attribute=''name'')|list | length == 0 }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.laundry_room_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.laundry_room_lighting_automations
- id: laundry_room_occupied
initial_state: true
alias: Laundry Room occupied
trigger:
- platform: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
to: 'on'
- platform: state
entity_id: switch.laundry_room_main_lights
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.laundry_room_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.laundry_room_motion_sensor_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.laundry_room_motion_sensor_motion
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.laundry_room_occupied
- id: main_bathroom_bedtime_motion_on
initial_state: true
alias: Main Bathroom Bedtime Motion On
trigger:
- platform: state
entity_id: binary_sensor.main_bathroom_motion_sensor_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bathroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.main_bathroom
state: Bedtime
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: numeric_state
entity_id: sensor.main_bathroom_motion_sensor_illuminance
below: 15
action:
- service: light.turn_on
entity_id: light.main_bathroom_vanity_lights
data:
brightness_pct: 5
transition: 0.5
- service: input_boolean.turn_on
entity_id: input_boolean.main_bathroom_lights_auto
- id: main_bathroom_lights_motion_on
initial_state: true
alias: Main bathroom lights motion on
trigger:
- platform: state
entity_id: binary_sensor.main_bathroom_motion_sensor_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bathroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.main_bathroom
state: Auto
- condition: numeric_state
entity_id: sensor.main_bathroom_motion_sensor_illuminance
below: 80
- condition: state
entity_id: light.main_bathroom_main_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.main_bathroom_main_lights
- service: input_boolean.turn_on
entity_id: input_boolean.main_bathroom_lights_auto
- id: main_bathroom_lights_off
initial_state: true
alias: Main Bathroom - Lights Off
trigger:
- platform: state
entity_id: input_select.main_bathroom
to: 'Off'
- platform: state
entity_id: input_boolean.main_bathroom_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bathroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'off'
- condition: state
entity_id: light.main_bathroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.main_bathroom_lights
- id: main_bathroom_lights_turned_off
initial_state: true
alias: Main Bathroom lights Manually Turned Off
trigger:
- platform: state
entity_id: light.main_bathroom_main_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.main_bathroom_lights_auto
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.main_bathroom_lights_auto
- id: main_bathroom_mode_auto
initial_state: true
alias: Main Bathroom mode auto
triggers:
- trigger: state
entity_id: input_select.house
to: Auto
- trigger: state
entity_id: input_boolean.main_bathroom_occupied
to: 'off'
- trigger: state
entity_id: input_select.main_bathroom
to: Wake
for:
minutes: 5
- trigger: state
entity_id: input_select.main_bedroom
to: Wake
- trigger: state
entity_id: input_select.main_bedroom
to: Auto
- trigger: time
at: 00:07:00
- trigger: state
entity_id: binary_sensor.bedtime
to: 'off'
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.main_bathroom'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: template
value_template: '{{ not is_state(''input_select.main_bedroom'',''Bedtime'') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.main_bathroom
option: Auto
- action: automation.turn_off
entity_id: automation.main_bathroom_bedtime_motion_on
- action: automation.turn_on
entity_id: automation.main_bathroom_lights_motion_on
- action: switch.turn_off
entity_id:
- switch.adaptive_lighting_sleep_mode_main_bathroom
- switch.adaptive_lighting_sleep_mode_main_bathroom_toilet
- id: main_bathroom_mode_bedtime
initial_state: true
alias: Main Bathroom mode bedtime
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
- trigger: state
entity_id: binary_sensor.bedtime
to: 'on'
- trigger: state
entity_id: input_select.main_bedroom
to: Bedtime
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.main_bathroom'',''Bedtime'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
action:
- action: input_select.select_option
data:
entity_id: input_select.main_bathroom
option: Bedtime
- choose:
- conditions:
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'on'
sequence:
- wait_for_trigger:
- trigger: state
entity_id: input_boolean.main_bathroom_occupied
to: 'off'
timeout:
minutes: 10
continue_on_timeout: true
- action: script.turn_on
entity_id: script.main_bathroom_activate_bedtime_lighting_mode
default:
- action: script.turn_on
entity_id: script.main_bathroom_activate_bedtime_lighting_mode
- id: main_bathroom_mode_off
initial_state: true
alias: Main Bathroom Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.main_bathroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
action:
- service: input_select.select_option
data:
entity_id: input_select.main_bathroom
option: 'Off'
- id: main_bathroom_not_occupied
initial_state: true
alias: Main bathroom not occupied
trigger:
- platform: state
entity_id: binary_sensor.main_bathroom_motion_sensor_occupancy
to: 'off'
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''main_bathroom'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 2
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_boolean.main_bathroom_shower_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.main_bathroom_motion_sensor_occupancy
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''main_bathroom'')|map(attribute=''name'')|list | length == 0 }}'
- condition: state
entity_id: input_boolean.main_bathroom_shower_occupied
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.main_bathroom_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.main_bathroom_lighting_automations
- id: main_bathroom_occupied
initial_state: true
alias: Main bathroom occupied
trigger:
- platform: state
entity_id: binary_sensor.main_bathroom_motion_sensor_status
to: 'on'
- platform: state
entity_id: binary_sensor.main_bathroom_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.main_bathroom_door_sensor_status
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''main_bathroom'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: binary_sensor.main_bathroom_motion_sensor_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.main_bathroom_occupied
- id: main_bathroom_shower_occupied
alias: Main Bathroom Shower Occupied
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.main_bathroom_humidity
above: 60
- platform: template
value_template: '{{ (states.sensor.main_bathroom_humidity.state | int) - (states.input_number.main_bathroom_initial_humidity.state
| int) > 25 }}'
- platform: template
value_template: '{{ (states.sensor.main_bathroom_humidity.state | int) - (states.input_number.main_bathroom_initial_humidity.state
| int) > 40 }}'
condition:
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'on'
- condition: template
value_template: '{{ (states.sensor.main_bathroom_humidity.state | int) - (states.input_number.main_bathroom_initial_humidity.state
| int) > 25 }}'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.main_bathroom_shower_occupied
- id: main_bathroom_shower_not_occupied
alias: Main Bathroom Shower Not Occupied
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.main_bathroom_humidity
below: 85
- platform: numeric_state
entity_id: sensor.main_bathroom_humidity
below: 75
- platform: numeric_state
entity_id: sensor.main_bathroom_humidity
below: 65
- platform: template
value_template: '{{ (states.sensor.main_bathroom_humidity.state | int) - (states.input_number.main_bathroom_initial_humidity.state
| int) < 23 }}'
for:
minutes: 4
condition:
- condition: template
value_template: '{{ (states.sensor.main_bathroom_humidity.state | int) - (states.input_number.main_bathroom_initial_humidity.state
| int) < 25 }}'
- condition: state
entity_id: input_boolean.main_bathroom_shower_occupied
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.main_bathroom_shower_occupied
- id: main_bathroom_set_initial_humidity
alias: Main bathroom Set Initial Humidity
mode: single
trigger:
- platform: state
entity_id: input_boolean.main_bathroom_occupied
to: 'on'
action:
- service: input_number.set_value
data:
entity_id: input_number.main_bathroom_initial_humidity
value: '{{ states.sensor.main_bathroom_humidity.state }}'
- id: main_bathroom_turn_off_outlets
initial_state: true
alias: Main Bathroom - Turn Off Outlets
trigger:
- platform: state
entity_id: input_select.main_bathroom
to: 'Off'
- platform: state
entity_id: input_boolean.main_bathroom_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: switch.smart_plug_12_switch
state: 'on'
- condition: state
entity_id: switch.smart_plug_13_switch
state: 'on'
action:
- service: switch.turn_off
entity_id:
- switch.smart_plug_12_switch
- switch.smart_plug_13_switch
- id: main_bathroom_turn_on_outlets
initial_state: true
alias: Main Bathroom - Turn On Outlets
trigger:
- platform: state
entity_id: input_boolean.main_bathroom_occupied
to: 'on'
action:
- service: switch.turn_on
entity_id:
- switch.smart_plug_12_switch
- switch.smart_plug_13_switch
- id: main_bedroom_air_quality_detections
alias: Main Bedroom Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.main_bedroom_air_quality
- trigger: state
entity_id: input_select.main_bedroom
to: Bedtime
- trigger: state
entity_id: input_boolean.main_bedroom_occupied
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.main_bedroom_air_purifier
aqi_state: '{{ states.sensor.main_bedroom_air_quality.state }}'
room_state: '{{ states.input_select.main_bedroom.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: main_bedroom_john_night_light
initial_state: true
alias: Main bedroom night light for John
trigger:
- platform: state
entity_id: binary_sensor.main_bedroom_motion_sensor_entry_motion
to: 'on'
- platform: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
to: 'off'
- platform: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: state
entity_id: light.hue_ambiance_lamp_1
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.main_bedroom
state: Auto
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: numeric_state
entity_id: sensor.main_bedroom_motion_sensor_entry_illuminance
below: 40
- condition: state
entity_id: light.main_bedroom_main_lights
state: 'off'
- condition: state
entity_id: input_boolean.cristina_in_bed
state: 'on'
- condition: state
entity_id: input_boolean.john_is_in_bed
state: 'off'
- condition: state
entity_id: input_select.john_sleep_state
state: Awake
for:
minutes: 10
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
- condition: time
after: '20:00:00'
before: 05:00:00
action:
- service: light.turn_on
entity_id: light.hue_ambiance_lamp_1
data:
brightness_pct: 30
transition: 0.5
- id: main_bedroom_john_night_light_off
initial_state: true
alias: Main bedroom night light for John - Turn Off
triggers:
- trigger: state
entity_id: input_boolean.john_is_in_bed
to: 'on'
for:
minutes: 10
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
for:
minutes: 5
- trigger: state
entity_id: light.hue_ambiance_lamp_1
to: 'on'
for:
minutes: 10
conditions:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.main_bedroom
state: Auto
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: state
entity_id: input_boolean.john_is_in_bed
state: 'on'
for:
minutes: 10
actions:
- action: light.turn_off
entity_id:
- light.hue_ambiance_lamp_1
- light.hue_ambiance_lamp_1_2
- id: main_bedroom_lights_day_on
initial_state: true
alias: Main bedroom lights day on
trigger:
- platform: numeric_state
entity_id:
- sensor.main_bedroom_motion_sensor_entry_illuminance
- sensor.main_bedroom_motion_sensor_back_illuminance
below: 150
for:
minutes: 2
- platform: numeric_state
entity_id:
- sensor.main_bedroom_motion_sensor_entry_illuminance
- sensor.main_bedroom_motion_sensor_back_illuminance
below: 100
for:
minutes: 5
- platform: numeric_state
entity_id:
- sensor.main_bedroom_motion_sensor_entry_illuminance
- sensor.main_bedroom_motion_sensor_back_illuminance
below: 100
for:
minutes: 10
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
- platform: state
entity_id: input_boolean.main_bedroom_lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bedroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.main_bedroom
state: Auto
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: numeric_state
entity_id: sensor.main_bedroom_motion_sensor_entry_illuminance
below: 150
- condition: state
entity_id: light.main_bedroom_main_lights
state: 'off'
action:
- service: light.turn_on
target:
entity_id: light.main_bedroom_main_lights
data:
transition: 5
- service: input_boolean.turn_on
entity_id: input_boolean.main_bedroom_lights_auto
- id: main_bedroom_lights_motion_on
initial_state: true
alias: Main bedroom lights motion on
trigger:
- platform: state
entity_id: binary_sensor.main_bedroom_motion_sensor
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.main_bedroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.main_bedroom
state: Auto
- condition: numeric_state
entity_id: sensor.main_bedroom_motion_sensor_entry_illuminance
below: 80
- condition: state
entity_id: light.main_bedroom_main_lights
state: 'off'
action:
- service: light.turn_on
target:
entity_id: light.main_bedroom_main_lights
data:
transition: 5
- service: input_boolean.turn_on
entity_id: input_boolean.main_bedroom_lights_auto
- id: main_bedroom_lights_off
initial_state: true
alias: Main bedroom lights off
trigger:
- platform: state
entity_id: input_select.main_bedroom
to: 'Off'
- platform: state
entity_id: input_select.house
to: 'Off'
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_boolean.main_bedroom_lighting_automations
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.main_bedroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.main_bedroom
state: 'Off'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'off'
- condition: state
entity_id:
- input_boolean.john_is_in_bed
- input_boolean.cristina_in_bed
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: state
entity_id: light.main_bedroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.main_bedroom_lights
- id: main_bedroom_lights_turned_off
initial_state: true
alias: Main Bedroom lights Manually Turned Off
trigger:
- platform: state
entity_id: light.main_bedroom_main_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.main_bedroom_lights_auto
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.main_bedroom_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.main_bedroom_lighting_automations
- id: main_bedroom_music_off
initial_state: true
alias: Main Bedroom Music Off
trigger:
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_select.main_bedroom
to: 'Off'
condition:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.main_bedroom_ble_occupancy
state: 'off'
- condition: state
entity_id: media_player.sonos_main_bedroom
state: playing
action:
- service: media_player.unjoin
entity_id: media_player.sonos_main_bedroom
- service: media_player.media_pause
entity_id: media_player.sonos_main_bedroom
- id: main_bedroom_media_player_unjoin
initial_state: true
alias: Main Bedroom Media Player Unjoin
trigger:
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_select.main_bedroom
to: 'Off'
- platform: state
entity_id: media_player.sonos_main_bedroom
to: paused
for:
minutes: 10
- platform: state
entity_id: media_player.sonos_main_bedroom
to: paused
for:
minutes: 30
condition:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.main_bedroom_ble_occupancy
state: 'off'
- condition: state
entity_id: media_player.sonos_main_bedroom
state: paused
- condition: template
value_template: '{{ states.media_player.sonos_main_bedroom.attributes.group_members
| count > 1 }}'
action:
- service: media_player.unjoin
entity_id: media_player.sonos_main_bedroom
- id: main_bedroom_mode_auto
initial_state: true
alias: Main Bedroom mode auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
id: house_auto
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
id: main_bedroom_unoccupied
- platform: state
entity_id: input_select.main_bedroom
to: Wake
for:
minutes: 10
id: main_bedroom_wake
conditions:
- condition: state
entity_id:
- binary_sensor.john_bed_occupied
- binary_sensor.cristina_bed_occupied
state: 'off'
actions:
- choose:
- conditions:
- condition: trigger
id: main_bedroom_unoccupied
sequence:
- if:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
then:
- action: script.main_bedroom_mode_turn_on_auto
default:
- action: script.main_bedroom_mode_turn_on_auto
- id: main_bedroom_mode_bedtime
initial_state: true
alias: Main Bedroom mode bedtime
triggers:
- trigger: state
entity_id: input_boolean.bedtime
to: 'on'
- trigger: state
entity_id: binary_sensor.bedtime
to: 'on'
- trigger: state
entity_id:
- input_boolean.john_is_in_bed
- input_boolean.cristina_in_bed
to: 'on'
- trigger: state
entity_id:
- input_select.john_sleep_state
- input_select.cristina_sleep_state
to: Just Laid Down
- trigger: state
entity_id: light.main_bedroom_main_lights
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.main_bedroom'',''Bedtime'') }}'
- condition: state
entity_id: light.main_bedroom_main_lights
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: state
entity_id: input_boolean.john_is_in_bed
state: 'on'
- condition: state
entity_id: input_boolean.cristina_in_bed
state: 'on'
- condition: state
entity_id:
- input_select.john_sleep_state
- input_select.cristina_sleep_state
state: Just Laid Down
actions:
- action: input_select.select_option
data:
entity_id: input_select.main_bedroom
option: Bedtime
- action: automation.turn_on
entity_id:
- automation.main_bedroom_john_night_light_off
- automation.main_bedroom_night_light_for_john
- action: switch.turn_on
entity_id:
- switch.adaptive_lighting_sleep_mode_main_bedroom
- switch.adaptive_lighting_sleep_mode_main_bedroom_lamps
- id: main_bedroom_mode_off
initial_state: true
alias: Main Bedroom Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.main_bedroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
action:
- service: input_select.select_option
data:
entity_id: input_select.main_bedroom
option: 'Off'
- id: main_bedroom_mode_awake
alias: Main Bedroom mode awake
initial_state: true
trigger:
- platform: state
entity_id:
- input_boolean.cristina_is_awake
- input_boolean.john_is_awake
to: 'on'
- platform: state
entity_id: light.main_bedroom_main_lights
to: 'on'
condition:
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
- condition: time
after: 05:00:00
before: 09:00:00
- condition: and
conditions:
- condition: template
value_template: '{{ states(''input_select.john_sleep_state'') not in (''Sleep'',
''Just Laid Down'') }}'
- condition: template
value_template: '{{ states(''input_select.cristina_sleep_state'') not in (''Sleep'',
''Just Laid Down'') }}'
- condition: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
state: 'on'
- condition: state
entity_id: light.main_bedroom_main_lights
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.main_bedroom
option: Wake
- service: automation.turn_off
entity_id:
- automation.main_bedroom_john_night_light_off
- automation.main_bedroom_night_light_for_john
- action: switch.turn_off
entity_id:
- switch.adaptive_lighting_sleep_mode_main_bedroom
- switch.adaptive_lighting_sleep_mode_main_bedroom_lamps
- id: main_bedroom_not_occupied
initial_state: true
alias: Main bedroom not occupied
triggers:
- trigger: state
entity_id: binary_sensor.main_bedroom_ble_occupancy
to: 'off'
for:
minutes: 2
- trigger: state
entity_id: input_boolean.bedtime
to: 'off'
- trigger: state
entity_id: binary_sensor.main_bedroom_motion_sensor
to: 'off'
for:
minutes: 5
- trigger: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
to: 'off'
- trigger: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
to: 'off'
for:
minutes: 5
- trigger: state
entity_id: input_boolean.main_bathroom_occupied
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.main_bedroom_ble_occupancy
state: 'off'
- condition: state
entity_id: input_boolean.main_bathroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
state: 'off'
- and:
- condition: state
entity_id: input_boolean.john_is_in_bed
state: 'off'
- condition: state
entity_id: input_boolean.cristina_in_bed
state: 'off'
- condition: or
conditions:
- condition: and
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.main_bedroom'',''Bedtime'')
}}'
- condition: time
after: 05:00:00
before: '23:59:59'
- condition: and
conditions:
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
- condition: time
after: 06:00:00
before: '21:00:00'
action:
- action: input_boolean.turn_off
entity_id: input_boolean.main_bedroom_occupied
- alias: Wait 2 seconds
delay: 2
- action: input_boolean.turn_on
entity_id: input_boolean.main_bedroom_lighting_automations
- id: main_bedroom_occupied
initial_state: true
alias: Main bedroom occupied
trigger:
- platform: state
entity_id: binary_sensor.main_bedroom_motion_sensor
to: 'on'
- platform: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
to: 'off'
- platform: state
entity_id: light.main_bedroom_main_lights
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.main_bedroom_ble_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.main_bedroom_motion_sensor_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.main_bedroom_occupied
- id: main_bedroom_speech_notifications_off
initial_state: true
alias: Main Bedroom Speech Notifications Off
trigger:
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_select.main_bedroom
to: Bedtime
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_select.main_bedroom
state: Bedtime
action:
- service: input_boolean.turn_off
entity_id: input_boolean.main_bedroom_speech_notifications
- id: main_bedroom_speech_notifications_on
initial_state: true
alias: Main Bedroom Speech Notifications On
trigger:
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'on'
- platform: state
entity_id: input_select.main_bedroom
to: Auto
condition:
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.main_bedroom
state: Auto
- condition: state
entity_id: input_select.main_bedroom
state: Wake
action:
- service: input_boolean.turn_on
entity_id: input_boolean.main_bedroom_speech_notifications
- id: main_bedroom_turn_off_purifier
alias: Main Bedroom Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.main_bedroom
to: 'Off'
- trigger: state
entity_id: input_boolean.main_bedroom_occupied
to: 'off'
for:
minutes: 30
actions:
- action: fan.turn_off
target:
entity_id: fan.main_bedroom_air_purifier
- id: main_floor_climate_activate_eco_when_energy_is_expensive
alias: Main Floor Climate - Activate Eco When Energy is Expensive
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.energy_prices_are_high
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'off'
- condition: state
entity_id: binary_sensor.extreme_climate
state: 'off'
- condition: template
value_template: '{{ states.climate.nest_main_floor.attributes.preset_mode == ''none''
}}'
actions:
- action: script.main_floor_climate_to_eco
data: {}
- id: main_floor_climate_resume
alias: Main floor climate resume
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id:
- input_boolean.john_is_in_bed
- input_boolean.cristina_in_bed
to: 'off'
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
- platform: time
at: 06:00:00
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: time
after: 06:00:00
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ states.climate.nest_main_floor.attributes.preset_mode != ''none''
}}'
action:
- service: script.main_floor_climate_to_resume
data: {}
- id: main_floor_climate_resume_when_energy_prices_fall
alias: Main Floor Climate - Resume When Energy Prices Fall
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.energy_prices_are_high
from: 'on'
to: 'off'
condition:
- condition: template
value_template: '{{ states.climate.nest_main_floor.attributes.preset_mode != ''none''
}}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nearly_home
state: 'on'
action:
- action: script.main_floor_climate_to_resume
data: {}
- id: main_floor_climate_resume_when_nearly_home
alias: Main Floor Climate Resume When Nearly Home
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.nearly_home
to: 'on'
condition:
- condition: template
value_template: '{{ states.climate.nest_main_floor.attributes.preset_mode != ''none''
}}'
action:
- service: script.main_floor_climate_to_resume
data: {}
- id: main_floor_climate_to_eco
alias: Main floor climate to Eco
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
for:
minutes: 30
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
for:
minutes: 60
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: template
value_template: '{{ states.climate.nest_main_floor.attributes.preset_mode == ''none''
}}'
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.entity_id == ''input_boolean.bedtime'' }}'
- condition: time
before: 04:00:00
sequence:
- service: script.main_floor_climate_to_eco
data: {}
default:
- service: script.main_floor_climate_to_eco
data: {}
- id: main_level_dryer_complete
alias: Main Level Dryer Complete
initial_state: true
trigger:
- platform: state
entity_id: input_select.main_level_dryer_status
to: Clean
condition:
- condition: state
entity_id: input_select.main_level_dryer_status
state: Clean
action:
- service: script.voice_announcement
data:
media_players: auto
sound: chirp
priority: normal
expires_in: 120
speech_message: The main level dryer finished and is ready to be emptied.
- service: script.general_notification
data:
message: The main level dryer is finished and ready to be emptied.
title: Main Level Drying Machine
devices: all
priority: active
tag: main-level-dryer
- if:
- alias: TV is ON
condition: state
entity_id: media_player.sony_bravia_tv
state: 'on'
then:
- service: notify.family_room_sony_bravia_tv
data:
message: The main level dryer is finished and ready to be emptied.
title: Laundry is complete!
data:
duration: 5
position: bottom-right
fontsize: large
transparency: 25%
interrupt: false
color: black
- id: main_level_dryer_power_button
alias: Main Level Dryer Power Button
initial_state: true
trigger:
- platform: device
device_id: 055647d59003c9dc03051ef8e575a427
domain: zha
type: remote_button_short_press
subtype: remote_button_short_press
condition:
- condition: state
entity_id: switch.main_level_drying_machine
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.main_level_drying_machine
- id: main_level_dryer_to_clean
alias: Main Level Dryer to Clean
initial_state: true
trigger:
- platform: state
entity_id: input_select.main_level_dryer_status
to: Finishing
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.main_level_drying_machine_electric_consumption_w
below: 50
condition:
- condition: state
entity_id: input_select.main_level_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_dryer_status
option: Clean
- id: main_level_dryer_to_finished
alias: Main Level Dryer to Finishing
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.main_level_drying_machine_electric_consumption_w
below: 150
condition:
- condition: state
entity_id: input_select.main_level_dryer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_dryer_status
option: Finishing
- id: main_level_dryer_to_idle
alias: Main Level Dryer to Idle
initial_state: true
trigger:
- platform: state
entity_id: input_select.main_level_dryer_status
to: Clean
for:
minutes: 5
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.main_level_dryer_status
state: Clean
- condition: state
entity_id: input_select.main_level_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_dryer_status
option: Idle
- id: main_level_dryer_to_running
alias: Main Level Dryer to Running
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.main_level_drying_machine_electric_consumption_w
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.main_level_dryer_status
state: Idle
- condition: state
entity_id: input_select.main_level_dryer_status
state: Clean
- condition: state
entity_id: input_select.main_level_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_dryer_status
option: Running
- id: main_level_washer_complete_alert
alias: Main Level Washer Complete Alert
initial_state: true
trigger:
- platform: state
entity_id: input_select.main_level_washer_status
to: Clean
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
for:
minutes: 10
- platform: time
at: 08:01:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.main_level_washer_status
state: Clean
- condition: template
value_template: "{% if states.automation.main_level_washer_complete_alert.attributes.last_triggered\
\ is not none %}\n {% if as_timestamp(now()) | int - as_timestamp(states.automation.main_level_washer_complete_alert.attributes.last_triggered)\
\ | int > 3600 %}\n true \n {% else %}\n false\n {% endif %}\n{% else\
\ %}\n false\n{% endif %}\n"
action:
- service: script.voice_announcement
data:
media_players: auto
sound: chirp
priority: normal
expires_in: 120
speech_message: The main level washer finished and is ready to be emptied.
- service: "{% if (is_state(\"input_boolean.john_home\", \"on\")) and (is_state(\"\
input_boolean.cristina_home\", \"on\")) %}\n notify.ios_family\n{% elif is_state(\"\
input_boolean.john_home\", \"on\") %}\n notify.mobile_app_jk_2\n{% elif (is_state(\"\
input_boolean.cristina_home\", \"on\")) %}\n notify.mobile_app_cfalb2\n{% endif\
\ %}\n"
data:
message: The main level washer is finished and is ready to be emptied.
title: Main Level Washing Machine
- if:
- alias: TV is ON
condition: state
entity_id: media_player.sony_bravia_tv
state: 'on'
then:
- service: notify.family_room_sony_bravia_tv
data:
message: The main level washer is finished and is ready to be emptied.
title: Laundry is complete!
data:
duration: 5
position: bottom-right
fontsize: large
transparency: 25%
interrupt: false
color: black
- id: main_level_washer_to_clean
alias: Main Level Washer to Clean
initial_state: true
trigger:
- platform: state
entity_id: input_select.main_level_washer_status
to: Finishing
for:
minutes: 1
- platform: numeric_state
entity_id: sensor.main_level_washing_machine_electric_consumption_w
below: 20
condition:
- condition: state
entity_id: input_select.main_level_washer_status
state: Finishing
- condition: numeric_state
entity_id: sensor.main_level_washing_machine_electric_consumption_w
below: 50
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_washer_status
option: Clean
- id: main_level_washer_to_finished
alias: Main Level Washer to Finished
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.main_level_washing_machine_electric_consumption_w
below: 20
condition:
- condition: state
entity_id: input_select.main_level_washer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_washer_status
option: Finishing
- id: main_level_washer_to_idle
alias: Upstairs washer to idle
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.main_level_washer_door_sensor_status
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.main_level_washer_status
state: Clean
- condition: state
entity_id: input_select.main_level_washer_status
state: Finishing
- condition: state
entity_id: input_select.main_level_washer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_washer_status
option: Idle
- id: main_level_washer_to_running
alias: Main Level Washer to Running
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.main_level_washing_machine_electric_consumption_w
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.main_level_washer_status
state: Idle
- condition: state
entity_id: input_select.main_level_washer_status
state: Clean
- condition: state
entity_id: input_select.main_level_washer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.main_level_washer_status
option: Running
- id: morning_update
alias: Morning Update
mode: single
triggers:
- trigger: time
at: 07:05:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- wait_template: '{{ is_state(''input_boolean.quiet_mode'', ''off'') }}'
timeout: 00:45:00
- wait_template: "{{\n states.binary_sensor.kitchen_motion_sensor_occupancy.state\
\ == \"on\" and\n (as_timestamp(now()) - as_timestamp(states.binary_sensor.kitchen_motion_sensor_occupancy.last_changed))\
\ | int >= 600\n}}"
timeout: 00:30:00
continue_on_timeout: false
- wait_template: '{{ is_state(''binary_sensor.kitchen_motion_sensor_status'', ''on'')
}}'
timeout: 00:30:00
continue_on_timeout: false
- alias: Wait 2 seconds
delay: 2
- action: script.morning_update_announcement
- id: mudroom_bathroom_fan_off
initial_state: true
alias: Mudroom Bathroom Fan Off
trigger:
- platform: state
entity_id: input_select.mudroom_bathroom
to: 'Off'
- platform: state
entity_id: input_boolean.mudroom_bathroom_occupied
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: fan.mudroom_bathroom_fan
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.mudroom_bathroom
state: 'Off'
- condition: state
entity_id: input_boolean.mudroom_bathroom_occupied
state: 'off'
action:
- service: fan.turn_off
entity_id: fan.mudroom_bathroom_fan
- id: mudroom_bathroom_motion_on
initial_state: true
alias: Mudroom Bathroom Lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.mudroom_bathroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_select.mudroom_bathroom
state: Auto
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.mudroom_bathroom_illuminance
below: 200
- condition: state
entity_id: light.mudroom_bathroom_main_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.mudroom_bathroom_main_lights
- id: mudroom_bathroom_lights_off
initial_state: true
alias: Mudroom Bathroom lights off
trigger:
- platform: state
entity_id: input_boolean.mudroom_bathroom_occupied
to: 'off'
- platform: state
entity_id: input_select.mudroom_bathroom
to: 'Off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.mudroom_bathroom_main_lights
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.mudroom_bathroom
state: 'Off'
- condition: state
entity_id: input_boolean.mudroom_bathroom_occupied
state: 'off'
action:
- service: light.turn_off
entity_id: light.mudroom_bathroom_main_lights
- id: mudroom_bathroom_mode_auto
initial_state: true
alias: Mudroom Bathroom Mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.mudroom_bathroom'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom_bathroom
option: Auto
- id: mudroom_bathroom_mode_off
initial_state: true
alias: Mudroom Bathroom Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.mudroom_bathroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom_bathroom
option: 'Off'
- id: mudroom_bathroom_not_occupied
initial_state: true
alias: Mudroom Bathroom Not Occupied
trigger:
- platform: state
entity_id: binary_sensor.mudroom_bathroom_motion
to: 'off'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.mudroom_bathroom_motion
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.mudroom_bathroom_motion
to: 'off'
for:
minutes: 7
- platform: state
entity_id: binary_sensor.mudroom_bathroom_occupancy
to: 'off'
condition:
- condition: state
entity_id: input_boolean.mudroom_bathroom_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.mudroom_bathroom_motion
state: 'off'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.mudroom_bathroom_door.last_changed))
| int < 180 }}'
- condition: state
entity_id: binary_sensor.mudroom_bathroom_occupancy
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.mudroom_bathroom_motion
state: 'off'
for:
minutes: 5
- condition: state
entity_id: binary_sensor.mudroom_bathroom_door
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.mudroom_bathroom_occupied
- id: mudroom_bathroom_occupied
initial_state: true
alias: Mudroom Bathroom Occupied
trigger:
- platform: state
entity_id: binary_sensor.mudroom_bathroom_motion
to: 'on'
- platform: state
entity_id: light.mudroom_bathroom_main_lights
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.mudroom_bathroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.mudroom_bathroom_motion
state: 'on'
- condition: state
entity_id: binary_sensor.mudroom_bathroom_door
state: 'off'
- condition: state
entity_id: light.mudroom_bathroom_main_lights
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.mudroom_bathroom_occupied
- id: mudroom_lights_to_away
initial_state: 'on'
alias: Mudroom lights to away
trigger:
- platform: state
entity_id: input_select.mudroom
to: Away
- platform: state
entity_id: input_select.house
to: Away
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.mudroom
state: Away
- condition: and
conditions:
- condition: state
entity_id: input_select.mudroom
state: Auto
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: light.mudroom_main_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.mudroom_main_lights
- id: mudroom_lights_to_dim
initial_state: 'on'
alias: Mudroom lights to dim
trigger:
- platform: state
entity_id: binary_sensor.mudroom_motion_sensor_motion_detection
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_select.mudroom
state: Night Motion
- condition: state
entity_id: light.mudroom_main_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.mudroom_main_lights
data:
brightness_pct: 30
- id: mudroom_lights_to_off
initial_state: 'on'
alias: Mudroom lights to off
trigger:
- platform: state
entity_id: input_select.mudroom
to: Away
- platform: state
entity_id: input_select.house
to: 'Off'
- platform: state
entity_id: binary_sensor.mudroom_motion_sensor_motion_detection
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: light.mudroom_main_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.mudroom_main_lights
- id: mudroom_lights_to_on
initial_state: 'on'
alias: Mudroom lights to on
trigger:
- platform: state
entity_id: input_select.mudroom
to: 'On'
- platform: state
entity_id: binary_sensor.mudroom_motion_sensor_motion_detection
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.mudroom
state: 'On'
- condition: state
entity_id: input_select.mudroom
state: Motion
- condition: state
entity_id: light.mudroom_main_lights
state: 'off'
action:
- service: light.turn_on
entity_id: light.mudroom_main_lights
- id: mudroom_mode_away
initial_state: 'on'
alias: Mudroom mode away
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.mudroom'',''Away'') }}'
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom
option: Away
- id: mudroom_mode_motion
initial_state: 'on'
alias: Mudroom mode motion
trigger:
- platform: state
entity_id: binary_sensor.mudroom_motion_sensor_motion_detection
to: 'off'
for:
minutes: 5
- platform: state
entity_id: input_select.house
to: Auto
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ is_state(''input_select.mudroom'',''On'') }}'
- condition: template
value_template: '{{ is_state(''input_select.mudroom'',''Night Motion'') }}'
- condition: template
value_template: '{{ not is_state(''input_select.mudroom'',''Motion'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom
option: Motion
- id: mudroom_mode_night_motion
initial_state: 'on'
alias: Mudroom mode night motion
trigger:
- platform: state
entity_id: input_select.house
to: Bedtime
for:
minutes: 10
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: binary_sensor.bedtime
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.mudroom'',''Night Motion'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom
option: Night Motion
- id: mudroom_mode_on
initial_state: 'on'
alias: Mudroom mode on
trigger:
- platform: state
to: Just Arrived
entity_id:
- input_select.john_status
- input_select.cristina_status_dropdown
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.mudroom
option: 'On'
- id: nearly_home_off
alias: Nearly Home - Turn Off
initial_state: true
trigger:
- platform: state
entity_id: group.family
to: home
- platform: state
entity_id:
- person.cristina_falbo
- person.john_koht
to: home
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: group.family
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nearly_home
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.nearly_home
- service: automation.turn_off
entity_id: automation.nearly_home_turn_off
- service: script.general_notification
data:
title: Nearly Home Off
message: Nearly Home turned off since you're home
devices: jk
priority: passive
tag: nearly-home
- id: nearly_home_on
alias: Nearly Home - Turn On
initial_state: true
trigger:
- platform: numeric_state
entity_id:
- sensor.home_nearest_distance
below: 5
above: 1
condition:
- condition: state
entity_id: input_boolean.nearly_home
state: 'off'
- condition: state
entity_id: group.family
state: not_home
for:
minutes: 10
- condition: state
entity_id: sensor.home_nearest_direction_of_travel
state: towards
action:
- service: input_boolean.turn_on
entity_id: input_boolean.nearly_home
- service: automation.turn_on
entity_id: automation.nearly_home_turn_off
- service: script.general_notification
data:
title: Nearly Home On
message: Nearly home automation turned on
devices: jk
priority: passive
tag: nearly-home
- id: neighborhood_event_tomorrow_reminder
alias: Kids Activity Tomorrow Reminder
mode: single
trigger:
- platform: time
at: '20:00:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.neighborhood_event_tomorrow
state: 'on'
action:
- wait_template: "{{ \n is_state('binary_sensor.kitchen_motion_sensor_status',\
\ 'on')\n or\n is_state('binary_sensor.family_room_motion_sensor', 'on')\n\
}}"
timeout: 00:05:00
- alias: Wait 2 seconds
delay: 2
- service: script.voice_announcement
data:
media_players: auto
sound: message-alert
speech_message: "{% set time = states.calendar.golf_acres.attributes.start_time\
\ | as_datetime | as_local %} {% set time = time.timestamp() | timestamp_custom('%-I:%M\
\ %p') %}\n{{ \n [\n \"Hey fam! Neighborhood event tomorrow: \" ~ states.calendar.golf_acres.attributes.message\
\ ~ \" at \" ~ time,\n \"Just a quick reminder that \" ~ states.calendar.golf_acres.attributes.message\
\ ~ \" is tomorrow at \" ~ time,\n \"Heads up for tomorrow: \" ~ states.calendar.golf_acres.attributes.message\
\ ~ \" at \" ~ time\n ] | random\n}}"
- service: script.general_notification
data:
message: '{% set time = states.calendar.golf_acres.attributes.start_time |
as_datetime | as_local %} {% set time = time.timestamp() | timestamp_custom(''%-I:%M
%p'') %} "Tomorrow is {{states.calendar.golf_acres.attributes.message}} at
{{time}}"'
title: Neighborhood Event Reminder
devices: jk
priority: active
tag: neighborhood-event-reminder
- id: neighborhood_event_upcoming_reminder
alias: Neighborhood Event Upcoming Reminder
mode: single
trigger:
- platform: calendar
event: start
entity_id: calendar.golf_acres
offset: -01:00:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: success-trumpets
speech_message: "{{ \n [\n \"Hey fam, \" ~ states.calendar.golf_acres.attributes.message\
\ ~ \" is in one hour.\",\n \"Just a quick reminder that \" ~ states.calendar.golf_acres.attributes.message\
\ ~ \" is in one hour.\",\n \"Pardon the interruption, I just wanted to\
\ remind you that \" ~ states.calendar.golf_acres.attributes.message ~ \"\
\ is in one hour.\"\n ] | random\n}}"
- id: enable_nino_bathroom_heater_automation
alias: Enable Nino's Bathroom Heater Automation
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'on'
for:
minutes: 30
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: time
at: 00:01:00
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: time
after: '18:00:00'
- condition: state
entity_id: automation.nino_s_bathroom_heater_on
state: 'off'
action:
- service: automation.turn_on
entity_id: automation.nino_s_bathroom_heater_on
- id: ninos_bathroom_heater_on
alias: Nino's Bathroom Heater On
initial_state: false
trigger:
- platform: time
at: 05:00:00
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'on'
- platform: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state |
float) < 71.0 }}'
- platform: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state |
float) < 61.0 }}'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state
| float) < 65.0 }}'
- condition: time
after: 04:30:00
- condition: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state |
float) < 71.0 }}'
- condition: state
entity_id: switch.smart_plug_2_switch
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.smart_plug_2_switch
- service: automation.turn_off
entity_id: automation.nino_s_bathroom_heater_on
- id: ninos_bathroom_heater_off
alias: Nino's Bathroom Heater Off
initial_state: true
trigger:
- platform: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state |
float) > 73.5 }}'
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
for:
minutes: 20
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: switch.smart_plug_2_switch
to: 'on'
for:
hours: 3
condition:
- condition: state
entity_id: switch.smart_plug_2_switch
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.smart_plug_2_switch
- id: ninos_bathroom_heater_turn_on_upon_arrival
alias: Nino's Bathroom Heater - Turn On Upon Arrival
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id: group.family
from: not_home
to: home
- platform: state
entity_id:
- person.cristina_falbo
- person.john_koht
to: Just Arrived
condition:
- condition: or
conditions:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.house_occupied.last_updated))
| int < 300 }}'
- condition: and
conditions:
- condition: state
entity_id: group.family
state: home
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.group.familiy.last_updated))
| int < 300 }}'
- condition: state
entity_id:
- person.cristina_falbo
- person.john_koht
state: Just Arrived
- condition: template
value_template: '{{ (states.sensor.aqara_weather_sensor_1_temperature.state |
float) < 71.5 }}'
- condition: time
after: '18:30:00'
action:
- service: switch.turn_on
entity_id: switch.smart_plug_2_switch
- id: nino_bedroom_heater_on
alias: Nino bedroom heater on
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'on'
for:
minutes: 1
- platform: numeric_state
entity_id: sensor.nino_room_temperature
below: 70
for:
minutes: 5
- platform: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) < 69.5
}}'
- platform: numeric_state
entity_id: sensor.nino_room_temperature
below: 69
for:
minutes: 5
- platform: time
at: '18:30:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: time
after: '18:30:00'
- condition: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) < 71.3
}}'
action:
- service: switch.turn_on
entity_id: switch.smart_plug_2_switch
- id: nino_bedroom_heater_off
alias: Nino bedroom heater off
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'on'
for:
minutes: 10
- platform: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) > 70.15
}}'
- platform: numeric_state
entity_id: sensor.nino_room_temperature
above: 71
- platform: numeric_state
entity_id: sensor.nino_room_temperature
above: 72
- platform: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) > 72.5
}}'
- platform: numeric_state
entity_id: sensor.nino_room_temperature
above: 73
- platform: numeric_state
entity_id: sensor.nino_room_temperature
above: 74
- platform: numeric_state
entity_id: sensor.nino_room_temperature
above: 75
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
condition:
- condition: or
conditions:
- condition: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) >= 72.0
}}'
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: state
entity_id: switch.smart_plug_2_switch
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.smart_plug_2_switch
- id: ninos_bedroom_heater_turn_on_upon_arrival
alias: Nino Bedroom Heater - Turn On Upon Arrival
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
- platform: state
entity_id: group.family
from: not_home
to: home
- platform: state
entity_id:
- person.cristina_falbo
- person.john_koht
to: Just Arrived
condition:
- condition: or
conditions:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.house_occupied.last_updated))
| int < 300 }}'
- condition: and
conditions:
- condition: state
entity_id: group.family
state: home
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.group.familiy.last_updated))
| int < 300 }}'
- condition: state
entity_id:
- person.cristina_falbo
- person.john_koht
state: Just Arrived
- condition: template
value_template: '{{ (states.sensor.nino_room_temperature.state | float) < 71.5
}}'
- condition: time
after: '18:30:00'
action:
- service: switch.turn_on
entity_id: switch.smart_plug_2_switch
- id: ninos_bedroom_lights_off
initial_state: true
alias: Nino's Bedroom - Lights Off
trigger:
- platform: state
entity_id: input_select.ninos_bedroom
to: 'Off'
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.ninos_bedroom
state: 'Off'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
action:
- service: light.turn_off
entity_id:
- light.ninos_bedroom_main_lights
- light.nino_bedroom_lamp
- id: ninos_bedroom_mode_auto
initial_state: true
alias: Nino's Bedroom - Mode Auto
triggers:
- trigger: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
- trigger: state
entity_id: input_select.house
to: Auto
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
- trigger: state
entity_id: input_boolean.nino_in_bed
to: 'off'
for:
minutes: 10
- trigger: state
entity_id: input_boolean.bedtime
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.ninos_bedroom'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.nino_in_bed
state: 'off'
actions:
- action: input_select.select_option
data:
entity_id: input_select.ninos_bedroom
option: Auto
- id: ninos_bedroom_mode_bedtime
initial_state: true
alias: Nino's Bedroom - Mode Bedtime
triggers:
- trigger: state
entity_id: input_boolean.nino_in_bed
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.ninos_bedroom'',''Bedtime'') }}'
action:
- action: input_select.select_option
data:
entity_id: input_select.ninos_bedroom
option: Bedtime
- id: ninos_bedroom_mode_off
initial_state: true
alias: Nino's Bedroom - Mode Off
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.house
to: Away
- trigger: homeassistant
event: start
- trigger: event
event_type: automation_reloaded
conditions:
- condition: template
value_template: '{{ not is_state(''input_select.ninos_bedroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
actions:
- action: input_select.select_option
data:
entity_id: input_select.ninos_bedroom
option: 'Off'
- id: ninos_bedroom_not_occupied
initial_state: true
alias: Nino's Bedroom - Not Occupied
trigger:
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'on'
for:
minutes: 5
- platform: state
entity_id: light.ninos_bedroom_main_lights
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.nino_bed_occupied
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'on'
- condition: state
entity_id: light.ninos_bedroom_main_lights
state: 'off'
- condition: state
entity_id: binary_sensor.nino_bed_occupied
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.ninos_bedroom_occupied
- id: ninos_bedroom_occupied
initial_state: true
alias: Nino's Bedroom - Occupied
trigger:
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'off'
- platform: state
entity_id: light.ninos_bedroom_main_lights
to: 'on'
- platform: state
entity_id: binary_sensor.nino_bed_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'off'
- condition: state
entity_id: light.ninos_bedroom_main_lights
state: 'on'
- condition: state
entity_id: binary_sensor.nino_bed_occupied
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.ninos_bedroom_occupied
- id: nino_bedroom_air_quality_detections
alias: Nino's Bedroom Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.nino_bedroom_air_quality
- trigger: state
entity_id: input_select.ninos_bedroom
to: Bedtime
- trigger: state
entity_id: input_boolean.ninos_bedroom_occupied
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.ninos_bedroom_air_purifier
aqi_state: '{{ states.sensor.nino_bedroom_air_quality.state }}'
room_state: '{{ states.input_select.ninos_bedroom.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: nino_bedroom_turn_off_purifier
alias: Nino's Bedroom Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
for:
minutes: 30
actions:
- action: fan.turn_off
target:
entity_id: fan.ninos_bedroom_air_purifier
- id: nino_bed_awake
alias: Nino Bed - Awake
mode: single
trigger:
- platform: state
entity_id: input_select.nino_sleep_state
to: Just Got Up
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.nino_sleep_state
option: Awake
- service: input_boolean.turn_off
entity_id: input_boolean.nino_in_bed
- id: nino_bed_just_got_up
alias: Nino Bed - Just Got Up
mode: single
trigger:
- platform: state
entity_id: binary_sensor.nino_bed_occupied
to: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.nino_sleep_state
option: Just Got Up
- id: nino_bed_just_laid_down
alias: Nino Bed - Just Laid Down
mode: single
trigger:
- platform: state
entity_id: binary_sensor.nino_bed_occupied
to: 'on'
condition:
- condition: template
value_template: '{{ not is_state(''input_select.nino_sleep_state'',''Sleep'')
}}'
action:
- service: input_select.select_option
data:
entity_id: input_select.nino_sleep_state
option: Just Laid Down
- id: nino_bed_sleep
alias: Nino Bed - Sleep
mode: single
trigger:
- platform: state
entity_id: input_select.nino_sleep_state
to: Just Laid Down
for:
minutes: 5
action:
- service: input_select.select_option
data:
entity_id: input_select.nino_sleep_state
option: Sleep
- service: input_boolean.turn_on
entity_id: input_boolean.nino_in_bed
- id: nino_countdown_to_birthday_turn_off
alias: Nino Countdown to Birthday - Turn Off
mode: single
initial_state: false
triggers:
- trigger: template
value_template: '{{ now().month == 4 and now().day == 18 }}'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.nino_countdown_to_birthday
- action: automation.turn_off
entity_id:
- automation.nino_countdown_to_birthday_turn_off
- automation.nino_birthday_countdown_reminder
- automation.nino_birthday_daily_reset
- action: automation.turn_on
entity_id: automation.nino_countdown_to_birthday_turn_on
- id: nino_countdown_to_birthday_turn_on
alias: Nino Countdown to Birthday - Turn On
mode: single
initial_state: true
triggers:
- trigger: template
value_template: '{{ now().month == 4 and now().day == 2 }}'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.nino_countdown_to_birthday
- action: automation.turn_on
entity_id:
- automation.nino_countdown_to_birthday_turn_off
- action: automation.turn_off
entity_id: automation.nino_countdown_to_birthday_turn_on
- id: nino_daily_medication_reminder
alias: Nino Daily Medication Reminder
trigger:
- trigger: time
at: 07:30:00
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.nino_daily_medication_timer
- trigger: state
entity_id: input_select.nino_sleep_state
to: Awake
for:
hours: 1
conditions:
- condition: state
entity_id: input_boolean.nino_daily_medication_taken
state: 'off'
- condition: state
entity_id: timer.nino_daily_medication_timer
state: idle
- condition: state
entity_id: input_select.nino_sleep_state
state: Awake
- condition: time
after: 07:30:00
before: '10:30:00'
actions:
- action: script.voice_announcement
data:
media_players: auto
sound: chirp
priority: high
speech_message: "{{\n [\n \"It's time for Nino to take his medication.\"\
,\n \"Nino, it's time to take your medication.\",\n \"Don't forget to\
\ give Nino his medication.\",\n ] | random\n}}"
- variables:
action_taken: '{{ ''TAKEN_'' ~ context.id }}'
action_snooze: '{{ ''SNOOZE_'' ~ context.id }}'
- action: script.general_notification
data:
title: Nino's Daily Medication Reminder
message: It's time for Nino to take his morning medication.
devices: all
priority: time-sensitive
tag: nino-morning-medication
actions:
- action: '{{ action_taken }}'
title: Medication Taken
- action: '{{ action_snooze }}'
title: Snooze 15 Minutes
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_taken }}'
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_snooze }}'
- trigger: device
device_id: d98b081e7991a6e9ce1672128dad93ae
domain: zha
type: remote_button_short_press
subtype: turn_on
event_data:
action: '{{ action_taken }}'
timeout:
minutes: 15
- if:
- '{{ not wait.completed }}'
then:
- action: timer.start
entity_id: timer.nino_daily_medication_timer
else:
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_taken }}'
then:
- action: input_boolean.turn_on
entity_id: input_boolean.nino_daily_medication_taken
- action: timer.cancel
entity_id: timer.nino_daily_medication_timer
- action: automation.turn_off
entity_id: automation.nino_daily_medication_reminder
- if:
- condition: template
value_template: '{{ wait.trigger.event.data.action == action_snooze }}'
then:
- action: timer.start
entity_id: timer.nino_daily_medication_timer
- id: nino_medication_reminder_reset
alias: Nino Medication Reminder Reset
trigger:
- trigger: time
at: 03:00:01
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.nino_daily_medication_taken
- action: timer.cancel
entity_id: timer.nino_daily_medication_timer
- action: automation.turn_on
entity_id: automation.nino_daily_medication_reminder
- id: nino_medication_reminder_shortcut_button
alias: Nino Medication Reminder Shortcut Button
initial_state: true
triggers:
- trigger: device
device_id: d98b081e7991a6e9ce1672128dad93ae
domain: zha
type: remote_button_short_press
subtype: turn_on
conditions:
- condition: state
entity_id: input_boolean.nino_daily_medication_taken
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.nino_daily_medication_taken
- action: timer.cancel
entity_id: timer.nino_daily_medication_timer
- action: automation.turn_off
entity_id: automation.nino_daily_medication_reminder
- id: nino_escape_monitor
alias: Nino Escape Monitor
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'on'
condition:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''in'', [''nino_bedroom''])|map(attribute=''name'')|list | length == 0 }}'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.ninos_bedroom_occupied.last_updated))
| int > 900 }}'
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'off'
for:
minutes: 10
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
- condition: state
entity_id: binary_sensor.main_bedroom_door_sensor_status
state: 'off'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.binary_sensor.main_bedroom_door_sensor_status.last_updated))
| int > 90 }}'
action:
- service: notify.mobile_app_jk_2
data:
message: Nino is escaping!
title: Nino Escape Monitor
- id: nino_escape_monitor_turn_off
alias: Nino Escape Monitor - Turn Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'off'
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- service: automation.turn_off
entity_id: automation.nino_escape_monitor
- id: nino_escape_monitor_turn_on
alias: Nino Escape Monitor - Turn On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: state
entity_id: binary_sensor.ninos_door_sensor_status
to: 'off'
for:
minutes: 30
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'off'
action:
- service: automation.turn_on
entity_id: automation.nino_escape_monitor
- id: nino_nap_time
alias: Nino's nap time
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'on'
for:
minutes: 3
- platform: state
entity_id: light.ninos_bedroom_main_lights
to: 'off'
- platform: state
entity_id: light.nino_bedroom_lamp
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'off'
- condition: state
entity_id: input_boolean.quiet_mode
state: 'off'
- condition: time
after: '17:00:00'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.quiet_mode
- service: script.voice_announcement
data:
media_players: auto
sound: harp-flourish
speech_message: "{{\n [\n \"Shhh...Nino is going to sleep.\",\n \"Quiet\
\ time, Nino is going to sleep!\",\n \"Pardon the interruption but Nino\
\ is going to sleep, please be quiet!\",\n \"Attention! Quiet mode has\
\ been enabled for Nino's nap.\"\n ] | random\n}}"
- id: nino_nap_time_ended
alias: Nino's nap time ended
initial_state: 'off'
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.ninos_door_sensor_status
state: 'on'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.quiet_mode
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.quiet_mode
- id: nino_nightlight_turn_off
initial_state: true
alias: Nino Nightlight - Turn Off
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'off'
for:
hours: 1
- platform: time
at: 07:00:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: light.nino_bedroom_lamp
state: 'on'
- condition: time
after: 06:00:00
action:
- service: light.turn_off
entity_id: light.nino_bedroom_lamp
- id: nino_nightlight_turn_on
initial_state: true
alias: Nino Nightlight - Turn On
trigger:
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'on'
for:
hours: 1
- platform: time
at: '22:00:00'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: light.nino_bedroom_lamp
state: 'on'
- condition: time
after: '19:00:00'
action:
- service: scene.turn_on
target:
entity_id: scene.ninos_room_nino_nightlight
- id: nino_school_day_off
alias: Nino School Day Off
mode: single
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.primary_school_day
to: 'off'
condition:
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.nino_school_day
- service: automation.turn_off
entity_id:
- automation.nino_school_pickup_reminder
- id: nino_school_day_on
alias: Nino School Day On
mode: single
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.primary_school_day
to: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.nino_school_day
- service: automation.turn_on
entity_id:
- automation.nino_school_pickup_reminder
- id: nino_school_day_reminder
alias: Nino School Day Reminder
mode: single
initial_state: false
trigger:
- platform: calendar
event: start
entity_id: calendar.ninos_school
offset: -01:30:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
- condition: template
value_template: '{{ ''reminder'' not in (trigger.calendar_event.summary | lower)
}}'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
speech_message: "{% set event = trigger.calendar_event.summary | lower %}\n\
{% if \"school day\" in event %}\n {{\n [\n \"Hey gang, it's time\
\ to eat breakfast and get ready for school\",\n \"Hey there, it's time\
\ to get the kids breakfast ready. Today is a school day!\",\n \"Just\
\ at reminder that there's school today, so it's time for breakfast.\",\n\
\ ] | random\n }}\n{% else %}\n {{\n [\n \"Hey gang, it's time\
\ to eat breakfast and get ready for \" ~ event,\n \"Hey there, it's\
\ time to get the kids breakfast ready. Today is \" ~ event,\n \"Just\
\ at reminder that there's \" ~ event ~ \" today, so it's time for breakfast.\"\
,\n ] | random\n }}\n{% endif %}"
- id: nino_school_departure_reminder
alias: Nino School Departure Reminder
mode: single
initial_state: false
trigger:
- platform: calendar
event: start
entity_id: calendar.ninos_school
offset: -00:15:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
- condition: template
value_template: '{{ ''reminder'' not in (trigger.calendar_event.summary | lower)
}}'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell
priority: high
expires_in: 5
speech_message: "{% set event = trigger.calendar_event.summary | lower %}\n\
{% if \"giggle gang\" in event %}\n {% set event_label = \"Giggle Gang\"\
\ %}\n{% elif \"little acorns\" in event %}\n {% set event_label = \"Little\
\ Acorns\" %}\n{% else %}\n {% set event_label = \"school\" %}\n{% endif\
\ %}\n{{\n [\n event_label ~ \" starts soon. Time to pack up and head\
\ out!\",\n \"Hey gang, time to start heading over to \" ~ event_label,\n\
\ \"Pack it up, pack it in, time to drop Nino at \" ~ event_label\n ]\
\ | random\n}}"
- id: nino_school_pickup_reminder
alias: Nino School Pickup Reminder
mode: single
initial_state: false
trigger:
- platform: time
at: input_datetime.primary_school_pickup_reminder
condition:
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
priority: normal
speech_message: "{{\n [\n \"School is done! Time to pick up Nino!\",\n \
\ \"Hey there! It's time to pickup Nino from school!\",\n \"Dont forget\
\ to pick up Nino from school!\",\n \"Quick reminder that school is almost\
\ over, time to pick Nino up.\" \n ] | random\n}}"
- service: script.general_notification
data:
title: Nino's school is ending soon
message: School will be over soon, it's time to pick up Nino from school.
devices: all
priority: time-sensitive
tag: nino_school_pikcup
- id: nino_school_reminder_notification
alias: Nino School Reminder Notification
mode: single
initial_state: false
trigger:
- platform: calendar
event: start
entity_id: calendar.nino_school_reminder
condition:
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
speech_message: '{{states.calendar.nino_school_reminder.attributes.message}}'
- id: nonna_announce_arrival
alias: Nonna Announce Arrival
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.mary_falbo
from: not_home
to: home
conditions:
- condition: state
entity_id: person.mary_falbo
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: nonna
announcement_type: arrival
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- action: input_boolean.turn_on
entity_id: input_boolean.guest_mode_announced
- id: nonna_announce_departure
alias: Nonna Announce Departure
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.mary_falbo
from: home
conditions:
- condition: state
entity_id: person.mary_falbo
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: nonna
announcement_type: departure
- id: nonna_bluetooth_detected_home
alias: Nonna Bluetooth Detected Home
mode: queued
initial_state: false
trigger:
- platform: template
value_template: '{{ states.sensor.mary_room_presence.state != ''not_home''}}'
action:
- service: device_tracker.see
data:
dev_id: nonna_iphone_ble_device_tracker
location_name: "{% if not is_state('sensor.mary_room_presence', 'not_home')\
\ %}\n home\n{% else %}\n not_home\n{% endif %}"
- id: nonna_is_away
alias: Nonna is Away
initial_state: true
triggers:
- trigger: state
entity_id: person.mary_falbo
to: not_home
- trigger: state
entity_id: binary_sensor.nonna_presence
to: 'off'
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.nonna_status
state: Just Left
- or:
- condition: state
entity_id: binary_sensor.nonna_presence
state: 'off'
- condition: state
entity_id: person.mary_falbo
state: 'off'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.nonna_home
- id: nonna_is_home
initial_state: true
alias: Nonna is Home
triggers:
- trigger: state
entity_id: person.mary_falbo
to: home
- trigger: state
entity_id: binary_sensor.nonna_presence
to: 'on'
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.nonna_home
state: 'off'
- or:
- condition: state
entity_id: binary_sensor.nonna_presence
state: 'on'
- condition: state
entity_id: person.mary_falbo
state: home
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.nonna_home
- id: nonna_open_garage_upon_arrival
alias: Nonna Open Garage Upon Arrival
mode: queued
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.nonna_home
to: 'on'
for:
seconds: 3
condition:
- condition: state
entity_id: person.mary_falbo
state: home
- condition: state
entity_id: input_select.nonna_status
state: Just Arrived
- condition: state
entity_id: cover.garage_doors
state: closed
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- alias: Wait for a person to be detected
wait_for_trigger:
- platform: state
entity_id: binary_sensor.garage_driveway_person_detected
to: 'on'
timeout: 00:03:00
continue_on_timeout: false
- service: cover.open_cover
entity_id: cover.garage_door_2
- alias: NWS Alerts Update Event ID History
id: nws_alerts_update_event_id_history
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.nws_alerts
action:
- delay:
minutes: 5
- repeat:
sequence:
- delay:
seconds: 5
- condition: template
value_template: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID %}\n\
\ {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list\
\ = set(ns.ids) %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None') | reject('match',\
\ 'unknown'))|list ) %} {{ (current_id_list.difference(history_id_list)|list)\
\ | count > 0 }}\n"
- service: variable.update_sensor
target:
entity_id: sensor.nws_alerts_event_ids
data:
value: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID\
\ %}\n {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list\
\ = set(ns.ids) %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None') |\
\ reject('match', 'unknown'))|list ) %} {% if (current_id_list.difference(history_id_list)|list)[0]\
\ is defined %}\n {{ (current_id_list.difference(history_id_list)|list)[0]\
\ }}\n{% endif %}\n"
- service: variable.update_sensor
target:
entity_id: sensor.nws_alerts_event_ids
data:
attributes:
history_1: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID\
\ %}\n {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list\
\ = set(ns.ids) %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {% if (current_id_list.difference(history_id_list)|list)[0]\
\ is defined %}\n {{ (current_id_list.difference(history_id_list)|list)[0]\
\ }}\n{% endif %}\n"
history_2: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_1'')
}}'
history_3: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_2'')
}}'
history_4: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_3'')
}}'
history_5: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_4'')
}}'
history_6: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_5'')
}}'
history_7: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_6'')
}}'
history_8: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_7'')
}}'
history_9: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_8'')
}}'
history_10: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_9'')
}}'
history_11: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_10'')
}}'
history_12: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_11'')
}}'
history_13: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_12'')
}}'
history_14: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_13'')
}}'
history_15: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_14'')
}}'
until:
- condition: template
value_template: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID %}\n\
\ {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list\
\ = set(ns.ids) %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None') | reject('match',\
\ 'unknown'))|list ) %} {{ (current_id_list.difference(history_id_list)|list)\
\ | count == 0}}\n"
- id: office_air_quality_detections
alias: Office Air Quality Sensor Detections
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: sensor.office_air_quality
to: Hazardous
for:
minutes: 2
- trigger: state
entity_id: sensor.office_air_quality
to: Unhealthy
for:
minutes: 3
- trigger: state
entity_id: sensor.office_air_quality
to: Moderate
for:
minutes: 5
- trigger: state
entity_id: sensor.office_air_quality
to: Acceptable
- trigger: state
entity_id: input_boolean.office_occupied
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.almost_home
state: 'on'
variables:
purifier: fan.office_air_purifier
aqi_state: '{{ states.sensor.office_air_quality.state }}'
room_state: '{{ states.input_select.office.state }}'
actions:
- action: script.air_quality_set_air_purifier_mode
data:
purifier: '{{ purifier }}'
aqi_state: '{{ aqi_state }}'
room_state: '{{ room_state }}'
- id: office_camera_light_off
initial_state: true
alias: Office Camera Light Off
trigger:
- platform: state
entity_id: binary_sensor.john_laptop_camera_active
to: 'off'
for:
seconds: 4
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: binary_sensor.johns_macbook_pro_active
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.john_laptop_camera_active
state: 'off'
- condition: state
entity_id: light.office_el_gato_light
state: 'on'
action:
- service: light.turn_off
entity_id: light.office_el_gato_light
- id: office_camera_light_on
initial_state: true
alias: Office Camera Light On
trigger:
- platform: state
entity_id: binary_sensor.john_laptop_camera_active
to: 'on'
for:
seconds: 2
- platform: state
entity_id: sensor.john_room_presence
to: office
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.john_laptop_camera_active
state: 'on'
- condition: state
entity_id: sensor.john_room_presence
state: office
- condition: state
entity_id: light.office_el_gato_light
state: 'off'
action:
- service: light.turn_on
entity_id: light.office_el_gato_light
- id: office_dnd_on
alias: Office DnD On
mode: single
trigger:
- platform: state
entity_id: input_boolean.john_dnd
to: 'on'
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
- platform: state
entity_id: sensor.john_room_presence
to: office
- platform: state
entity_id: input_boolean.office_guest_mode
to: 'on'
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.john_dnd
state: 'on'
- condition: state
entity_id: sensor.john_room_presence
state: office
- condition: state
entity_id: input_boolean.office_guest_mode
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.office_dnd
- id: office_dnd_off
alias: Office DnD Off
mode: single
trigger:
- platform: state
entity_id: input_boolean.john_dnd
to: 'off'
for:
minutes: 2
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: input_boolean.office_guest_mode
to: 'off'
for:
minutes: 2
- platform: state
entity_id: sensor.john_room_presence
from: office
condition:
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.john_dnd
state: 'off'
- condition: template
value_template: '{{ not is_state(''sensor.john_room_presence'',''office'')
}}'
- condition: state
entity_id: input_boolean.office_guest_mode
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_dnd
- id: office_dnd_light_off
initial_state: true
alias: Office DnD Light Off
trigger:
- platform: state
entity_id: input_select.office
from: DnD
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
action:
- service: light.turn_off
entity_id: light.hue_play_1
- id: office_dnd_light_on
initial_state: true
alias: Office DnD Light On
trigger:
- platform: state
entity_id: input_select.office
to: DnD
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: input_select.office
state: DnD
action:
- service: hue.hue_activate_scene
data:
group_name: Office Signal
scene_name: John DnD
- id: office_echo_dnd_off
initial_state: true
alias: Office Echo DnD Off
trigger:
- platform: state
entity_id: input_select.office
to: Auto
for:
minutes: 5
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
condition:
- condition: state
entity_id: switch.john_s_echo_dot_do_not_disturb_switch
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.john_s_echo_dot_do_not_disturb_switch
- id: office_echo_dnd_on
initial_state: true
alias: Office Echo DnD On
trigger:
- platform: state
entity_id: input_select.office
to: DnD
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: input_select.office
state: DnD
- condition: state
entity_id: binary_sensor.johns_macbook_pro_active
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.john_s_echo_dot_do_not_disturb_switch
- id: office_lighting_automation_off
initial_state: false
alias: Office Lighting Automation Off
trigger:
- platform: state
entity_id: input_select.office
to: DnD
condition:
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_lighting_automations
- id: office_lighting_automation_on
initial_state: false
alias: Office Lighting Automation On
trigger:
- platform: state
entity_id: input_select.office
from: DnD
condition:
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_lighting_automations
- id: office_lights_day_off
initial_state: true
alias: Office lights day off
trigger:
- platform: numeric_state
entity_id: sensor.office_aqara_illuminance
above: 151
for:
minutes: 10
- platform: numeric_state
entity_id: sensor.office_aqara_illuminance
above: 250
for:
minutes: 5
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
- condition: state
entity_id: input_boolean.bad_weather
state: 'off'
- condition: numeric_state
entity_id: sensor.office_aqara_illuminance
above: 151
action:
- service: light.turn_off
entity_id: group.office_lights
- service: input_boolean.turn_off
entity_id: input_boolean.office_lights_auto
- id: office_lights_day_on
initial_state: true
alias: Office lights Day On
trigger:
- platform: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 150
for:
minutes: 3
- platform: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 125
for:
minutes: 3
- platform: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 100
for:
minutes: 5
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
- platform: state
entity_id: input_boolean.office_lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 150
- condition: state
entity_id: group.office_lights
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.office
state: Auto
- condition: state
entity_id: input_select.office
state: DnD
action:
- service: light.turn_on
entity_id: group.office_lights
- service: input_boolean.turn_on
entity_id: input_boolean.office_lights_auto
- id: office_lights_motion_off
initial_state: false
alias: Office lights motion off
trigger:
- platform: state
entity_id: binary_sensor.office_aqara_motion_sensor
to: 'off'
for:
minutes: 1
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.office_presence
state: 'off'
- condition: state
entity_id: group.office_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.office_lights
- service: automation.turn_off
entity_id: automation.office_lights_motion_off
- service: input_boolean.turn_off
entity_id: input_boolean.office_lights_auto
- id: office_lights_motion_on
initial_state: true
alias: Office lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.office_aqara_motion_sensor
to: 'on'
condition:
- condition: state
entity_id: input_select.office
state: Auto
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 150
- condition: state
entity_id: group.office_lights
state: 'off'
action:
- service: light.turn_on
entity_id: group.office_lights
- service: automation.turn_on
entity_id: automation.office_lights_motion_off
- service: input_boolean.turn_on
entity_id: input_boolean.office_lights_auto
- id: office_lights_off
initial_state: true
alias: Office lights off
trigger:
- platform: state
entity_id: input_select.office
to: 'Off'
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_boolean.office_lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.office
state: 'Off'
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: numeric_state
entity_id: sensor.office_aqara_illuminance
above: 151
action:
- service: light.turn_off
entity_id: group.office_lights
- service: input_boolean.turn_off
entity_id: input_boolean.office_lights_auto
- id: office_lights_on
initial_state: true
alias: Office lights On
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
- platform: sun
event: sunset
offset: 00:15:00
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.office
state: Auto
- condition: state
entity_id: input_select.office
state: DnD
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.office_aqara_illuminance
below: 150
- condition: state
entity_id: group.office_lights
state: 'off'
action:
- service: light.turn_on
entity_id: group.office_lights
- service: input_boolean.turn_on
entity_id: input_boolean.office_lights_auto
- id: office_lights_sleep_mode_off
initial_state: false
alias: Office Lights Sleep Mode Off
trigger:
- platform: sun
event: sunrise
offset: -02:00:00
- platform: time
at: 06:00:01
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: sun
after: sunrise
- condition: time
after: 06:00:00
action:
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_office
- id: office_lights_sleep_mode_on
initial_state: false
alias: Office Lights Sleep Mode On
trigger:
- platform: sun
event: sunset
offset: 00:15:00
- platform: time
at: '20:00:01'
- platform: state
entity_id: input_boolean.dark_outside
to: 'on'
- platform: state
entity_id: input_select.office
from: DnD
to: Auto
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: time
after: '20:00:00'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
action:
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_office
- id: office_lights_manually_turned_off
initial_state: false
alias: Office Lights Manually Turned Off
trigger:
- platform: state
entity_id: group.office_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.office_lights_auto
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.office_lighting_automations
- id: office_mode_auto
initial_state: true
alias: Office Mode Auto
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.office_dnd
to: 'off'
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_boolean.office_dnd
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.office
option: Auto
- id: office_mode_dnd
initial_state: true
alias: Office Mode DnD
trigger:
- platform: state
entity_id: input_boolean.office_dnd
to: 'on'
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
- condition: state
entity_id: input_boolean.office_dnd
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.office
option: DnD
- id: office_mode_dnd_off
initial_state: false
alias: Office Mode DnD Off
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: input_boolean.john_dnd
to: 'off'
for:
minutes: 2
condition:
- condition: state
entity_id: input_select.office
state: DnD
- condition: or
conditions:
- condition: state
entity_id: input_boolean.john_dnd
state: 'off'
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.office
option: Auto
- id: office_mode_off
initial_state: true
alias: Office mode off
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_select.house
to: Away
- trigger: state
entity_id: input_select.house
to: Bedtime
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_select.house
state: Bedtime
actions:
- action: input_select.select_option
data:
entity_id: input_select.office
option: 'Off'
- id: office_music_clear_queue
initial_state: true
alias: Office Music Clear Queue
trigger:
- trigger: time
at: 01:00:00
actions:
- action: media_player.clear_playlist
target:
entity_id: media_player.sonos_office
data: {}
- id: office_music_off
initial_state: true
alias: Office Music Off
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: input_select.office
to: DnD
- platform: state
entity_id: input_select.office
to: 'Off'
- platform: state
entity_id: binary_sensor.johns_macbook_pro_active
to: 'off'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_select.office
state: DnD
- condition: and
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''office'')|map(attribute=''name'')|list | length == 0 }}'
- condition: state
entity_id: binary_sensor.office_aqara_motion_sensor
state: 'off'
for:
minutes: 3
- condition: state
entity_id: media_player.sonos_office
state: playing
action:
- service: media_player.unjoin
entity_id: media_player.sonos_main_bedroom
- service: media_player.media_pause
entity_id: media_player.sonos_office
- service: input_boolean.turn_on
entity_id: input_boolean.office_music_playing
- id: office_music_on
initial_state: false
alias: Office Music On
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
for:
minutes: 3
seconds: 10
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: sensor.john_room_presence
state: office
- condition: state
entity_id: media_player.sonos_office
state:
- paused
- idle
- 'off'
- condition: time
after: 08:01:00
before: '22:00:00'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
- condition: state
entity_id: binary_sensor.johns_macbook_pro_active
state: 'on'
action:
- service: sonos.play_queue
entity_id: media_player.sonos_office
- service: input_boolean.turn_off
entity_id: input_boolean.office_music_playing
- id: office_music_resume
initial_state: true
alias: Office music resume
triggers:
- trigger: state
entity_id: input_boolean.office_occupied
to: 'on'
for:
minutes: 3
seconds: 10
id: office_occupied
- trigger: state
entity_id: input_select.office
from: DnD
for:
minutes: 2
id: dnd_off
- trigger: state
entity_id: binary_sensor.johns_macbook_pro_active
to: 'on'
for:
minutes: 2
id: laptop_active
- trigger: state
entity_id: input_select.john_focus_mode
id: focus_changed
conditions:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: sensor.john_room_presence
state: office
- condition: or
conditions:
- condition: trigger
id: focus_changed
- condition: state
entity_id: media_player.sonos_office
state:
- paused
- idle
- 'off'
- condition: time
after: 08:01:00
before: '23:45:00'
- condition: template
value_template: '{{ not is_state(''input_select.office'',''DnD'') }}'
- condition: state
entity_id: binary_sensor.johns_macbook_pro_active
state: 'on'
action:
- action: sonos.get_queue
target:
entity_id: media_player.sonos_office
response_variable: queue_items
- choose:
- conditions:
- condition: or
conditions:
- condition: trigger
id: focus_changed
- condition: template
value_template: '{{ queue_items[''media_player.sonos_office''] | length
== 0 }}'
sequence:
- variables:
playlists: '{{ states(''sensor.john_focus_mode_playlist'') }}'
- if:
- condition: template
value_template: '{{ playlists is sequence }}'
then:
- repeat:
sequence:
- variables:
media_content_type: "{% if repeat.item | contains('playlist') %}\n\
\ playlist\n{% else %}\n music\n{% endif %}"
enqueue_mode: "{% if repeat.index == 1 %}\n replace\n{% else %}\n\
\ add\n{% endif %}"
- action: media_player.play_media
target:
entity_id: media_player.sonos_office
data:
media_content_type: '{{ media_content_type }}'
media_content_id: '{{ repeat.item }}'
enqueue: '{{ enqueue_mode }}'
for_each: '{{ playlists }}'
- action: media_player.shuffle_set
target:
entity_id: media_player.sonos_office
data:
shuffle: true
default:
- if:
- condition: state
entity_id: media_player.sonos_office
state: paused
then:
- action: media_player.media_play
entity_id: media_player.sonos_office
else:
- action: sonos.play_queue
entity_id: media_player.sonos_office
- action: input_boolean.turn_off
entity_id: input_boolean.office_music_playing
- id: office_not_occupied
initial_state: true
alias: Office not occupied
trigger:
- platform: state
entity_id: binary_sensor.office_presence
to: 'off'
for:
minutes: 2
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''office'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.office_aqara_motion_sensor
to: 'off'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.office_aqara_occupancy
to: 'off'
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.office_presence
state: 'off'
- condition: state
entity_id: input_boolean.office_guest_mode
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.office_lighting_automations
- id: office_occupied
initial_state: true
alias: Office occupied
trigger:
- platform: state
entity_id: binary_sensor.office_presence
to: 'on'
- platform: state
entity_id: binary_sensor.office_aqara_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.office_aqara_motion_sensor
to: 'on'
- platform: state
entity_id: group.office_lights
to: 'on'
- platform: state
entity_id: input_boolean.office_guest_mode
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.office_aqara_motion_sensor
state: 'on'
- condition: state
entity_id: binary_sensor.office_presence
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.office_occupied
- id: office_speech_notifications_off
initial_state: true
alias: Office Speech Notifications Off
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'off'
- platform: state
entity_id: input_select.office
to: DnD
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_select.office
state: DnD
action:
- service: input_boolean.turn_off
entity_id: input_boolean.office_speech_notifications
- id: office_speech_notifications_on
initial_state: true
alias: Office Speech Notifications On
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
- platform: state
entity_id: input_select.office
from: DnD
for:
minutes: 2
condition:
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
- condition: state
entity_id: input_select.office
state: Auto
action:
- service: input_boolean.turn_on
entity_id: input_boolean.office_speech_notifications
- id: office_treadmill_off
alias: Office - Treadmill Off
mode: single
initial_state: false
trigger:
- platform: time
at: 00:00:01
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id: switch.smart_plug_11_switch
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.smart_plug_11_switch
- id: office_treadmill_on
alias: Office - Treadmill On
mode: single
initial_state: false
trigger:
- platform: state
entity_id: input_boolean.office_occupied
to: 'on'
condition:
- condition: state
entity_id: switch.smart_plug_11_switch
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.smart_plug_11_switch
- id: office_turn_off_purifier
alias: Office Air Quality - Turn off Purifier
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
actions:
- action: fan.turn_off
target:
entity_id: fan.office_air_purifier
- id: turn_on_exterior_lights
alias: Turn On Exterior Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_house_lights
to: 'on'
action:
- service: light.turn_on
entity_id: light.exterior_lights
- id: turn_off_exterior_lights
alias: Turn Off Exterior Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_house_lights
to: 'off'
action:
- service: light.turn_off
entity_id: light.exterior_lights
- id: turn_on_exterior_flood_lights
alias: Turn On Exterior Flood Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_flood_lights
to: 'on'
action:
- service: light.turn_on
entity_id: light.exterior_flood_lights
- id: turn_off_exterior_flood_lights
alias: Turn Off Exterior Flood Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_flood_lights
to: 'off'
action:
- service: light.turn_off
entity_id: light.exterior_flood_lights
- id: turn_on_exterior_accent_lights
alias: Turn On Exterior Accent Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_accent_lights
to: 'on'
action:
- service: light.turn_on
entity_id: light.exterior_accent_lights
- id: turn_off_exterior_accent_lights
alias: Turn Off Exterior Accent Lights
mode: single
trigger:
- platform: state
entity_id: input_boolean.exterior_accent_lights
to: 'off'
action:
- service: light.turn_off
entity_id: light.exterior_accent_lights
- id: activate_exterior_lighting_at_sunset
alias: Activate Exterior Lighting at Sunset
mode: single
trigger:
- platform: sun
event: sunset
offset: 00:15:00
- platform: state
entity_id: input_boolean.dark_outside
to: 'on'
- platform: numeric_state
entity_id: sensor.sun_elevation
below: 4
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'off'
- condition: state
entity_id: input_boolean.exterior_flood_lights
state: 'off'
- condition: state
entity_id: input_boolean.exterior_accent_lights
state: 'off'
- condition: or
conditions:
- condition: sun
after: sunset
- condition: numeric_state
entity_id: sensor.sun_elevation
below: 5
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.exterior_house_lights
- service: input_boolean.turn_on
entity_id: input_boolean.exterior_flood_lights
- service: input_boolean.turn_on
entity_id: input_boolean.exterior_accent_lights
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: The sun has set so I'm turning on the exterior lights.
- id: activate_exterior_lighting_due_to_weather
alias: Activate Exterior Lighting Due to Weather
mode: single
trigger:
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
for:
minutes: 5
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
for:
minutes: 15
- platform: numeric_state
entity_id: sensor.tempest_illuminance
below: 38
for:
minutes: 5
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'off'
- condition: not
conditions:
- condition: sun
after: sunset
after_offset: -00:10:00
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bad_weather
state: 'on'
- condition: numeric_state
entity_id: sensor.tempest_illuminance
below: 45
- condition: numeric_state
entity_id: sensor.tempest_illuminance
below: 35
action:
- service: input_boolean.turn_on
entity_id: input_boolean.exterior_house_lights
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: The weather is looking a little dark, I'm turning on the exterior
lights.
- id: deactivate_exterior_lighting_at_sunrise
alias: Deactivate Exterior Lighting at Sunrise
mode: single
trigger:
- platform: sun
event: sunrise
- platform: state
entity_id: input_boolean.dark_outside
to: 'off'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'on'
- condition: or
conditions:
- condition: sun
after: sunrise
before: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'off'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.exterior_house_lights
- service: input_boolean.turn_off
entity_id: input_boolean.exterior_flood_lights
- service: input_boolean.turn_off
entity_id: input_boolean.exterior_accent_lights
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: The sun is up so I'm turning off the exterior lights.
- id: deactivate_exterior_lighting_due_to_weather
alias: Deactivate Exterior Lighting Due to Weather
mode: single
trigger:
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
for:
minutes: 5
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
for:
minutes: 15
- platform: numeric_state
entity_id: sensor.tempest_illuminance
above: 150
for:
minutes: 3
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'on'
- condition: numeric_state
entity_id: sensor.tempest_illuminance
above: 50
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: or
conditions:
- condition: state
entity_id: input_boolean.bad_weather
state: 'off'
- condition: numeric_state
entity_id: sensor.tempest_illuminance
above: 150
action:
- service: input_boolean.turn_off
entity_id: input_boolean.exterior_house_lights
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: The weather has improved so I'm turning off the exterior lights.
- id: deactivate_accent_lighting_at_bedtime
alias: Deactivate Exterior Accent Lighting at Bedtime
mode: single
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id: input_boolean.exterior_accent_lights
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.exterior_accent_lights
- id: garage_lights_accidentally_turned_off_fix
alias: Garage Lights Accidentally Turned Off Fix
mode: single
trigger:
- platform: state
entity_id: light.exterior_garage_sconces
to: 'off'
condition:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'on'
action:
- service: light.turn_on
entity_id: light.exterior_garage_sconces
- id: garage_lights_accidentally_turned_on_fix
alias: Garage Lights Accidentally Turned On Fix
mode: single
trigger:
- platform: state
entity_id: light.exterior_garage_sconces
to: 'on'
condition:
- condition: state
entity_id: input_boolean.exterior_house_lights
state: 'off'
action:
- service: light.turn_off
entity_id: light.exterior_garage_sconces
- id: house_occupied
alias: House occupied
initial_state: 'on'
triggers:
- trigger: state
entity_id:
- sensor.john_person
- sensor.cristina_person
- sensor.nonna_person
- sensor.tayta_person
- sensor.jido_person
- sensor.katia_person
- sensor.joe_person
- sensor.sylvia_person
- sensor.alex_person
to: home
- trigger: event
event_type: automation_reloaded
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: template
value_template: '{{ state_attr(trigger.entity_id, ''unlock_privilege'') == "on"
}}
'
- condition: state
entity_id: group.all_people
state: home
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.house_occupied
- id: people_reloaded_when_just_arrived
alias: People reloaded when just arrived
initial_state: 'on'
trigger:
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
action:
- choose:
conditions:
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Just Arrived
sequence:
- service: input_select.select_option
data:
entity_id: input_select.cristina_status_dropdown
option: Home
- choose:
conditions:
- condition: state
entity_id: input_select.john_status
state: Just Arrived
sequence:
- service: input_select.select_option
data:
entity_id: input_select.john_status
option: Home
- choose:
conditions:
- condition: state
entity_id: input_select.joe_status_dropdown
state: Just Arrived
sequence:
- service: input_select.select_option
data:
entity_id: input_select.joe_status_dropdown
option: Home
- id: people_reloaded_when_just_left
alias: People reloaded when just left
initial_state: 'on'
trigger:
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
action:
- choose:
conditions:
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Just Left
sequence:
- service: input_select.select_option
data:
entity_id: input_select.cristina_falbo_status_dropdown
option: Away
- choose:
conditions:
- condition: state
entity_id: input_select.john_status
state: Just Left
sequence:
- service: input_select.select_option
data:
entity_id: input_select.john_status
option: Away
- choose:
conditions:
- condition: state
entity_id: input_select.joe_status_dropdown
state: Just Left
sequence:
- service: input_select.select_option
data:
entity_id: input_select.joe_status_dropdown
option: Away
- id: people_status_arrived
alias: Mark person as just arrived
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id:
- input_boolean.john_home
- input_boolean.cristina_home
- input_boolean.joe_home
- input_boolean.nonna_home
- input_boolean.katia_home
- input_boolean.sylvia_home
to: 'on'
action:
- service: input_select.select_option
data:
entity_id: "{% if trigger.entity_id == 'input_boolean.john_home' %}\n input_select.john_status\n\
{% elif trigger.entity_id == 'input_boolean.cristina_home' %}\n input_select.cristina_status_dropdown\n\
{% elif trigger.entity_id == 'input_boolean.joe_home' %}\n input_select.joe_status_dropdown\n\
{% elif trigger.entity_id == 'input_boolean.nonna_home' %}\n input_select.nonna_status\n\
{% elif trigger.entity_id == 'input_boolean.katia_home' %}\n input_select.katia_status\n\
{% elif trigger.entity_id == 'input_boolean.sylvia_home' %}\n input_select.sylvia_status\n\
{% endif %}\n"
option: "{% if trigger.entity_id == 'input_boolean.cristina_home' %}\n {% if\
\ states.input_select.cristina_status_dropdown.state == 'Just Left' %}\n \
\ Home\n {% else %}\n Just Arrived\n {% endif %}\n{% elif trigger.entity_id\
\ == 'input_boolean.john_home' %}\n {% if states.input_select.john_status.state\
\ == 'Just Left' %}\n Home\n {% else %}\n Just Arrived\n {% endif\
\ %}\n{% elif trigger.entity_id == 'input_boolean.joe_home' %}\n {% if states.input_select.joe_status_dropdown.state\
\ == 'Just Left' %}\n Home\n {% else %}\n Just Arrived\n {% endif\
\ %}\n{% elif trigger.entity_id == 'input_boolean.nonna_home' %}\n {% if\
\ states.input_select.nonna_status.state == 'Just Left' %}\n Home\n {%\
\ else %}\n Just Arrived\n {% endif %}\n{% elif trigger.entity_id == 'input_boolean.katia_home'\
\ %}\n {% if states.input_select.katia_status.state == 'Just Left' %}\n \
\ Home\n {% else %}\n Just Arrived\n {% endif %}\n{% elif trigger.entity_id\
\ == 'input_boolean.sylvia_home' %}\n {% if states.input_select.sylvia_status.state\
\ == 'Just Left' %}\n Home\n {% else %}\n Just Arrived\n {% endif\
\ %}\n{% endif %}\n"
- id: people_status_away
alias: Mark person as away
mode: parallel
initial_state: 'on'
triggers:
- trigger: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
- input_select.joe_status_dropdown
- input_select.nonna_status
- input_select.katia_status
- input_select.sylvia_status
to: Just Left
for:
minutes: 5
actions:
- action: input_select.select_option
data:
entity_id: "{% if trigger.entity_id == 'input_select.cristina_status_dropdown'\
\ %}\n input_select.cristina_status_dropdown\n{% elif trigger.entity_id ==\
\ 'input_select.john_status' %}\n input_select.john_status\n{% elif trigger.entity_id\
\ == 'input_select.joe_status_dropdown' %}\n input_select.joe_status_dropdown\n\
{% elif trigger.entity_id == 'input_select.nonna_status' %}\n input_select.nonna_status\n\
{% elif trigger.entity_id == 'input_select.katia_status' %}\n input_select.katia_status\n\
{% elif trigger.entity_id == 'input_select.sylvia_status' %}\n input_select.sylvia_status\n\
{% endif %}\n"
option: Away
- id: people_status_extended_away
alias: Mark person as extended away
mode: parallel
initial_state: 'on'
triggers:
- trigger: state
entity_id: input_select.john_status
to: Away
for:
hours: 24
- trigger: state
entity_id: input_select.cristina_status_dropdown
to: Away
for:
hours: 24
actions:
- action: input_select.select_option
data_template:
entity_id: "{% if trigger.entity_id == 'input_select.john_status' %}\n input_select.john_status\n\
{% elif trigger.entity_id == 'input_select.cristina_status_dropdown' %}\n\
\ input_select.cristina_status_dropdown\n{% endif %}\n"
option: Extended Away
- id: people_status_home
alias: Mark person as home
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
- input_select.joe_status_dropdown
- input_select.nonna_status
- input_select.katia_status
- input_select.sylvia_status
to: Just Arrived
for:
minutes: 5
- platform: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
- input_select.joe_status_dropdown
- input_select.nonna_status
- input_select.katia_status
from: Just Left
to: Just Arrived
action:
- service: input_select.select_option
data:
entity_id: "{% if trigger.entity_id == 'input_select.cristina_status_dropdown'\
\ %}\n input_select.cristina_status_dropdown\n{% elif trigger.entity_id ==\
\ 'input_select.john_status' %}\n input_select.john_status\n{% elif trigger.entity_id\
\ == 'input_select.joe_status_dropdown' %}\n input_select.joe_status_dropdown\n\
{% elif trigger.entity_id == 'input_select.nonna_status' %}\n input_select.nonna_status\n\
{% elif trigger.entity_id == 'input_select.katia_status' %}\n input_select.katia_status\n\
{% elif trigger.entity_id == 'input_select.sylvia_status' %}\n input_select.sylvia_status\n\
{% endif %}\n"
option: Home
- id: people_status_left
alias: Mark person as just left
mode: parallel
initial_state: 'on'
trigger:
- platform: state
entity_id:
- input_boolean.cristina_home
- input_boolean.john_home
- input_boolean.joe_home
- input_boolean.nonna_home
- input_boolean.katia_home
- input_boolean.sylvia_home
to: 'off'
action:
- service: input_select.select_option
data:
entity_id: "{% if trigger.entity_id == 'input_boolean.cristina_home' %}\n input_select.cristina_status_dropdown\n\
{% elif trigger.entity_id == 'input_boolean.john_home' %}\n input_select.john_status\n\
{% elif trigger.entity_id == 'input_boolean.joe_home' %}\n input_select.joe_status_dropdown\n\
{% elif trigger.entity_id == 'input_boolean.nonna_home' %}\n input_select.nonna_status\n\
{% elif trigger.entity_id == 'input_boolean.katia_home' %}\n input_select.katia_status\n\
{% elif trigger.entity_id == 'input_boolean.sylvia_home' %}\n input_select.sylvia_status\n\
{% endif %}\n"
option: Just Left
- id: cristina_phone_plugged_in
alias: Cristina's phone is plugged in
mode: single
trigger:
- platform: state
entity_id: sensor.cfalb2_battery_level
to: Charging
- platform: state
entity_id: sensor.cfalb2_battery_level
to: Full
condition:
- condition: state
entity_id: input_boolean.cristina_phone_plugged_in
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: sensor.cfalb2_battery_level
state: Charging
- condition: state
entity_id: sensor.cfalb2_battery_level
state: Full
action:
- service: input_boolean.turn_on
entity_id: input_boolean.cristina_phone_plugged_in
- id: cristina_phone_unplugged
alias: Cristina's phone is unplugged
mode: single
trigger:
- platform: state
entity_id: sensor.cfalb2_battery_level
to: Not Charging
condition:
- condition: state
entity_id: sensor.cfalb2_battery_level
state: Not Charging
action:
- service: input_boolean.turn_off
entity_id: input_boolean.cristina_phone_plugged_in
- id: john_phone_plugged_in
alias: John's phone is plugged in
mode: single
trigger:
- platform: state
entity_id: sensor.jk_iphone_14_battery_state
to: Charging
- platform: state
entity_id: sensor.jk_iphone_14_battery_state
to: Full
condition:
- condition: state
entity_id: input_boolean.john_phone_plugged_in
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: sensor.jk_iphone_14_battery_state
state: Charging
- condition: state
entity_id: sensor.jk_iphone_14_battery_state
state: Full
action:
- service: input_boolean.turn_on
entity_id: input_boolean.john_phone_plugged_in
- id: john_phone_unplugged
alias: John's phone is unplugged
mode: single
trigger:
- platform: state
entity_id: sensor.jk_iphone_14_battery_state
to: Not Charging
condition:
- condition: state
entity_id: sensor.jk_iphone_14_battery_state
state: Not Charging
action:
- service: input_boolean.turn_off
entity_id: input_boolean.john_phone_plugged_in
- id: playroom_activate_party_time
initial_state: true
alias: Playroom - Activate Party Time
mode: single
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
device_id: cd626e869b9ddd77c680a7c1b1bd9bfc
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'on'
action:
- if:
- alias: Party mode is already enabled
condition: state
entity_id: input_boolean.playroom_party_time_boolean
state: 'on'
then:
- alias: Skip to the next track
service: media_player.media_next_track
target:
entity_id: media_player.sonos_playroom
else:
- service: media_player.play_media
target:
entity_id: media_player.sonos_playroom
data:
media_content_type: playlist
media_content_id: spotify:playlist:0DSw040Fn3W2uodatu4Fdn
extra:
volume: 60
- service: scene.turn_on
target:
entity_id: scene.playroom_osaka
- service: input_boolean.turn_on
target:
entity_id: input_boolean.playroom_party_time_boolean
- service: script.general_notification
data:
title: Playroom Party Time
message: Playroom party time has been turned on!
devices: jk
priority: time-sensitive
tag: playroom-party-time
- id: playroom_deactivate_party_time
initial_state: true
alias: Playroom - Deactivate Party Time
mode: single
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
device_id: cd626e869b9ddd77c680a7c1b1bd9bfc
value: KeyReleased
condition:
- condition: state
entity_id: input_boolean.playroom_party_time_boolean
state: 'on'
action:
- service: media_player.media_pause
entity_id: media_player.sonos_playroom
- service: scene.turn_off
target:
entity_id: scene.playroom_osaka
- service: input_boolean.turn_on
target:
entity_id: input_boolean.playroom_party_time_boolean
- service: script.general_notification
data:
title: Playroom Party Time Off
message: Playroom party time has been turned OFF!
devices: jk
priority: time-sensitive
tag: playroom-party-time
- id: playroom_lights_day_off
initial_state: true
alias: Playroom lights day off
trigger:
- platform: numeric_state
entity_id:
- sensor.playroom_motion_sensor_illuminance
- sensor.playroom_entry_motion_sensor_illuminance
above: 115
for:
minutes: 3
- platform: state
entity_id: input_boolean.bad_weather
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.playroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_select.playroom
state: Auto
- condition: state
entity_id: input_boolean.bad_weather
state: 'off'
- condition: state
entity_id: input_boolean.playroom_lights_auto
state: 'on'
- condition: state
entity_id: sun.sun
state: above_horizon
- condition: numeric_state
entity_id:
- sensor.playroom_motion_sensor_illuminance
- sensor.playroom_entry_motion_sensor_illuminance
above: 115
- condition: state
entity_id: light.playroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.playroom_lights
- id: playroom_lights_day_on
initial_state: true
alias: Playroom lights Day On
trigger:
- platform: numeric_state
entity_id:
- sensor.playroom_motion_sensor_illuminance
- sensor.playroom_entry_motion_sensor_illuminance
below: 100
for:
minutes: 5
- platform: numeric_state
entity_id:
- sensor.playroom_motion_sensor_illuminance
- sensor.playroom_entry_motion_sensor_illuminance
below: 75
for:
minutes: 2
- platform: numeric_state
entity_id:
- sensor.playroom_motion_sensor_illuminance
- sensor.playroom_entry_motion_sensor_illuminance
below: 25
for:
minutes: 1
- platform: state
entity_id: input_boolean.bad_weather
to: 'on'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
- platform: state
entity_id: input_boolean.playroom_lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.playroom_lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'on'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.playroom_entry_motion_sensor_illuminance
below: 100
- condition: numeric_state
entity_id: sensor.playroom_motion_sensor_illuminance
below: 100
- condition: state
entity_id: group.playroom_lights
state: 'off'
- condition: state
entity_id: input_select.playroom
state: Auto
action:
- service: light.turn_on
entity_id: group.playroom_lights
- id: playroom_lights_motion_off
initial_state: false
alias: Playroom lights motion off
trigger:
- platform: state
entity_id: binary_sensor.playroom_motion
to: 'off'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.playroom_occupancy
to: 'off'
condition:
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: state
entity_id: group.playroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.playroom_lights
- service: automation.turn_off
entity_id: automation.playroom_lights_motion_off
- id: playroom_lights_motion_on
initial_state: true
alias: Playroom lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.playroom_entry_motion_sensor_motion
to: 'on'
condition:
- condition: state
entity_id: input_select.playroom
state: Auto
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.playroom_lighting_automations
state: 'on'
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.playroom_entry_motion_sensor_illuminance
below: 75
- condition: numeric_state
entity_id: sensor.playroom_motion_sensor_illuminance
below: 75
- condition: state
entity_id: group.playroom_lights
state: 'off'
action:
- service: light.turn_on
entity_id: group.playroom_lights
- service: input_boolean.turn_on
entity_id: input_boolean.playroom_lights_auto
- id: playroom_lights_off
initial_state: false
alias: Playroom lights off
trigger:
- trigger: state
entity_id: input_select.playroom
to: 'Off'
- trigger: state
entity_id: input_boolean.playroom_occupied
to: 'off'
- trigger: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.playroom
state: 'Off'
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
action:
- action: light.turn_off
entity_id: group.playroom_lights
- if:
- condition: state
entity_id: switch.christmas_playroom_lights
state: 'on'
then:
- action: switch.turn_off
entity_id: swtich.christmas_playroom_lights
- id: playroom_lights_to_off
initial_state: true
alias: Playroom Lights to Off
trigger:
- platform: state
entity_id: input_select.playroom
to: 'Off'
- platform: state
entity_id: input_boolean.playroom_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.playroom_lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.playroom
state: 'Off'
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: state
entity_id: light.playroom_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.playroom_lights
- service: input_boolean.turn_off
entity_id: input_boolean.playroom_lights_auto
- id: playroom_lights_manually_turned_off
initial_state: true
alias: Playroom Lights Manually Turned Off
trigger:
- platform: state
entity_id: light.playroom_lights
to: 'off'
condition:
- condition: state
entity_id: input_boolean.playroom_lights_auto
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.context.parent_id == none }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.playroom_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.playroom_lighting_automations
- service: script.general_notification
data:
title: Playroom Lights
message: The playroom lights have been turned off. The parent id is {{trigger.to_state.context.parent_id}}
and the user_id is {{trigger.to_state.context.user_id}}.
devices: jk
priority: passive
tag: playroom-lighting-automation
- id: playroom_media_player_unjoin
initial_state: true
alias: Playroom Media Player Unjoin
trigger:
- platform: state
entity_id: input_boolean.playroom_occupied
to: 'off'
- platform: state
entity_id: input_select.playroom
to: 'Off'
- platform: state
entity_id: media_player.sonos_playroom
to: paused
for:
minutes: 10
- platform: state
entity_id: media_player.sonos_playroom
to: paused
for:
minutes: 30
condition:
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''playroom'')|map(attribute=''name'')|list | length == 0 }}'
- condition: state
entity_id: media_player.sonos_playroom
state: paused
- condition: template
value_template: '{{ states.media_player.sonos_playroom.attributes.group_members
| count > 1 }}'
action:
- service: media_player.unjoin
entity_id: media_player.sonos_playroom
- id: playroom_mode_auto
initial_state: true
alias: Playroom mode auto
trigger:
- platform: state
entity_id: input_boolean.playroom_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.playroom'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.playroom
option: Auto
- id: playroom_mode_off
initial_state: true
alias: Playroom mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.playroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.playroom
option: 'Off'
- id: playroom_music_off
initial_state: true
alias: Playroom Music Off
trigger:
- platform: state
entity_id: input_boolean.playroom_occupied
to: 'off'
- platform: state
entity_id: input_select.playroom
to: 'Off'
condition:
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''playroom'')|map(attribute=''name'')|list | length == 0 }}'
- condition: state
entity_id: media_player.sonos_playroom
state: playing
action:
- service: media_player.unjoin
entity_id: media_player.sonos_playroom
- service: media_player.media_pause
entity_id: media_player.sonos_playroom
- id: playroom_not_occupied
initial_state: true
alias: Playroom not occupied
trigger:
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''playroom'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.playroom_occupancy
to: 'off'
- platform: state
entity_id: binary_sensor.playroom_occupancy
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.playroom_occupancy
to: 'off'
for:
minutes: 10
- platform: state
entity_id: binary_sensor.playroom_motion
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.playroom_presence_sensor
to: 'off'
condition:
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.playroom_entry_motion_sensor_motion
state: 'off'
- condition: state
entity_id: binary_sensor.playroom_presence_sensor
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''playroom'')|map(attribute=''name'')|list | length == 0 }}'
- condition: state
entity_id: binary_sensor.playroom_motion
state: 'off'
for:
minutes: 10
action:
- service: input_boolean.turn_off
entity_id: input_boolean.playroom_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.playroom_lighting_automations
- id: playroom_occupied
initial_state: true
alias: Playroom occupied
trigger:
- platform: state
entity_id: binary_sensor.playroom_entry_motion_sensor_motion
to: 'on'
- platform: state
entity_id: group.playroom_lights
to: 'on'
- platform: state
entity_id: binary_sensor.playroom_presence_sensor
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.playroom_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''playroom'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: binary_sensor.playroom_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.playroom_motion
state: 'on'
- condition: state
entity_id: binary_sensor.playroom_presence_sensor
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.playroom_occupied
- id: pool_mode_auto
initial_state: true
alias: Pool Mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.pool'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.pool
option: Auto
- id: pool_mode_off
initial_state: true
alias: Pool Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.pool'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.pool
option: 'Off'
- id: pool_motion_restart_timer
initial_state: true
alias: Pool Motion - Restart Timer
mode: single
trigger:
- platform: state
entity_id:
- binary_sensor.pool_motion_east_entry_occupancy
- binary_sensor.pool_motion_west_occupancy
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.pool
state: Auto
action:
- service: timer.start
entity_id: timer.pool_occupancy
- id: pool_not_occupied
initial_state: true
alias: Pool Not Occupied
trigger:
- platform: state
entity_id: timer.pool_occupancy
to: idle
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''gazebo'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 2
- platform: state
entity_id: binary_sensor.pool_main_gate_opening
to: 'off'
condition:
- condition: state
entity_id: input_boolean.pool_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.pool_motion_sensor_status
state: 'off'
- condition: state
entity_id: timer.pool_occupancy
state: idle
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''gazebo'')|map(attribute=''name'')|list | length == 0 }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.pool_occupied
- id: pool_occupied
initial_state: true
alias: Pool Occupied
trigger:
- platform: state
entity_id: binary_sensor.pool_motion_sensor_status
to: 'on'
- platform: state
entity_id: binary_sensor.pool_main_gate_opening
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.pool_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''gazebo'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: timer.pool_occupancy
state: active
action:
- service: input_boolean.turn_on
entity_id: input_boolean.pool_occupied
- id: powder_room_fan_off
initial_state: true
alias: Powder Room Fan Off
trigger:
- platform: state
entity_id: input_select.powder_room
to: 'Off'
- platform: state
entity_id: input_boolean.powder_room_occupied
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: fan.powder_room_fan
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.powder_room
state: 'Off'
- condition: state
entity_id: input_boolean.powder_room_occupied
state: 'off'
action:
- service: fan.turn_off
entity_id: fan.powder_room_fan
- id: powder_room_lights_off
initial_state: true
alias: Powder Room lights off
trigger:
- platform: state
entity_id: input_select.powder_room
to: 'Off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.powder_room_main_lights
state: 'on'
- condition: state
entity_id: input_select.powder_room
state: 'Off'
action:
- service: light.turn_off
entity_id: light.powder_room_main_lights
- id: powder_room_mode_auto
initial_state: true
alias: Powder Room mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.powder_room'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.powder_room
option: Auto
- id: powder_room_mode_off
initial_state: true
alias: Powder Room mode off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.powder_room'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.house
state: Away
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.powder_room
option: 'Off'
- id: powder_room_not_occupied
initial_state: true
alias: Powder Room Not Occupied
trigger:
- platform: state
entity_id: binary_sensor.powder_room_door
to: 'on'
- platform: state
entity_id: binary_sensor.powder_room_door
to: 'on'
for:
minutes: 5
- platform: state
entity_id: light.powder_room_main_lights
to: 'off'
- platform: state
entity_id: light.powder_room_main_lights
to: 'off'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.powder_room_occupied
state: 'on'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.powder_room_door
state: 'on'
- condition: state
entity_id: light.powder_room_main_lights
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.powder_room_door
state: 'on'
for:
minutes: 5
- condition: state
entity_id: light.powder_room_main_lights
state: 'on'
for:
minutes: 5
action:
- service: input_boolean.turn_off
entity_id: input_boolean.powder_room_occupied
- id: powder_room_occupied
initial_state: true
alias: Powder Room Occupied
trigger:
- platform: state
entity_id: binary_sensor.powder_room_door
to: 'off'
- platform: state
entity_id: light.powder_room_main_lights
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.powder_room_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.powder_room_door
state: 'off'
- condition: state
entity_id: light.powder_room_main_lights
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.powder_room_occupied
- id: primary_school_day_off
alias: Primary School Day Off
mode: single
initial_state: false
trigger:
- platform: time
at: '23:59:00'
condition:
- condition: state
entity_id: input_boolean.primary_school_day
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.primary_school_day
- service: automation.turn_on
entity_id:
- automation.school_day_reminder
- if:
- condition: time
weekday:
- wed
- condition: state
entity_id: input_boolean.district_late_start_wednesday
state: 'on'
then:
- service: input_boolean.turn_off
entity_id: input_boolean.district_late_start_wednesday
- id: primary_school_day_on
alias: Primary School Day On
mode: single
initial_state: false
trigger:
- platform: time
at: 02:00:01
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.district_school_year_active
state: 'on'
- condition: state
entity_id: binary_sensor.school_day
state: 'on'
- condition: state
entity_id: binary_sensor.primary_school_closed
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.primary_school_day
- service: automation.turn_on
entity_id:
- automation.school_day_reminder
- if:
- condition: time
weekday:
- wed
then:
- service: input_boolean.turn_on
entity_id: input_boolean.district_late_start_wednesday
- id: announcement_queue_processor
alias: Announcement Queue - Processor
mode: single
initial_state: true
trigger:
- trigger: state
entity_id: sensor.announcement_queue
- trigger: state
entity_id: input_boolean.announcement_queue_running
to: 'off'
- trigger: mqtt
topic: home/announcement_queue/state
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{% set q = state_attr(''sensor.announcement_queue'', ''queue'')
%} {{ q is iterable and q | length > 0 }}
'
- condition: state
entity_id: input_boolean.announcement_queue_running
state: 'off'
- condition: template
value_template: "{% set q = state_attr('sensor.announcement_queue', 'queue') %}\
\ {% if q is iterable and q | length > 0 %}\n {% set next_msg = q[0] %}\n \
\ {% if next_msg.priority == 'critical' %}\n true\n {% else %}\n {{ states('binary_sensor.announceable_rooms_occupied')\
\ == 'on' }}\n {% endif %}\n{% else %}\n false\n{% endif %}\n"
action:
- action: input_boolean.turn_on
entity_id: input_boolean.announcement_queue_running
- variables:
raw_queue: '{{ state_attr(''sensor.announcement_queue'', ''queue'') }}'
queue: "{% if raw_queue is iterable %}\n {# Filter out expired messages and\
\ apply priority rules #}\n {% set now_iso = now().isoformat() %}\n {% set\
\ valid_msgs = namespace(list=[]) %}\n {% for msg in raw_queue %}\n {%\
\ if msg is mapping %}\n {% set expires_at = msg.get('expires_at') %}\n\
\ {% set priority = msg.get('priority', 'normal') %}\n {# Keep message\
\ if not expired - we process all priorities when occupied #}\n {% if\
\ not expires_at or expires_at > now_iso %}\n {% set valid_msgs.list\
\ = valid_msgs.list + [msg] %}\n {% endif %}\n {% endif %}\n {% endfor\
\ %}\n {{ valid_msgs.list }}\n{% else %}\n [] \n{% endif %}"
next: '{{ queue[0] if queue | length > 0 else {} }}'
updated: '{{ queue[1:] if queue | length > 1 else [] }}'
payload_json: '{{ {"queue": updated} | to_json }}'
- choose:
- conditions:
- condition: template
value_template: '{{ queue | length > 0 and (next.get(''speech_message'') is
string or next.get(''sound_file'') is string) }}'
sequence:
- alias: Broadcast the announcement
continue_on_error: true
action: script.announcement_engine
data:
speech_message: '{{ next.speech_message }}'
sound_file: '{{ next.sound_file }}'
sound_length: '{{ next.sound_length }}'
sound_volume: '{{ next.sound_volume }}'
speech_volume: '{{ next.speech_volume }}'
media_players: '{{ next.media_players }}'
- action: mqtt.publish
data:
topic: home/announcement_queue/data
payload: '{{ payload_json }}'
retain: true
- action: mqtt.publish
data:
topic: home/announcement_queue/state
payload: queue
retain: true
- delay: 00:00:03
- action: input_boolean.turn_off
entity_id: input_boolean.announcement_queue_running
- id: announcement_queue_cleanup
alias: Announcement Queue - Cleanup on Empty House
mode: single
trigger:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
action:
- variables:
raw_queue: '{{ state_attr(''sensor.announcement_queue'', ''queue'') }}'
cleaned_queue: "{% if raw_queue is iterable %}\n {# When house becomes empty:\
\ #}\n {# 1. Keep only critical and high priority messages #}\n {# 2. Remove\
\ expired messages #}\n {% set now_iso = now().isoformat() %}\n {% set valid_msgs\
\ = namespace(list=[]) %}\n {% for msg in raw_queue %}\n {% set expires_at\
\ = msg.get('expires_at') %}\n {% set priority = msg.get('priority', 'normal')\
\ %}\n {% if (not expires_at or expires_at > now_iso) and\n (priority\
\ in ['critical', 'high']) %}\n {% set valid_msgs.list = valid_msgs.list\
\ + [msg] %}\n {% endif %}\n {% endfor %}\n {{ valid_msgs.list }}\n{%\
\ else %}\n []\n{% endif %}"
payload_json: '{{ {"queue": cleaned_queue} | to_json }}'
- action: system_log.write
data:
level: warning
message: 'Queue cleaned due to empty house. Remaining messages: {{ cleaned_queue
| length }}
'
- action: mqtt.publish
data:
topic: home/announcement_queue/data
payload: '{{ payload_json }}'
retain: true
- action: mqtt.publish
data:
topic: home/announcement_queue/state
payload: queue
retain: true
- id: quiet_mode_turn_off
initial_state: true
alias: Quiet Mode - Turn Off
triggers:
- trigger: state
entity_id: binary_sensor.everybody_awake
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.quiet_mode
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.nino_bed_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.gianluca_bed_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.john_bed_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.cristina_bed_occupied
state: 'off'
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.quiet_mode
- id: quiet_mode_turn_on
initial_state: true
alias: Quiet Mode - Turn On
triggers:
- trigger: state
entity_id: binary_sensor.somebody_in_bed
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.quiet_mode
state: 'off'
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.quiet_mode
- action: script.voice_announcement
data:
media_players: auto
sound: harp-flourish
speech_message: "{% set who = \"\" %} {% if states.input_boolean.gianluca_in_bed.state\
\ == \"on\" %}\n {% set who = \"Gianluca\" %}\n{% elif states.input_boolean.nino_in_bed.state\
\ == \"on\" %}\n {% set who = \"Nino\" %}\n{% elif states.input_boolean.john_is_in_bed.state\
\ == \"on\" %}\n {% set who = \"John\" %}\n{% elif states.input_boolean.cristina_in_bed.state\
\ == \"on\" %}\n {% set who = \"Cristina\" %}\n{% endif %}\n{{\n [\n \
\ \"Shhh...\" ~ who ~ \" is going to sleep.\",\n \"Quiet time, \" ~ who\
\ ~ \" is going to sleep!\",\n \"Pardon the interruption but \" ~ who ~\
\ \" is going to sleep, please be quiet!\",\n \"Attention! Quiet mode has\
\ been enabled for \" ~ who ~ \"'s nap.\"\n ] | random\n}}"
- alias: Reset Room Selection After Vacuum Finishes
description: Turns off all room selection booleans when the vacuum completes cleaning
trigger:
- platform: state
entity_id: vacuum.roborock_s7
to: returning
condition:
- condition: template
value_template: "{% for entity in states.input_boolean if 'vacuum_' in entity.entity_id\
\ %}\n {% if is_state(entity.entity_id, 'on') %}\n {{ true }}\n {% break\
\ %}\n {% endif %}\n{% endfor %} {{ false }}\n"
action:
- service: input_boolean.turn_off
target:
entity_id: "{% set entities = [] %} {% for entity in states.input_boolean if\
\ 'vacuum_' in entity.entity_id %}\n {% if is_state(entity.entity_id, 'on')\
\ %}\n {% set entities = entities + [entity.entity_id] %}\n {% endif %}\n\
{% endfor %} {{ entities | join(',') }} "
- id: returned_home
initial_state: 'on'
alias: Returned home
trigger:
- platform: numeric_state
entity_id: sensor.home_nearest_distance
below: 0.5
- platform: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
to: Just Arrived
condition:
condition: and
conditions:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.house_occupied.last_updated))
| int < 300 }}'
- condition: or
conditions:
- condition: template
value_template: '{{ is_state(''input_select.john_status'',''Just Arrived'')
}}'
- condition: template
value_template: '{{ is_state(''input_select.cristina_status_dropdown'',''Just
Arrived'') }}'
action:
- service: script.general_notification
data:
title: Home Arrival Mode
message: I noticed that you're arriving home so I've opened the garage and turned
on a couple of lights.
devices: jk
priority: passive
- alias: If it's late then turn on a late night scene
choose:
- alias: Late night
conditions:
- condition: and
conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: time
after: '21:00:00'
sequence:
- scene: scene.returned_home_late
default:
- scene: scene.returned_home
- id: robot_vacuum_maintenance_reminder
alias: Robot Vacuum Maintenance Reminder
mode: single
triggers:
- trigger: time
at: '20:45:00'
id: reminder_time
- trigger: time
at: 07:05:00
id: reminder_time
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
actions:
- wait_for_trigger:
- trigger: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'on'
for:
minutes: 5
timeout:
minutes: 20
continue_on_timeout: true
- wait_for_trigger:
- trigger: state
entity_id: binary_sensor.kitchen_motion_sensor_status
to: 'on'
timeout:
minutes: 10
continue_on_timeout: true
- action: script.voice_announcement
data:
media_players: auto
sound: one-chime
priority: high
speech_message: "{% if trigger.entity_id == \"binary_sensor.roborock_s7_water_shortage\"\
\ %}\n \"The robot vacuum is water tank is empty, please refill it as soon\
\ as possible.\"\n{% elif trigger.entity_id == \"sensor.roborock_s7_sensor_dirty_left\"\
\ %}\n \"The robot vacuum sensors are dirty and need to be cleaned.\"\n{%\
\ else %}\n \"The robot vacuum needs maintenance, please check the app for\
\ more details.\"\n{% endif %}"
- action: script.general_notification
data:
message: "{% if trigger.entity_id == \"binary_sensor.roborock_s7_water_shortage\"\
\ %}\n \"The robot vacuum is water tank is empty, please refill it as soon\
\ as possible.\"\n{% elif trigger.entity_id == \"sensor.roborock_s7_sensor_dirty_left\"\
\ %}\n \"The robot vacuum sensors are dirty and need to be cleaned.\"\n{%\
\ else %}\n \"The robot vacuum needs maintenance, please check the app for\
\ more details.\"\n{% endif %}"
title: Robot Vacuum Maintenance
devices: jk
priority: time-sensitive
tag: vacuum-notifications
- id: robot_vacuum_reorder_reminder
alias: Robot Vacuum Reorder Reminder
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.roborock_s7_main_brush_left
below: 72000
- platform: numeric_state
entity_id: sensor.roborock_s7_side_brush_left
below: 72000
- platform: numeric_state
entity_id: sensor.roborock_s7_filter_left
below: 72000
action:
- wait_for_trigger:
- platform: time
at: 07:05:00
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.kitchen_motion_sensor_occupancy
to: 'on'
for:
minutes: 10
timeout:
minutes: 10
continue_on_timeout: true
- wait_for_trigger:
- platform: state
entity_id: sensor.john_room_presence
to: kitchen
timeout:
minutes: 5
continue_on_timeout: true
- service: script.voice_announcement
data:
media_players: auto
sound: one-chime
priority: high
speech_message: The robot vacuum will need some maintenance soon. Please reoder
{{trigger.from_state.attributes.friendly_name}}
- service: script.general_notification
data:
message: The robot vacuum will need some maintenance soon. Please reorder {{trigger.from_state.attributes.friendly_name}}
title: Robot Vacuum Maintenance
devices: jk
priority: time-sensitive
tag: vacuum-notifications
- id: school_day_reminder
alias: School Day Reminder
mode: single
initial_state: false
trigger:
- platform: time
at: input_datetime.school_day_breakfast_reminder_time
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
- condition: state
entity_id: input_boolean.gianluca_school_day
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell-chime
speech_message: "{% set nino_school = states.input_boolean.nino_school_day.state\
\ %} {% set late_start = states.input_boolean.district_late_start_wednesday.state\
\ %} {% set gl_school = states.input_boolean.gianluca_school_day.state %}\n\
{# Both kids have school today #} {% if nino_school == \"on\" and gl_school\
\ == \"on\" %}\n {% if late_start == \"on\" %}\n {{\n [\n \
\ \"Hey gang, it's time to eat breakfast and get ready for school! As a reminder,\
\ Nino has a late start today!\",\n \"Hey there, it's time to get the\
\ kids breakfast ready. Today's a school day, but remember that Nino has a\
\ late start today.\",\n \"Just at reminder that there's school today,\
\ so it's time for breakfast. Just an FYI, Nino has late start today!\"\n\
\ ] | random\n }}\n {% else %}\n {{\n [\n \"Hey gang,\
\ it's time to eat breakfast and get ready for school!\",\n \"Hey there,\
\ it's time to get the kids breakfast ready. Today's a school day.\",\n \
\ \"Just at reminder that there's school today, so it's time for breakfast.\"\
\n ] | random\n }}\n {% endif %}\n\n{# Only Nino has school #} {%\
\ elif nino_school == \"on\" %}\n {% if late_start == \"on\" %}\n {{\n\
\ [\n \"Hey Nino, today's a school day and it's time to get ready,\
\ but guess what, it's a late start!\",\n \"Hey there, it's time to\
\ get the Nino's breakfast ready. Just a reminder that today's a late start\
\ day!\",\n \"Hey Nino! There's school today, but lucky for you it's\
\ a late start day!\"\n ] | random\n }}\n {% else %}\n {{\n \
\ [\n \"Hey Nino, today's a school day so it's time to get ready!\"\
,\n \"Hey there, it's time to get the Nino's breakfast ready. Today\
\ is a school day.\",\n \"Hey Nino! Just a reminder that today's a\
\ school day so it's time to eat breakfast and get ready.\"\n ] | random\n\
\ }}\n {% endif %}\n\n{# Only Gianluca has school #} {% elif gl_school\
\ == \"on\" %}\n {{\n [\n \"Hey Gianluca, it's time to eat breakfast\
\ and get ready for school\",\n \"Hey there, it's time to get Gianluca's\
\ breakfast ready. Today is a school day.\",\n \"Hey Gianluca! Just a\
\ reminder that today's a school day so it's time to eat breakfast and get\
\ ready.\"\n ] | random\n }}\n{% endif %}"
- id: school_departure_reminder
alias: School Departure Reminder
mode: single
initial_state: false
trigger:
- platform: time
at: input_datetime.school_day_departure_reminder
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.nino_school_day
state: 'on'
- condition: state
entity_id: input_boolean.gianluca_school_day
state: 'on'
action:
- service: script.voice_announcement
data:
media_players: auto
sound: school-bell
speech_message: "{{\n [\n \"School starts soon. Time to pack up and head\
\ out!\",\n \"Hey boys! Time to start heading over to school!\",\n \"\
Pack it up, pack it in, time to drop the kids at school!\"\n ] | random\n\
}}"
- id: second_floor_climate_activate_eco_when_energy_is_expensive
alias: Second Floor Climate - Activate Eco When Energy is Expensive
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.energy_prices_are_high
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id:
- input_boolean.ninos_bedroom_occupied
- input_boolean.gianlucas_room_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.extreme_climate
state: 'off'
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode == ''none''
}}'
actions:
- action: script.second_floor_climate_to_eco
data: {}
- id: second_floor_climate_resume
alias: Second Floor Climate Resume
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_select.house
to: Quiet
- platform: state
entity_id: input_boolean.main_bedroom_occupied
to: 'on'
- platform: state
entity_id: input_boolean.ninos_bedroom_occupied
to: 'on'
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.house
state: Quiet
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: state
entity_id: input_boolean.main_bedroom_occupied
state: 'on'
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode != ''none''
}}'
action:
- service: script.second_floor_climate_to_resume
data: {}
- id: second_floor_climate_resume_when_energy_prices_fall
alias: Second Floor Climate - Resume When Energy Prices Fall
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.energy_prices_are_high
from: 'on'
to: 'off'
condition:
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode != ''none''
}}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nearly_home
state: 'on'
action:
- action: script.second_floor_climate_to_resume
data: {}
- id: second_floor_climate_resume_when_nearly_home
alias: Second Floor Climate Resume When Nearly Home
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.nearly_home
to: 'on'
condition:
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode != ''none''
}}'
action:
- service: script.second_floor_climate_to_resume
data: {}
- id: second_floor_climate_resume_before_bed
alias: Second Floor Climate - Resume Before Bed
initial_state: true
trigger:
- platform: time
at: '18:30:00'
condition:
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode != ''none''
}}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.nearly_home
state: 'on'
action:
- action: script.second_floor_climate_to_resume
data: {}
- id: second_floor_climate_off
alias: Second floor climate Off
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
for:
minutes: 30
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: template
value_template: '{{ states.climate.nest_2nd_floor.attributes.preset_mode == ''none''
}}'
action:
- service: script.second_floor_climate_to_eco
data: {}
- id: security_lighting_garage_flood_motion_off
alias: Security Lighting - Garage Flood Motion Off
mode: single
initial_state: true
trigger:
- platform: state
entity_id:
- binary_sensor.driveway_front_camera_object_detected
- binary_sensor.driveway_front_camera_person_detected
to: 'off'
for:
minutes: 3
- platform: state
entity_id:
- binary_sensor.driveway_front_camera_object_detected
- binary_sensor.driveway_front_camera_person_detected
to: 'off'
for:
minutes: 5
- platform: state
entity_id: light.driveway_flood_light
to: 'on'
for:
minutes: 30
condition:
- condition: state
entity_id:
- binary_sensor.driveway_front_camera_object_detected
- binary_sensor.driveway_front_camera_person_detected
- binary_sensor.driveway_front_camera_vehicle_detected
state: 'off'
- condition: state
entity_id: light.driveway_flood_light
state: 'on'
action:
- action: light.turn_off
entity_id: light.driveway_flood_light
- id: security_lighting_garage_flood_motion_on
alias: Security Lighting - Garage Flood Motion On
mode: single
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.driveway_front_camera_object_detected
to: 'on'
condition:
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
- condition: state
entity_id: light.driveway_flood_light
state: 'off'
action:
- action: light.turn_on
entity_id: light.driveway_flood_light
- id: security_status_notification
alias: Security - Status Notification
mode: single
trigger:
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
for:
minutes: 5
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
for:
minutes: 7
condition:
- condition: template
value_template: "{% set last_triggered = state_attr('automation.security_status_notification',\
\ 'last_triggered') %} {% if last_triggered != None %}\n {% set time_diff =\
\ (now() - last_triggered).total_seconds() | int %}\n {{ time_diff > 3600 }}\n\
{% else %}\n true\n{% endif %}\n"
action:
- service: script.general_notification
data:
message: "{% set trigger = trigger.to_state.entity_id %} {% if 'bedtime' in\
\ trigger %}\n The house security protocol has been activated for bedtime.\n\
{% else %}\n The house security protocol has been activated since nobody's\
\ home.\n{% endif %} The house is {{ states('sensor.house_security_status')\
\ | lower }}. {% if states('sensor.house_security_score') | int < 85 %}\n\
\ {% if is_state('binary_sensor.windows', 'on') %}\n Windows are open.\n\
\ {% endif %}\n {% if is_state('binary_sensor.exterior_doors', 'on') %}\n\
\ Exterior doors are open.\n {% endif %}\n {% if is_state('cover.garage_doors',\
\ 'open') %}\n Garage doors are open.\n {% endif %}\n {% if is_state('lock.front_door',\
\ 'unlocked') %}\n Front door is unlocked.\n {% endif %}\n {% if is_state('lock.garage_entry_door',\
\ 'unlocked') %}\n Garage entry door is unlocked.\n {% endif %}\n{% endif\
\ %}\n"
title: Home Security - Shields Up
devices: jk
priority: time-sensitive
tag: home-security
- id: john_set_focus_mode
alias: John Set Focus Mode
mode: queued
triggers:
- trigger: state
entity_id: sensor.john_calendar_focus_mode
- trigger: state
entity_id: input_boolean.john_dnd
to: 'off'
- trigger: homeassistant
event: start
- trigger: event
event_type: automation_reloaded
condition:
- condition: time
after: 05:00:00
- condition: state
entity_id: input_boolean.john_home
state: 'on'
- condition: template
value_template: '{% set calendar_mode = states(''sensor.john_calendar_focus_mode'')
%} {% set current_mode = states(''input_select.john_focus_mode'') %} {{ calendar_mode
!= current_mode and calendar_mode != '''' }}'
action:
- action: input_select.select_option
target:
entity_id: input_select.john_focus_mode
data:
option: '{{ states(''sensor.john_calendar_focus_mode'') }}'
- id: severe_weather_warning
alias: Severe Weather Warning
initial_state: true
triggers:
- trigger: state
entity_id: sensor.nws_alerts
conditions:
- '{{states(''sensor.nws_alerts'') | int > 0}}'
- condition: template
value_template: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID %}\n \
\ {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list = set(ns.ids)\
\ %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None') | reject('match',\
\ 'unknown'))|list ) %} {{ (current_id_list.difference(history_id_list)|list)\
\ | count > 0 }}\n"
- condition: template
value_template: "{% set ns = namespace(events=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns.events = ns.events + [event] %}\n{% endfor -%} {% set alerts_list\
\ = set(ns.events) %} {% set test_list = set(['Tornado Warning', 'Severe Thunderstorm\
\ Warning', 'Air Quality Alert', 'Heat Advisory', 'Severe Thunderstorm Watch',\
\ 'Excessive Heat Warning', 'Extreme Heat Warning']) %} {{ test_list.intersection(alerts_list)\
\ | count > 0 }}\n"
actions:
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {{ ns_dict.events_dict[repeat.index\
\ - 1].event == 'Tornado Warning' and ns_dict.events_dict[repeat.index\
\ - 1].id not in history_id_list }}\n"
then:
- action: script.voice_announcement
data:
media_players: auto
sound: nuclear
priority: critical
speech_message: Attention!!,,,Attention!!,,,The National Weather Service
Has issued a tornado warning for our area!
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {{ ns_dict.events_dict[repeat.index\
\ - 1].event == 'Severe Thunderstorm Warning' and ns_dict.events_dict[repeat.index\
\ - 1].id not in history_id_list }}\n"
then:
- action: script.voice_announcement
data:
media_players: auto
sound: nuclear
priority: critical
speech_message: Attention!!,,,Attention!!,,,The National Weather Service
Has issued a severe thunderstorm warning for our area!
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {{ ns_dict.events_dict[repeat.index\
\ - 1].event == 'Heat Advisory' and ns_dict.events_dict[repeat.index -\
\ 1].id not in history_id_list }}\n"
then:
- action: script.voice_announcement
data:
media_players: auto
sound: default
priority: high
speech_message: Attention!!,,,Attention!!,,,The National Weather Service
Has issued a heat advisory for our area!
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {{ ns_dict.events_dict[repeat.index\
\ - 1].event == 'Severe Thunderstorm Watch' and ns_dict.events_dict[repeat.index\
\ - 1].id not in history_id_list }}\n"
then:
- action: script.voice_announcement
data:
media_players: auto
sound: default
priority: high
speech_message: Attention!!,,,Attention!!,,,The National Weather Service
Has issued a severe thunderstorm watch for our area!
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {{ ns_dict.events_dict[repeat.index\
\ - 1].event == 'Air Quality Alert' and ns_dict.events_dict[repeat.index\
\ - 1].id not in history_id_list }}\n"
then:
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- repeat:
count: '{{ states(''sensor.nws_alerts'') | int }}'
sequence:
- if:
- condition: template
value_template: "{% set ns_events = namespace(events=[]) %} {% set ns_dict\
\ = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event\
\ %}\n {% set ns_events.events = ns_events.events + [event] %}\n {%\
\ set event_dict_list = dict(event = state_attr('sensor.nws_alerts', 'Alerts')[x].Event,\
\ id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID) %}\n {% set ns_dict.events_dict\
\ = ns_dict.events_dict + [event_dict_list] %}\n{% endfor -%} {%- set\
\ history_id_list = set( (states.sensor.nws_alerts_announced_ids.attributes.values()\
\ | reject('match', 'nws_alerts_announced_ids') | reject('match', 'None')\
\ | reject('match', 'unknown'))|list ) %} {% set event = ns_dict.events_dict[repeat.index\
\ - 1].event %} {{ (event == 'Excessive Heat Warning' or event == 'Extreme\
\ Heat Warning') and ns_dict.events_dict[repeat.index - 1].id not in history_id_list\
\ }}\n"
then:
- action: script.voice_announcement
data:
media_players: auto
sound: nuclear
priority: critical
speech_message: '{% set event = ns_dict.events_dict[repeat.index - 1].event
%} Attention!!,,,Attention!!,,,The National Weather Service Has issued
an {{ event.lower() }} for our area!
'
- action: variable.update_sensor
target:
entity_id: sensor.nws_alerts_announced_ids
data:
value: "{% set ns_dict = namespace(events_dict=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set event_dict_list = dict(event = state_attr('sensor.nws_alerts',\
\ 'Alerts')[x].Event, id=state_attr('sensor.nws_alerts', 'Alerts')[x].ID)\
\ %}\n {% set ns_dict.events_dict = ns_dict.events_dict + [event_dict_list]\
\ %}\n{% endfor -%} {{ ns_dict.events_dict[repeat.index - 1].id}}\n"
- delay:
minutes: 1
- id: nws_update_event_id_variable
alias: NWS Update Event ID Variable
initial_state: true
triggers:
- trigger: state
entity_id: sensor.nws_alerts
actions:
- action: variable.set_variable
data:
variable: nws_alerts_event_ids
attributes:
history_1: '{{ states(''sensor.nws_alerts_event_ids'') }}'
history_2: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_1'')
}}'
history_3: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_2'')
}}'
history_4: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_3'')
}}'
history_5: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_4'')
}}'
history_6: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_5'')
}}'
history_7: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_6'')
}}'
history_8: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_7'')
}}'
history_9: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_8'')
}}'
history_10: '{{ state_attr(''sensor.nws_alerts_event_ids'', ''history_9'')
}}'
- action: variable.set_variable
data:
variable: nws_alerts_event_ids
value: '{{ (trigger.to_state.attributes.event_id).split(''-'')[0] }}'
- id: severe_rain_incoming
alias: Severe Rain Incoming
initial_state: true
triggers:
- trigger: numeric_state
entity_id:
- sensor.pirateweather_precip_intensity_0h
- sensor.pirateweather_precip_intensity_1h
above: 0.5
- trigger: numeric_state
entity_id:
- sensor.pirateweather_precip_accumulation_0h
- sensor.pirateweather_precip_accumulation_1h
above: 0.05
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
actions:
- action: script.general_notification
data:
title: Severe Rain Warning
message: The forecast is showing a lot of rain in the next hour. Might be a
good idea to put out the pumps.
devices: jk
priority: time-sensitive
tag: daily-update
- action: script.voice_announcement
data:
media_players: auto
sound: nuclear
priority: high
expires_in: 10
speech_message: The forecast is showing a lot of rain in the next hour. Keep
an eye out for any leaks and it might be a good idea to put out the pumps.
- alias: NWS Alerts Notification Weather Alert
id: nws_alerts_notification_weather_alert
initial_state: true
triggers:
trigger: state
entity_id: sensor.nws_alerts
conditions:
- '{{states(''sensor.nws_alerts'') | int > 0}}'
actions:
- choose:
- conditions:
- '{{ states(''sensor.nws_alerts'') | int >= 3 }}'
sequence:
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[0].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{0}}
- delay:
seconds: 2
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[1].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[1].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[1].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{1}}
- delay:
seconds: 2
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[2].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[2].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[2].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{2}}
- conditions:
- '{{ states(''sensor.nws_alerts'') | int == 2 }}'
sequence:
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[0].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{0}}
- delay:
seconds: 2
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[1].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[1].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[1].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{1}}
- conditions:
- '{{ states(''sensor.nws_alerts'') | int == 1 }}'
sequence:
- if:
- '{{ (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)
and (state_attr(''sensor.nws_alerts'', ''Alerts'')[0].ID != states(''sensor.nws_alerts_event_ids''))
}}'
then:
- action: script.general_notification
data:
title: NWS Alert
message: '"NWS: {{ state_attr(''sensor.nws_alerts'', ''Alerts'')[0].Event
}}"
'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-{{0}}
- delay:
seconds: 5
- condition: template
value_template: '{{ states(''sensor.nws_alerts'') | int >= 4 }}'
- condition: template
value_template: "{% set ns = namespace(ids=[]) %} {% for x in range(0,states('sensor.nws_alerts')|int\
\ ) %}\n {% set id = state_attr('sensor.nws_alerts', 'Alerts')[x].ID %}\n \
\ {% set ns.ids = ns.ids + [id] %}\n{% endfor -%} {% set current_id_list = set(ns.ids)\
\ %} {% set history_id_list = set( (states.sensor.nws_alerts_event_ids.attributes.values()|\
\ reject('match', 'nws_alerts_event_ids') | reject('match', 'None') | reject('match',\
\ 'unknown'))|list ) %} {{ (current_id_list.difference(history_id_list)|list)\
\ | count > 0 }}\n"
- condition: template
value_template: "{{ (state_attr('sensor.nws_alerts', 'Alerts')[0].ID not in states.sensor.nws_alerts_event_ids.attributes.values()|list)\
\ \n and (state_attr('sensor.nws_alerts', 'Alerts')[0].ID != states('sensor.nws_alerts_event_ids'))\
\ }}\n"
- action: script.general_notification
data:
title: NWS Alert
message: 'NWS: More Than 3 New Alerts! Check your local National Weather Service
for all current alerts!'
devices: jk
priority: time-sensitive
tag: severe-weather-alert-multiple
- id: stairs_lights_motion_on
initial_state: true
alias: Stairs lights Motion On
trigger:
- platform: state
entity_id: binary_sensor.stairs_motion_status
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.foyer_motion_illuminance
below: 15
- condition: numeric_state
entity_id: sensor.stairs_up_motion_sensor_illuminance
below: 10
- condition: and
conditions:
- condition: state
entity_id: light.stairs_light
state: 'off'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.light.stairs_light.last_updated))
| int > 180 }}'
- condition: state
entity_id: light.foyer_chandelier
state: 'off'
action:
- service: light.turn_on
entity_id: light.stairs_light
- id: stairs_lights_off
initial_state: true
alias: Stairs lights off
trigger:
- platform: state
entity_id: binary_sensor.stairs_motion_status
to: 'off'
for:
minutes: 3
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
condition:
- condition: state
entity_id: light.stairs_light
state: 'on'
action:
- service: light.turn_off
entity_id: light.stairs_light
- id: sunroom_mode_auto
initial_state: true
alias: Sunroom Mode Auto
trigger:
- platform: state
entity_id: input_boolean.sunroom_occupied
to: 'on'
- platform: state
entity_id: input_select.house
to: Auto
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.sunroom'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
- condition: state
entity_id: input_select.house
state: Auto
action:
- service: input_select.select_option
data:
entity_id: input_select.sunroom
option: Auto
- id: sunroom_mode_off
initial_state: true
alias: Sunroom Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: template
value_template: '{{ not is_state(''input_select.sunroom'',''Off'') }}'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_boolean.bedtime
state: 'on'
action:
- service: input_select.select_option
data:
entity_id: input_select.sunroom
option: 'Off'
- id: sunroom_occupied
initial_state: true
alias: Sunroom Occupied
trigger:
- platform: state
entity_id: binary_sensor.sunroom_motion_sensor_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.sunroom_motion_sensor_status
to: 'on'
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.sunroom_occupied
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''sunroom'')|map(attribute=''name'')|list | length > 0 }}'
- condition: state
entity_id: binary_sensor.sunroom_motion_sensor_occupancy
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.sunroom_occupied
- id: sunroom_not_occupied
initial_state: true
alias: Sunroom Not Occupied
trigger:
- platform: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''sunroom'')|map(attribute=''name'')|list | length == 0 }}'
for:
minutes: 3
- platform: state
entity_id: binary_sensor.sunroom_motion_sensor_occupancy
to: 'off'
- platform: state
entity_id: media_player.sonos_patio
to: 'off'
for:
minutes: 5
- platform: state
entity_id: media_player.sonos_patio
to: idle
for:
minutes: 5
- platform: state
entity_id: media_player.sonos_patio
to: paused
for:
minutes: 5
condition:
- condition: state
entity_id: input_boolean.sunroom_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.sunroom_motion_sensor_occupancy
state: 'off'
- condition: template
value_template: '{{ expand(''group.room_presence_devices'')|selectattr(''state'',
''eq'', ''sunroom'')|map(attribute=''name'')|list | length == 0 }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.sunroom_occupied
- id: sylvia_is_away
alias: Sylvia is Away
initial_state: true
trigger:
- platform: state
entity_id: person.sylvia
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: not
conditions:
- condition: state
entity_id: input_select.sylvia_status
state: Just Left
- condition: state
entity_id: person.sylvia
state: not_home
action:
- service: input_boolean.turn_off
entity_id: input_boolean.sylvia_home
- id: sylvia_is_home
initial_state: true
alias: Sylvia is Home
trigger:
- platform: state
entity_id: person.sylvia
to: home
- platform: state
entity_id: device_tracker.sylvia_android_phone
to: home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: person.sylvia
state: home
- condition: state
entity_id: device_tracker.sylvia_android_phone
state: home
action:
- service: input_boolean.turn_on
entity_id: input_boolean.sylvia_home
- id: tayta_announce_arrival
alias: Tayta Announce Arrival
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.sonia_koht
from: not_home
to: home
conditions:
- condition: state
entity_id: person.sonia_koht
state: home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: tayta
announcement_type: arrival
- condition: state
entity_id: input_boolean.guest_mode_announced
state: 'off'
- action: input_boolean.turn_on
entity_id: input_boolean.guest_mode_announced
- id: tayta_announce_departure
alias: Tayta Announce Departure
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id: person.sonia_koht
from: home
to: not_home
conditions:
- condition: state
entity_id: person.sonia_koht
state: not_home
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
for:
minutes: 5
actions:
- action: script.person_announcement
data:
person: tayta
announcement_type: departure
- id: tayta_is_away
alias: Tayta is Away
initial_state: true
trigger:
- platform: state
entity_id: person.mary_falbo
to: not_home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: not
conditions:
- condition: state
entity_id: input_select.tayta_status
state: Just Left
- condition: state
entity_id: person.sonia_koht
state: not_home
action:
- service: input_boolean.turn_off
entity_id: input_boolean.tayta_home
- id: tayta_is_home
initial_state: true
alias: Tayta is Home
trigger:
- platform: state
entity_id: sensor.tayta_room_presence
from: not_home
- platform: state
entity_id: person.sonia_koht
to: home
- platform: event
event_type: automation_reloaded
- platform: homeassistant
event: start
condition:
- condition: or
conditions:
- condition: state
entity_id: person.sonia_koht
state: home
- condition: template
value_template: '{{ states.sensor.tayta_room_presence.state != ''not_home''}}'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.tayta_home
- id: tempest_high_uv_alert
alias: Tempest - High UV Alert
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.tempest_uv
above: 7
- platform: numeric_state
entity_id: sensor.tempest_uv
above: 8
- platform: numeric_state
entity_id: sensor.tempest_uv
above: 10
action:
- service: script.voice_announcement
data:
speech_message: "{% set uv = state_attr('sensor.tempest_uv') %}\n{% if uv >\
\ 10 %}\n \"Warning! UV levels are extremely high. Please take precautions\
\ and avoid unprotected sun exposure.\"\n{% elif uv > 8 %}\n \"Attention!\
\ UV levels are very high so please take precautions when going outside.\"\
\n{% else %}\n \"Attention! UV levels are elevated today, please take precautions.\"\
\n{% endif %}"
sound: police-whistle
media_players: auto
priority: "{% set uv = state_attr('sensor.tempest_uv') %}\n{% if uv > 10 %}\n\
\ \"critical\"\n{% elif uv > 8 %}\n \"high\"\n{% else %}\n \"normal\"\n\
{% endif %}"
- service: script.general_notification
data:
title: Outdoor UV Alert!
message: "{% set uv = state_attr('sensor.tempest_uv') %}\n{% if uv > 10 %}\n\
\ \"Warning! UV levels are extremely high. Please take precautions and avoid\
\ unprotected sun exposure.\"\n{% elif uv > 8 %}\n \"Attention! UV levels\
\ are very high so please take precautions when going outside.\"\n{% else\
\ %}\n \"Attention! UV levels are elevated today, please take precautions.\"\
\n{% endif %}"
devices: jk
priority: time-sensitive
tag: tempest-uv-alert
- id: tempest_rain_alert
alias: Tempest - Rain Alert
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.tempest_rain_amount
above: 1
- trigger: numeric_state
entity_id: sensor.tempest_rain_amount
above: 3
- trigger: numeric_state
entity_id: sensor.tempest_rain_rate
above: 2
actions:
- action: script.voice_announcement
data:
speech_message: "{% set rain_amount = state_attr('sensor.tempest_rain_amount')\
\ %} {% set rain_rate = state_attr('sensor.tempest_rain_rate') %}\n{% if rain_amount\
\ > 3 or rain_rate > 3 %}\n \"Warning! Rain is accumulating quickly, please\
\ make sure to check the basement for any leaks.\"\n{% else %}\n \"Attention!\
\ There's quite a bit of rain so make sure to keep an eye on the basement.\"\
\n{% endif %}"
sound: police-whistle
media_players: auto
priority: "{% set rain_amount = state_attr('sensor.tempest_rain_amount') %}\
\ {% set rain_rate = state_attr('sensor.tempest_rain_rate') %}\n{% if rain_amount\
\ > 3 or rain_rate > 3 %}\n \"high\"\n{% else %}\n \"normal\"\n{% endif\
\ %}"
- action: script.general_notification
data:
title: Rain Accumulation Alert!
message: "{% set rain_amount = state_attr('sensor.tempest_rain_amount') %} {%\
\ set rain_rate = state_attr('sensor.tempest_rain_rate') %}\n{% if rain_amount\
\ > 3 or rain_rate > 3 %}\n \"Warning! Rain is accumulating quickly, please\
\ make sure to check the basement for any leaks.\"\n{% else %}\n \"Attention!\
\ There's quite a bit of rain so make sure to keep an eye on the basement.\"\
\n{% endif %}"
devices: jk
priority: time-sensitive
tag: tempest-rain-alert
- id: today_is_full_moon
initial_state: true
alias: Today is a full moon
trigger:
- platform: state
entity_id: sensor.moon
to: full_moon
action:
- service: automation.turn_on
entity_id: automation.full_moon_notification
- id: full_moon_notification
initial_state: true
alias: Full Moon Notification
trigger:
- platform: sun
event: sunset
offset: 00:10:00
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: sensor.moon
state: full_moon
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- wait_template: '{{ is_state(''binary_sensor.playroom_motion_sensor_entry_motion_detection'',
''on'') }}'
timeout: 01:00:00
- alias: Wait 3 seconds
delay: 3
- service: script.general_notification
data:
message: Today's a full moon, go check it out!
title: Full Moon Reminder
devices: jk
priority: passive
tag: full-moon-reminder
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{{\n [\n \"It's a full moon today! Go take a look out the\
\ window.\",\n \"Guess what? It's a full moon today!\",\n \"Hey fam!\
\ Today's a full moon, don't forget to check it out.\",\n \"Hey Nino! Guess\
\ what? Today's a full moon!\"\n ] | random\n}}"
- id: today_is_full_moon
initial_state: 'on'
alias: Today is a full moon
trigger:
- platform: sun
event: sunset
- platform: state
entity_id: sensor.moon
to: full_moon
condition:
- platform: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: sensor.moon
state: full_moon
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- wait_template: '{{ is_state(''binary_sensor.kitchen_motion_sensor_main_motion_detection'',
''on'') }}'
- alias: Wait 5 seconds
delay: 5
- service: notify.mobile_app_jk_2
data:
message: Today's a full moon, go check it out!
title: Full Moon Reminder
- service: script.voice_announcement
data:
media_players: auto
sound: chime
speech_message: "{{\n [\n \"It's a full moon today! Go take a look out the\
\ window.\",\n \"Guess what? It's a full moon today!\",\n \"Hey fam!\
\ Today's a full moon, don't forget to check it out.\",\n \"Hey Nino! Guess\
\ what? Today's a full moon!\"\n ] | random\n}}"
- id: travel_arrival_announcement
alias: Travel - Arrival Announcement
mode: single
trigger:
- platform: state
entity_id:
- person.john_koht
- person.cristina_falbo
to:
- Waldorf Astoria Hotel
for:
minutes: 1
action:
- service: script.voice_announcement
data:
media_players: auto
sound: musical-flute
speech_message: "{% set person = \"\" %} {% set ent = trigger.entity_id %}\n\
{% if ent == \"person.john_koht\" %}\n {% set person = \"Baba\" %}\n{% else\
\ %}\n {% set person = \"Mama\" %}\n{% endif %}\n{% set store = trigger.to_state.state\
\ %}\n\"Just wanted to let you know that {{person}} safely arrived at {{store}}!\"\
\n"
- id: office_shelf_lights_turn_off_deep_work_lighting
alias: Office Shelf Lights - Turn Off Deep Work Lighting
triggers:
- trigger: state
entity_id: input_select.john_focus_mode
from: Deep Work
conditions:
- condition: state
entity_id: input_select.office
state:
- Auto
- DnD
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
actions:
- action: light.turn_off
entity_id: light.office_shelf_lights
- id: turn_off_office_shelf_lights
alias: Turn off office shelf lights
initial_state: true
trigger:
- trigger: state
entity_id: input_boolean.house_occupied
to: 'off'
- trigger: state
entity_id: input_boolean.office_occupied
to: 'off'
conditions:
- or:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- and:
- condition: state
entity_id: input_boolean.office_occupied
state: 'off'
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'off'
actions:
- action: light.turn_off
entity_id: light.office_shelf_lights
- id: office_shelf_lights_turn_on_deep_work_lighting
alias: Office Shelf Lights - Turn On Deep Work Lighting
triggers:
- trigger: state
entity_id: input_select.john_focus_mode
to: Deep Work
conditions:
- condition: state
entity_id: input_select.office
state: Auto
- condition: state
entity_id: input_boolean.office_occupied
state: 'on'
actions:
- action: scene.turn_on
entity_id: scene.office_shelves_tokyo
- id: upstairs_dryer_complete
alias: Upstairs Dryer Complete
initial_state: true
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Clean
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
action:
- service: script.voice_announcement
data:
media_players: auto
sound: chirp
priority: normal
expires_in: 120
speech_message: The upstairs dryer finished and is ready to be emptied.
- service: script.general_notification
data:
message: The upstairsdryer is finished and ready to be emptied.
title: Upstairs Drying Machine
devices: all
priority: active
tag: main-level-dryer
- id: upstairs_dryer_complete
alias: Upstairs dryer complete
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Clean
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
action:
- service: notify.ios_family
data:
message: The upstairs dryer is finished and ready to be emptied.
title: Upstairs Drying Machine
- id: upstairs_dryer_to_clean
alias: Upstairs Dryer to Clean
initial_state: true
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Finishing
for:
minutes: 5
- platform: numeric_state
entity_id: sensor.upstairs_drying_machine_active_power
below: 50
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Clean
- id: upstairs_dryer_to_clean
alias: Upstairs dryer to clean
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Finishing
for:
minutes: 8
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Clean
- id: upstairs_dryer_to_finished
alias: Upstairs Dryer to Finishing
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.upstairs_drying_machine_active_power
below: 150
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Finishing
- id: upstairs_dryer_to_finished
alias: 'Upstairs dryer to '
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sensor.drying_machine_electric_consumption_w
below: 6
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Finishing
- id: upstairs_dryer_to_idle
alias: Upstairs Dryer to Idle
initial_state: true
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Clean
for:
minutes: 5
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Idle
- id: upstairs_dryer_to_idle
alias: Upstairs dryer to idle
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.upstairs_dryer_status
to: Clean
for:
minutes: 20
condition:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Idle
- id: upstairs_dryer_to_running
alias: Upstairs Dryer to Running
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.upstairs_drying_machine_active_power
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Idle
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Running
- id: upstairs_dryer_to_running
alias: Upstairs dryer to running
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sensor.drying_machine_electric_consumption_w
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Idle
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Clean
- condition: state
entity_id: input_select.upstairs_dryer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_dryer_status
option: Running
- id: upstairs_hallway_lights_manually_turned_off
initial_state: true
alias: Upstairs Hallway Lights - Manually Turned Off
trigger:
- platform: state
entity_id: light.upstairs_hallway
to: 'off'
condition:
- condition: state
entity_id: input_boolean.upstairs_hallway_lights_auto
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.context.parent_id == none }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.upstairs_hallway_lights_auto
- service: input_boolean.turn_off
entity_id: input_boolean.upstairs_hallway_lighting_automations
- service: script.general_notification
data:
title: Upstairs Hallway Lights
message: The upstairs hallway lights have been turned off. The parent id is
{{trigger.to_state.context.parent_id}} and the user_id is {{trigger.to_state.context.user_id}}.
devices: jk
priority: passive
tag: upstairs-hallway-lighting-automation
- id: upstairs_hallway_lights_motion_on
initial_state: true
alias: Upstairs Hallway Lights - Motion On
triggers:
- trigger: state
entity_id: binary_sensor.upstairs_hallway_motion
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_boolean.upstairs_hallway_lighting_automations
state: 'on'
- condition: numeric_state
entity_id: sensor.upstairs_hallway_nightlight_illuminance
below: 30
- condition: state
entity_id: light.upstairs_hallway
state: 'off'
- condition: state
entity_id: input_boolean.quiet_mode
state: 'off'
action:
- if:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.gianlucas_room_occupied
state: 'on'
- condition: state
entity_id: input_boolean.ninos_bedroom_occupied
state: 'on'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.input_boolean.quiet_mode.last_changed))
| int < 180 }}'
then:
- action: light.turn_on
entity_id: light.upstairs_hallway
data:
brightness_pct: 10
transition: 0.5
else:
- action: light.turn_on
entity_id: light.upstairs_hallway
- action: input_boolean.turn_on
entity_id: input_boolean.upstairs_hallway_lights_auto
- id: upstairs_hallway_lights_sleep_mode_off
initial_state: true
alias: Upstairs Hallway Lights Sleep Mode Off
trigger:
- platform: sun
event: sunrise
- platform: time
at: 07:00:00
- platform: state
entity_id: input_select.upstairs_hallway
to: Auto
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: input_select.upstairs_hallway
state: Auto
- condition: sun
after: sunrise
action:
- service: switch.turn_off
entity_id: switch.adaptive_lighting_sleep_mode_upstairs_hallway
- id: upstairs_hallway_lights_sleep_mode_on
initial_state: true
alias: Upstairs Hallway Lights Sleep Mode On
trigger:
- platform: state
entity_id: input_select.upstairs_hallway
to: Bedtime
- platform: state
entity_id:
- input_boolean.gianlucas_room_occupied
- input_boolean.ninos_bedroom_occupied
to: 'on'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: sun
after: sunset
- condition: state
entity_id: input_boolean.dark_outside
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_upstairs_hallway
- id: upstairs_hallway_lights_to_off
initial_state: true
alias: Upstairs Hallway Lights to Off
trigger:
- platform: state
entity_id: input_select.upstairs_hallway
to: 'Off'
- platform: state
entity_id: input_boolean.lighting_automations
to: 'on'
- platform: state
entity_id: input_boolean.upstairs_hallway_occupied
to: 'off'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: light.upstairs_hallway
state: 'on'
action:
- service: light.turn_off
entity_id: light.upstairs_hallway
- service: input_boolean.turn_off
entity_id: input_boolean.upstairs_hallway_lights_auto
- id: upstairs_hallway_mode_auto
initial_state: true
alias: Upstairs Hallway - Mode Auto
trigger:
- platform: state
entity_id: input_select.house
to: Auto
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.upstairs_hallway'',''Auto'') }}'
- condition: state
entity_id: input_boolean.bedtime
state: 'off'
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_hallway
option: Auto
- id: upstairs_hallway_mode_bedtime
initial_state: true
alias: Upstairs Hallway - Mode Bedtime
trigger:
- platform: state
entity_id: input_select.house
to: Bedtime
- platform: state
entity_id: input_boolean.bedtime
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: template
value_template: '{{ not is_state(''input_select.upstairs_hallway'',''Bedtime'')
}}'
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_hallway
option: Bedtime
- id: upstairs_hallway_mode_off
initial_state: true
alias: Upstairs Hallway - Mode Off
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: template
value_template: '{{ not is_state(''input_select.upstairs_hallway'',''Off'') }}'
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_hallway
option: 'Off'
- id: upstairs_hallway_not_occupied
initial_state: true
alias: Upstairs Hallway Not Occupied
trigger:
- platform: state
entity_id: binary_sensor.upstairs_hallway_motion
to: 'off'
for:
minutes: 10
condition:
- condition: state
entity_id: input_boolean.upstairs_hallway_occupied
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.upstairs_hallway_occupied
- alias: Wait 2 seconds
delay: 2
- service: input_boolean.turn_on
entity_id: input_boolean.upstairs_hallway_lighting_automations
- id: upstairs_hallway_occupied
initial_state: true
alias: Upstairs Hallway Occupied
trigger:
- platform: state
entity_id: binary_sensor.upstairs_hallway_motion
to: 'on'
- platform: state
entity_id: light.upstairs_hallway
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_boolean.upstairs_hallway_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.upstairs_hallway_motion
state: 'on'
- condition: state
entity_id: light.upstairs_hallway
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.upstairs_hallway_occupied
- id: upstairs_washer_complete_alert
alias: Upstairs washer complete alert
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.upstairs_washer_status
to: Clean
- platform: state
entity_id: input_boolean.house_occupied
to: 'on'
for:
minutes: 10
- platform: time
at: 08:01:00
condition:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: state
entity_id: input_select.upstairs_washer_status
state: Clean
- condition: template
value_template: "{% if states.automation.upstairs_washer_complete_alert.attributes.last_triggered\
\ is not none %}\n {% if as_timestamp(now()) | int - as_timestamp(states.automation.upstairs_washer_complete_alert.attributes.last_triggered)\
\ | int > 3600 %} true {% else %} false\n {% endif %}\n{% else %} false {%\
\ endif %}\n"
action:
- service: script.voice_announcement
data:
media_players: auto
sound: chirp
priority: normal
expires_in: 120
speech_message: The upstairs washer finished and is ready to be emptied.
- service_template: "{% if (is_state(\"input_boolean.john_home\", \"on\")) and (is_state(\"\
input_boolean.cristina_home\", \"on\")) %}\n notify.ios_family\n{% elif is_state(\"\
input_boolean.john_home\", \"on\") %}\n notify.mobile_app_jk_2\n{% elif (is_state(\"\
input_boolean.cristina_home\", \"on\")) %}\n notify.mobile_app_cfalb2\n{% endif\
\ %}\n"
data:
message: The upstairs washer is finished and ready to be emptied.
title: Upstairs Washing Machine
- if:
- alias: TV is ON
condition: state
entity_id: media_player.sony_bravia_tv
state: 'on'
then:
- service: notify.family_room_sony_bravia_tv
data:
message: The upstairs washer is finished and ready to be emptied.
title: Upstairs Laundry is complete!
data:
duration: 5
position: bottom-right
fontsize: large
transparency: 25%
interrupt: false
color: black
- id: upstairs_washer_to_clean
alias: Upstairs washer to clean
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.upstairs_washer_status
to: Finishing
for:
minutes: 8
condition:
- condition: state
entity_id: input_select.upstairs_washer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_washer_status
option: Clean
- id: upstairs_washer_to_finished
alias: Upstairs washer to finished
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sensor.washing_machine_electric_consumption_w
below: 3
condition:
- condition: state
entity_id: input_select.upstairs_washer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_washer_status
option: Finishing
- id: upstairs_washer_to_idle
alias: Upstairs washer to idle
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.upstairs_washer_door_sensor_status
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: input_select.upstairs_washer_status
state: Clean
- condition: state
entity_id: input_select.upstairs_washer_status
state: Finishing
- condition: state
entity_id: input_select.upstairs_washer_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_washer_status
option: Idle
- id: upstairs_washer_to_running
alias: Upstairs washer to running
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sensor.washing_machine_electric_consumption_w
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.upstairs_washer_status
state: Idle
- condition: state
entity_id: input_select.upstairs_washer_status
state: Clean
- condition: state
entity_id: input_select.upstairs_washer_status
state: Finishing
action:
- service: input_select.select_option
data:
entity_id: input_select.upstairs_washer_status
option: Running
- alias: UPS Battery Power Activated
trigger:
- platform: state
entity_id: sensor.apc_ups_status
to: OB
action:
- action: script.general_notification
data:
title: Power Outage!
message: 🚨 Power outage! UPS is now on battery.
devices: jk
priority: critical
tag: ups-power-outage
- alias: UPS Battery Power Deactivated
trigger:
- platform: state
entity_id: sensor.apc_ups_status
to: OL
action:
- action: script.general_notification
data:
title: UPS Power Restored!
message: The UPS is now back on AC power.
devices: jk
priority: time-sensitive
tag: ups-power-restored
- id: vacation_mode_turn_off
initial_state: false
alias: Vacation Mode - Turn Off
triggers:
- trigger: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
to: Home
- trigger: state
entity_id: input_boolean.house_occupied
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Home
- condition: state
entity_id: input_select.john_status
state: Home
actions:
- action: input_boolean.turn_off
entity_id: input_boolean.vacation_mode
- action: automation.turn_off
entity_id:
- automation.vacation_faux_home
- automation.vacation_faux_home_off
- automation.vacation_mode_turn_off
- automation.bedtime_mode_vacation_on
- automation.bedtime_mode_vacation_off
- action: script.general_notification
data:
title: Vacation Mode Turned Off
message: Vacation mode has been turned OFF
devices: jk
priority: time-sensitive
tag: vacation-mode-activated
- id: vacation_mode_turn_on
initial_state: true
alias: Vacation Mode - Turn On
triggers:
- trigger: state
entity_id:
- input_select.cristina_status_dropdown
- input_select.john_status
to: Extended Away
conditions:
- condition: state
entity_id: input_boolean.house_occupied
state: 'off'
- condition: state
entity_id: input_select.cristina_status_dropdown
state: Extended Away
- condition: state
entity_id: input_select.john_status
state: Extended Away
actions:
- action: input_boolean.turn_on
entity_id: input_boolean.vacation_mode
- action: automation.turn_on
entity_id:
- automation.vacation_faux_home
- automation.vacation_faux_home_off
- automation.vacation_mode_turn_off
- automation.bedtime_mode_vacation_on
- automation.bedtime_mode_vacation_off
- action: script.general_notification
data:
title: Vacation Mode Turned On
message: Vacation mode has been turned on!
devices: jk
priority: time-sensitive
tag: vacation-mode-activated
- id: vacuum_clean_kitchen_during_nap
alias: Vacuum - Clean Kitchen During Nap
mode: single
trigger:
- platform: state
entity_id: input_boolean.gianlucas_room_occupied
to: 'on'
for:
minutes: 10
condition:
- condition: state
entity_id: input_boolean.quiet_mode
state: 'on'
- condition: time
after: '13:00:00'
before: '15:00:00'
- condition: state
entity_id: input_boolean.entertainment_mode
state: 'off'
action:
- action: vacuum.send_command
target:
entity_id: vacuum.roborock_s7
data:
command: app_segment_clean
params:
- 24
- id: vacuum_clean_office_when_dog_is_at_daycare
alias: Vacuum - Clean Office When Dog is at Daycare
mode: single
trigger:
- platform: zone
entity_id: person.john_koht
zone: zone.north_shore_k9
event: enter
condition:
- condition: time
after: 08:00:00
before: '10:00:00'
action:
- action: vacuum.send_command
target:
entity_id: vacuum.roborock_s7
data:
command: app_segment_clean
params:
- 29
- id: weather_set_day_temperature
alias: Weather - Set day Temperature
initial_state: true
trigger:
- platform: state
entity_id: weather.kpwk_daynight
- platform: time
at: 01:00:00
action:
- service: input_number.set_value
data:
entity_id: input_number.weather_day_high
value: "{{ \n (state_attr('weather.kpwk_daynight', 'forecast')\n | map(attribute=\"\
temperature\")\n | list)[0:2]\n | max\n}}\n"
- service: input_number.set_value
data:
entity_id: input_number.weather_day_low
value: "{{ \n (state_attr('weather.kpwk_daynight', 'forecast')\n | map(attribute=\"\
temperature\")\n | list)[0:2]\n | min\n}}\n"
- id: window_left_open
alias: Window Left Open
mode: single
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.house_occupied
to: 'off'
- platform: state
entity_id: input_select.house
to: Away
condition:
- condition: state
entity_id: binary_sensor.windows
state: 'on'
action:
- service: script.general_notification
data:
title: Windows Left Open.
message: 'The house is empty, but some windows are still open: {{ expand(''binary_sensor.windows'')|selectattr(''state'',
''eq'', ''on'')|map(attribute=''name'')|list|join('', '') }}'
devices: all
priority: time-sensitive
tag: window-open
- id: zigbee_router_unavailable
initial_state: true
alias: Zigbee Router Unavailable
trigger:
- platform: state
entity_id:
- switch.smart_plug_1_switch
- switch.smart_plug_2_switch
- switch.smart_plug_3_switch
- switch.smart_plug_4_switch
- switch.smart_plug_5_switch
- switch.smart_plug_6_switch
- switch.smart_plug_7_switch
- switch.smart_plug_8_switch
- switch.smart_plug_9_switch
- switch.smart_plug_10_switch
- switch.smart_plug_11_switch
- switch.smart_plug_12_switch
- switch.smart_plug_13_switch
- switch.smart_plug_14_switch
- switch.smart_plug_15_switch
- switch.smart_plug_16_switch
- switch.smart_plug_17_switch
- switch.smart_plug_18_switch
- switch.gazebo_smart_plug_switch
- switch.tradfri_smart_plug_1_switch
- switch.tradfri_smart_plug_2_switch
- switch.tradfri_smart_plug_3_switch
- switch.tradfri_smart_plug_4_switch
- switch.tradfri_smart_plug_5_switch
to: unavailable
for:
minutes: 15
action:
- service: script.general_notification
data:
title: Zigbee System Issue
message: 'There is an issue with the following Zigbee routers: {{ trigger.to_state.attributes.friendly_name
}}'
devices: jk
priority: time-sensitive
tag: d