Files
Home-Assistant-Configs/packages/presence.yaml

956 lines
33 KiB
YAML

input_datetime:
last_time_home_tony:
name: Tony Last Seen
has_date: true
has_time: true
icon: mdi:binoculars
last_time_home_tina:
name: Tina Last Seen
has_date: true
has_time: true
icon: mdi:binoculars
last_time_home_kallen:
name: Kallen Last Seen
has_date: true
has_time: true
icon: mdi:binoculars
input_boolean:
away_mode_skipped:
name: Away Mode Skipped
icon: mdi:debug-step-over
binary_sensor:
- platform: bayesian
unique_id: a159dd2e-d8dc-469b-aaeb-bd774be07e1a
name: Tony Presence
device_class: presence
prior: 0.83
probability_threshold: 0.9
observations:
- entity_id: "device_tracker.tony_s_iphone"
prob_given_true: 0.8
prob_given_false: 0.5
platform: "state"
to_state: "home"
- entity_id: "device_tracker.tony_s_iphone_app"
prob_given_true: 0.8
prob_given_false: 0.5
platform: "state"
to_state: "home"
- platform: template
value_template: "{{ states('sensor.tony_s_iphone_ssid') in ['deltaforce-5G','deltaforce-2G','studio-5G','studio-2G'] }}"
prob_given_true: 0.75
prob_given_false: 0.01
- platform: bayesian
unique_id: 84183380-8ffc-49c1-a97b-8ef25ff6b5d4
name: Tina Presence
device_class: presence
prior: 0.1
probability_threshold: 0.9
observations:
- entity_id: "device_tracker.tinas_iphone"
prob_given_true: 0.8
prob_given_false: 0.6
platform: "state"
to_state: "home"
- entity_id: "device_tracker.tinas_iphone_app"
prob_given_true: 0.8
prob_given_false: 0.2
platform: "state"
to_state: "home"
- platform: template
value_template: "{{ states('sensor.tinas_iphone_ssid') in ['deltaforce-5G','deltaforce-2G','studio-5G','studio-2G'] }}"
prob_given_true: 0.99
prob_given_false: 0.01
- platform: bayesian
unique_id: 147f81d8-8f4f-4fe9-8bf5-fed7e5899fe9
name: Kallen Presence
device_class: presence
prior: 0.1
probability_threshold: 0.9
observations:
- entity_id: "device_tracker.kallen_iphone"
prob_given_true: 0.8
prob_given_false: 0.6
platform: "state"
to_state: "home"
- entity_id: "device_tracker.kallen_iphone_app"
prob_given_true: 0.8
prob_given_false: 0.2
platform: "state"
to_state: "home"
- platform: template
value_template: "{{ states('sensor.kallen_iphone_ssid') in ['deltaforce-5G','deltaforce-2G','studio-5G','studio-2G'] }}"
prob_given_true: 0.99
prob_given_false: 0.01
template:
- binary_sensor:
- name: People Present
state: >
{{ is_state('person.tony_stork', 'home') or is_state('person.christina_stork', 'home') or is_state('person.kallen_stork', 'home') or is_state('input_boolean.guest_mode', 'on') }}
- name: "Tony Home"
unique_id: 4f0d8c3d-dc49-4b7a-a1fc-5d286b4a954d
state: "{{ is_state('device_tracker.tony_s_iphone', 'home') }}" # Add new tracker when we have one
device_class: presence
- name: "Tina Home"
unique_id: 3d90e515-b204-4510-af0c-6c784fda2bd4
state: "{{ is_state('device_tracker.tinas_iphone', 'home') }}" # Add new tracker when we have one
device_class: presence
- name: "Kallen Home"
unique_id: 2419e826-b276-434c-b5c6-e42c065a73ff
state: "{{ is_state('device_tracker.kallen_iphone','home') }}" # Add new tracker when we have one
device_class: presence
- name: "Parents Home"
unique_id: 8de02d19-60a6-436d-9187-1cfc70d6c297
state: "{{ is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.tina_home','on') }}"
device_class: presence
- name: "Family Home"
unique_id: c1ec8744-3d76-4887-a0f2-572459bba8a2
state: "{{ is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.tina_home','on') or (is_state('binary_sensor.parents_home','on') and is_state('binary_sensor.kallen_home','on')) }}"
device_class: presence
- name: "Nerds Home"
unique_id: 2672a6a2-4be4-495c-b479-ffc7c6df67d2
state: "{{ is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.kallen_home','on') }}"
device_class: presence
- name: "People Sleeping"
unique_id: 3f0a1504-fd01-4967-a6fb-0309813d31e3
state: "{{ is_state('input_boolean.emma_sleeping','on') or is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.master_bedroom_sleeping','on') }}"
icon: mdi:sleep
- name: "Basement Occupied"
unique_id: 20039c29-8b9d-436d-ba6c-8f2c2bda1db0
device_class: occupancy
state: >
{% if is_state('binary_sensor.basement_studio_motion','on') %}
true
{% elif is_state('sensor.xia_desktop_current_username','tm24f') and
(is_state('binary_sensor.kallen_desktop_idle','on') or
states('sensor.kallen_desktop_current_username') in ['unavailable','unknown','NotPresent','SYSTEM'] or
is_state('binary_sensor.kallen_desktop_on','off')) %}
false
{% elif is_state('binary_sensor.tony_desktop_on','off') and
is_state('binary_sensor.kallen_desktop_on','off') %}
false
{% elif (is_state('binary_sensor.tony_desktop_idle','on') or
states('sensor.tony_asus_current_username') in ['unavailable','unknown','NotPresent','SYSTEM']) and
is_state('binary_sensor.kallen_desktop_idle','on') %}
false
{% elif (is_state('binary_sensor.tony_desktop_idle','on') or
states('sensor.tony_asus_current_username') in ['unavailable','unknown','NotPresent','SYSTEM']) and
is_state('binary_sensor.kallen_desktop_on','off') %}
false
{% elif (is_state('binary_sensor.kallen_desktop_idle','on') or
states('sensor.kallen_desktop_current_username') in ['unavailable','unknown','NotPresent','SYSTEM']) and
is_state('binary_sensor.tony_desktop_on','off') %}
false
{% else %}
true
{% endif %}
- name: "Tina Desk Occupied"
unique_id: 09969610-28ed-4f06-87c7-eabe5412d954
device_class: occupancy
state: >
{% if is_state('binary_sensor.tina_desktop_on','off') %}
false
{% elif is_state('binary_sensor.tina_desktop_idle','on') or states('sensor.xia_desktop_current_username') in ['unavailable','unknown','NotPresent'] %}
false
{% else %}
true
{% endif %}
- name: "Upstairs Bathroom Occupied"
unique_id: 7ec69a26-1013-4b0d-8662-a91ab9f040ca
device_class: occupancy
state: "{{ is_state('timer.upstairs_bathroom_motion_timer','active') or is_state('binary_sensor.upstairs_bathroom_motion','on') or is_state('input_boolean.shower_mode','on') }}"
- name: "Master Bedroom Occupied"
unique_id: 407911c0-f2d3-41f5-8f1c-09fbfb10a49d
device_class: occupancy
state: >
{{ is_state('binary_sensor.master_bedroom_motion','on') or
is_state('light.master_bedroom_lights','on') or
is_state('light.master_bedroom_closet','on') or
is_state('input_boolean.master_bedroom_sleeping','on') or
states('media_player.master_bedroom_chromecast') not in ['off','unavailable','unknown'] }}
delay_off: "00:00:15"
- name: "Kallen Bedroom Occupied"
unique_id: d3fdbaee-48bd-44df-820e-6cbfd3d24c11
device_class: occupancy
state: >
{{ is_state('binary_sensor.kallen_bedroom_motion','on') or
is_state('light.kallen_bedroom_lights','on') or
is_state('input_boolean.kallen_sleeping','on') }}
delay_off: "00:00:15"
- name: "Emma Bedroom Occupied"
unique_id: d775db9a-187d-4c4b-a49d-f0e5a1e6ce3b
device_class: occupancy
state: >
{{ is_state('light.emma_bedroom_light','on') or
is_state('input_boolean.emma_sleeping','on') or
is_state('binary_sensor.emma_bedroom_motion','on') or
is_state('timer.emma_bedroom_motion_timer','active') }}
delay_off: "00:00:15"
- name: "Living Room Occupied"
unique_id: 25623e3d-d74f-471e-8c2d-abce16646282
device_class: occupancy
state: >
{{ is_state('binary_sensor.living_room_front_motion','on') or is_state('binary_sensor.living_room_back_motion','on')}}
delay_off: "00:15:00"
- name: "Downstairs Bathroom Occupied"
unique_id: fad33281-1c1a-4362-93e6-398334358027
device_class: occupancy
state: >
{{ is_state('binary_sensor.downstairs_bathroom_motion','on') or is_state('timer.downstairs_bathroom_lights_timer','active') }}
delay_off: "00:00:15"
- name: "Stairwell Occupied"
unique_id: ab80b307-820e-4f82-86f2-c08f97245107
device_class: occupancy
state: >
{{ is_state('binary_sensor.stairwell_motion','on') or
is_state('timer.stairwell_motion_timer','active') }}
- name: "Mud Room Occupied"
unique_id: 6498e6d9-01ea-48fc-ae36-d8c0c18e45b7
device_class: occupancy
state: >
{{ is_state('binary_sensor.mud_room_motion','on') or
is_state('timer.mud_room_motion_timer','active') }}
- name: "Upstairs Hallway Occupied"
unique_id: c4e5514a-d959-451d-984c-6235492a46f4
device_class: occupancy
state: >
{{ is_state('binary_sensor.stairwell_top_motion','on') }}
delay_off: "00:00:15"
- sensor:
- unique_id: people_at_home
name: People at Home
state: >
{%- set people = expand('group.family') %}
{{ people | selectattr('state', 'in', ['home', 'on'] ) | list | count }}
icon: >
{%- set icons = ['account-off', 'account', 'account-multiple'] %}
{%- set people = expand('group.family') %}
{%- set cnt = people | selectattr('state', 'in', ['home', 'on'] ) | list | count %}
{%- if cnt >= 0 %}
mdi:{{ icons[cnt] if cnt in range(icons | count) else 'account-group' }}
{%- else %}
mdi:account-alert
{%- endif %}
unit_of_measurement: ''
attributes:
template: people_tracker
people: >
{%- set people = expand('group.family') | selectattr('state', 'eq', 'home') | map(attribute='name') | list %}
{%- set company = expand('group.family') | selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
{%- set people = people + company %}
{{ people }}
and: >
{%- set people = expand('group.family') | selectattr('state', 'eq', 'home') | map(attribute='name') | list %}
{%- set company = expand('group.family') | selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
{%- set people = people + company %}
{%- if people | count > 0 %}
{{- [people[:-1] | join(', '), 'and', people[-1]] | join(' ') if people | count > 1 else people[0] }}
{%- else %}unknown
{%- endif %}
or: >
{%- set people = expand('group.family') | selectattr('state', 'eq', 'home') | map(attribute='name') | list %}
{%- set company = expand('group.family') | selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
{%- set people = people + company %}
{%- if people | count > 0 %}
{{- [people[:-1] | join(', '), 'or', people[-1]] | join(' ') if people | count > 1 else people[0] }}
{%- else %}unknown
{%- endif %}
count: >
{%- set people = expand('group.family') | selectattr('state', 'eq', 'home') | map(attribute='name') | list %}
{%- set company = expand('group.family') | selectattr('state', 'eq', 'on') | map(attribute='name') | list %}
{%- set people = people + company %}
{{ people | count }}
- unique_id: cddca636-e8b0-4a5c-8c3e-7f2b3c1b31a9
name: People Sleeping Total
state: >
{% set sleeping = [
states.input_boolean.emma_sleeping,
states.input_boolean.kallen_sleeping,
states.input_boolean.master_bedroom_sleeping,
] %}
{{ sleeping | selectattr('state','eq','on') | list | count }}
unit_of_measurement: ''
icon: mdi:sleep
- unique_id: 2620a9d0-01f0-4af4-8438-a0c860735aab
name: "Tony"
state: >-
{% set person = states.person.tony_stork.state %}
{% if person in ['Home','home'] %}
Home
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
Grocery Store
{% elif person in ['Rite Aid'] %}
Pharmacy
{% else %}
{{ states('person.tony_stork') }}
{%- endif %}
icon: >-
{% set person = states.person.tony_stork.state %}
{% if person in ['Home','home'] %}
mdi:home
{% else %}
mdi:car
{% endif %}
- unique_id: 5439165c-f73e-4870-826a-d12c99e35487
name: "Tina"
state: >-
{% set person = states.person.christina_stork.state %}
{% if person in ['Home','home'] %}
Home
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
Grocery Store
{% elif person in ['Rite Aid'] %}
Pharmacy
{% elif person in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %}
Work
{% else %}
{{ states('person.christina_stork') }}
{%- endif %}
icon: >-
{% set person = states.person.christina_stork.state %}
{% if person in ['Home','home'] %}
mdi:home
{% else %}
mdi:car
{% endif %}
- unique_id: d4b4c324-52aa-41e4-b446-8ba0d6b45cd3
name: "Kallen"
state: >-
{% set person = states.person.kallen_stork.state %}
{% if person in ['Home','home'] %}
Home
{% elif person in ['School','Middle School','High School'] %}
School
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
Grocery Store
{% elif person in ['Rite Aid'] %}
Pharmacy
{% else %}
{{ states('person.kallen_stork') }}
{%- endif %}
icon: >-
{% set person = states.person.kallen_stork.state %}
{% if person in ['Home','home'] %}
mdi:home
{% else %}
mdi:car
{% endif %}
- unique_id: 053d3a0a-f5b4-48e0-a8df-4d847d0fe9c3
name: "People"
unit_of_measurement: 'home'
state: >-
{{ states['person'] | selectattr('state','eq','home') | list | count }}
- unique_id: e46e51a6-3c57-4599-840b-fca6884f867e
name: "People"
unit_of_measurement: 'away'
state: >-
{% set people = [
states.person.tony_stork,
states.person.christina_stork,
states.person.kallen_stork,
] %}
{{ people | selectattr('state','ne','home') | list | count }}
mqtt:
sensor:
- name: "Family Status"
unique_id: 47d0cef6-6c95-4e8e-bf89-6c657db6102c
state_topic: "house/family/status"
payload_available: "online"
payload_not_available: "offline"
- name: "Family Arrived"
unique_id: a6574daf-5345-43b9-90c8-5e99ce56df0b
state_topic: "house/family/arrived"
payload_available: "online"
payload_not_available: "offline"
- name: "Last Outdoor Presence Trigger"
unique_id: f16493e7-0344-4f2b-94b4-2c89ab0e3eb6
state_topic: "house/presence/outdoor/last_trigger"
payload_available: "online"
payload_not_available: "offline"
intent_script:
GetLocation:
speech:
text: >
{% set location = states(person) %}
{% set name = state_attr(person,'friendly_name') %}
{% if location in ['away','not_home'] %}
{{ name }} is currently away from home
{% elif location in ['unavailable','unknown'] %}
I do not have a current location for {{ name }}
{% else %}
{{ name }} is currently at {{ location }}
{% endif %}
automation:
# - id: 395ebb76-83e4-4a7c-913e-2598fef3d5c1
# alias: Doorbell Alert
# trigger:
# - alias: "Doorbell Rings"
# platform: state
# entity_id: binary_sensor.front_doorbell_ding_mqtt
# from: "off"
# to: "on"
# condition:
# - alias: "Are we home?"
# condition: state
# entity_id: binary_sensor.parents_home
# state: "on"
# action:
# - alias: "Save Current Light State"
# service: scene.create
# data:
# scene_id: doorbell_lights_restore
# snapshot_entities:
# - light.living_room_overhead
# - light.living_room_led_strip
# - light.tina_lamp_top
# - light.tina_lamp_side
# - alias: "Save Current Adaptive State"
# service: scene.create
# data:
# scene_id: doorbell_adaptive_restore
# snapshot_entities:
# - switch.adaptive_lighting_tina_lamp
# - switch.adaptive_lighting_living_room
# - alias: "Turn Adaptive Lighting off"
# service: switch.turn_off
# target:
# entity_id:
# - switch.adaptive_lighting_tina_lamp
# - switch.adaptive_lighting_living_room
# - alias: "Turn Lights On"
# service: light.turn_on
# target:
# entity_id:
# - light.living_room_lights
# - light.tina_lamp
# - light.living_room_led_strip
# data:
# color_name: green
# - alias: "Make LED strip flash"
# service: lifx.effect_pulse
# target:
# entity_id: light.living_room_led_strip
# data:
# power_on: true
# mode: ping
# period: 1
# cycles: 30
# color_name: white
# brightness: 255
# - alias: "End early if door opened"
# wait_template: "{{ is_state('binary_sensor.front_door','on') }}"
# timeout:
# seconds: 30
# - alias: "Return lights to previous state"
# service: scene.turn_on
# target:
# entity_id: scene.doorbell_lights_restore
# - delay:
# seconds: 3
# - alias: "Stop LED strip effect"
# service: lifx.effect_stop
# target:
# entity_id: light.living_room_led_strip
# - alias: "Return Adaptive Lighting to previous state"
# service: scene.turn_on
# target:
# entity_id: scene.doorbell_adaptive_restore
- id: 481e7756-9549-413f-9b41-5b0f8c5f5cba
alias: iOS Skip Away Mode
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: 'SKIP_AWAY'
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.away_mode_skipped
- id: 1061c626-17c1-4f0b-8f55-2afc60ef8a3a
alias: Vacation Mode
trigger:
- platform: template
value_template: >
{% set tony = states('sensor.tony_s_iphone_travel_time_min') | float %}
{% set tina = states('sensor.tinas_iphone_travel_time_min') | float %}
{{ is_state('input_boolean.vacation_mode','off') and (tony >= 90) and (tina >= 90) }}
id: leave-radius
- platform: state
entity_id: binary_sensor.parents_home
not_from: unavailable
to: 'on'
id: arrive-home
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- choose:
- conditions:
- condition: trigger
id: leave-radius
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.vacation_mode
- conditions:
- condition: trigger
id: arrive-home
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.vacation_mode
- id: d759a27e-5e7a-4b2c-bf0c-e4378f38dc17
alias: Vacation Tasks
description: Tasks to run when vacation mode is triggered
mode: restart
trigger:
- platform: state
entity_id: input_boolean.vacation_mode
to: 'on'
not_from:
- 'unknown'
- 'unavailable'
id: vacation-on
- platform: state
entity_id: input_boolean.vacation_mode
to: 'off'
not_from:
- 'unknown'
- 'unavailable'
id: vacation-off
condition:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
action:
- choose:
- conditions:
- condition: trigger
id: vacation-on
sequence:
- service: fan.turn_off
target:
entity_id: all
- service: climate.set_hvac_mode
target:
entity_id: climate.master_bedroom_aircon
data:
hvac_mode: 'off'
- if:
- condition: state
entity_id: switch.presence_simulation
state: 'off'
then:
- service: light.turn_off
target:
entity_id: all
- service: switch.turn_on
target:
entity_id: switch.presence_simulation
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.front_porch_light_on
- input_boolean.audible_notifications
- input_boolean.master_bedroom_cooling_on
- service: automation.turn_on
target:
entity_id:
- automation.auto_night_porch_light
- automation.vacation_lighting
- if:
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'on'
then:
- service: light.turn_on
target:
entity_id: light.front_porch_light
- conditions:
- condition: trigger
id: vacation-off
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.front_porch_light_on
- service: automation.turn_off
target:
entity_id:
- automation.auto_night_porch_light
- automation.vacation_lighting
data:
stop_actions: true
- if:
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'on'
then:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.master_bedroom_cooling_on
- delay:
seconds: 1
- if:
- condition: template
value_template: >
{% set heat = [
states.input_boolean.hot_day,
states.binary_sensor.heat_warning,
states.binary_sensor.heat_threshold,
states.binary_sensor.heat_index_threshold
] %}
{% set number = heat | selectattr('state','eq','on') | list | count | int %}
{{ number > 0 }}
then:
- service: fan.turn_on
target:
entity_id:
- fan.kallen_bedroom_fan
- fan.emma_air_conditioner
- service: button.press
target:
entity_id: button.master_bedroom_climate_reset
- if:
- condition: template
value_template: >
{% from 'time.jinja' import ct %}
{% set begin = state_attr('input_datetime.audible_notification_on','timestamp') %}
{% set end = state_attr('input_datetime.audible_notification_off','timestamp') %}
{% set ct = ct() | int %}
{{ begin < ct < end }}
then:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.audible_notifications
- id: 6d668686-c88e-4eae-9b91-1a2bdebce290
alias: Auto Night Porch Light
description: Turn porch light on at night and off during day. To be used primarily with vacation mode.
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.early_night_mode
to: 'on'
id: night-on
- platform: state
entity_id: binary_sensor.early_night_mode
to: 'off'
id: night-off
action:
- choose:
- conditions:
- condition: trigger
id: night-on
sequence:
- service: light.turn_on
target:
entity_id: light.front_porch_light
- conditions:
- condition: trigger
id: night-off
sequence:
- service: light.turn_off
target:
entity_id: light.front_porch_light
- id: 6017b580-44bc-48f2-adfe-52540eb9c1e2
alias: Echo Dot Room Presence
description: This is mostly so that if I go into the basement before everybody wakes up, it unmutes the echo dot
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.basement_occupied
from: 'off'
to: 'on'
id: basement-occupied
condition:
- condition: state
entity_id: binary_sensor.people_sleeping
state: 'on'
action:
- service: switch.turn_off
target:
entity_id: switch.basement_echo_dot_do_not_disturb_switch
script:
family_is_away:
alias: Family Is Away
sequence:
- condition: state
entity_id: binary_sensor.parents_home
state: 'off'
- service: script.text_notify
data:
who: >
{% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %}
nerds
{% else %}
all
{% endif %}
type: alert
title: "Everyone Left"
message: "Away Mode arming in 1 minute"
tag: skip-away
actions:
- action: "SKIP_AWAY"
title: Skip Away Mode
icon: mdi:debug-step-over
- wait_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('binary_sensor.parents_home','on') }}"
continue_on_timeout: true
timeout:
minutes: 1
- service: script.text_notify
data:
type: alert
who: all
message: "clear_notification"
tag: skip-away
- if:
- condition: template
value_template: "{{ not wait.completed }}"
then:
- service: light.turn_off
target:
area_id:
- basement_studio
- furnace_room
- kallen_bedroom
- living_room
- master_bedroom
- master_bedroom_closet
- mud_room
- emma_bedroom
- upstairs_hallway
- downstairs_bathroom
- upstairs_bathroom
- tina_desk
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.white_noise_kallen_bedroom
- input_boolean.white_noise_emma_bedroom
- if:
- condition: template
value_template: >
{% set heat = [
states.input_boolean.hot_day,
states.binary_sensor.heat_warning,
states.binary_sensor.heat_threshold,
states.binary_sensor.heat_index_threshold
] %}
{% set number = heat | selectattr('state','eq','on') | list | count | int %}
{{ number == 0 }}
then:
- service: fan.turn_off
target:
area_id:
- basement_studio
- kallen_bedroom
- master_bedroom
- emma_bedroom
else:
- service: fan.turn_off
target:
area_id:
- basement_studio
- master_bedroom
- delay:
seconds: 5
- service: switch.turn_on
target:
entity_id:
- switch.adaptive_lighting_basement_studio
- switch.adaptive_lighting_living_room
- switch.adaptive_lighting_downstairs_bathroom
- switch.adaptive_lighting_tina_lamp
- switch.adaptive_lighting_mud_room
- switch.adaptive_lighting_upstairs_hallway
- switch.adaptive_lighting_upstairs_bathroom
- switch.adaptive_lighting_master_bedroom
- switch.adaptive_lighting_kallen_bedroom
- switch.adaptive_lighting_emma_bedroom
- service: input_text.set_value
target:
entity_id:
- input_text.basement_studio_selected_scene
- input_text.living_room_selected_scene
- input_text.downstairs_bathroom_selected_scene
- input_text.mud_room_selected_scene
- input_text.tina_lamp_selected_scene
- input_text.upstairs_hallway_selected_scene
- input_text.upstairs_bathroom_selected_scene
- input_text.master_bedroom_selected_scene
- input_text.kallen_bedroom_selected_scene
- input_text.emma_bedroom_selected_scene
data:
value: Adaptive
- service: media_player.turn_off
target:
entity_id: media_player.living_room_tv
- service: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.nerdhome_alarm_panel
else:
- stop: Away Mode Skipped
mode: single
icon: mdi:shield-lock
family_is_home_day:
alias: Family Is Home Day
sequence:
- if:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
then:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.vacation_mode
- service: switch.turn_off
target:
entity_id: switch.presence_simulation
- if:
- condition: state
entity_id: input_boolean.away_mode_skipped
state: 'on'
then:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.away_mode_skipped
- stop: Away Mode was skipped
- service: light.turn_off
target:
area_id:
- living_room
- tina_desk
- mud_room
- furnace_room
- kallen_bedroom
- emma_bedroom
- master_bedroom
- upstairs_hallway
- basement_studio
- downstairs_bathroom
- upstairs_bathroom
- service: script.turn_on
target:
entity_id:
- script.welcome_home
- script.volume_reset
- service: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.nerdhome_alarm_panel
- service: switch.turn_off
target:
entity_id:
- switch.basement_echo_dot_do_not_disturb_switch
- switch.living_room_echo_dot_do_not_disturb_switch
- switch.master_bedroom_echo_dot_do_not_disturb_switch
- if:
- condition: template
value_template: >
{% set weather = states('weather.iron_nerd_weather_station') %}
{{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }}
then:
- service: light.turn_on
target:
area_id:
- front_porch
- living_room
- mud_room
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tina_desk_lights
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: input_select.select_option
target:
entity_id:
- input_select.living_room_scenes
- input_select.mud_room_scenes
data:
option: Adaptive
mode: single
icon: mdi:home-account
family_is_home_night:
alias: Family Is Home Night
sequence:
- if:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
then:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.vacation_mode
- service: switch.turn_off
target:
entity_id: switch.presence_simulation
- if:
- condition: state
entity_id: input_boolean.away_mode_skipped
state: 'on'
then:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.away_mode_skipped
- stop: Away Mode was skipped
- service: script.turn_on
target:
entity_id:
- script.welcome_home
- script.volume_reset
- service: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.nerdhome_alarm_panel
- service: switch.turn_off
target:
entity_id:
- switch.basement_echo_dot_do_not_disturb_switch
- switch.living_room_echo_dot_do_not_disturb_switch
- switch.master_bedroom_echo_dot_do_not_disturb_switch
- service: light.turn_on
target:
area_id:
- living_room
- mud_room
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tina_desk_lights
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: input_select.select_option
target:
entity_id:
- input_select.living_room_scenes
- input_select.mud_room_scenes
data:
option: Adaptive
- service: script.turn_on
target:
entity_id: script.evening_on_second_floor
- service: light.turn_off
target:
area_id:
- furnace_room
- basement_studio
- downstairs_bathroom
mode: single
icon: mdi:home-account