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

1128 lines
37 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
input_number:
front_door_opened_today:
name: Front Door Opened Today
min: 0
max: 200
step: 1
unit_of_measurement: times
icon: mdi:door-open
back_door_opened_today:
name: Back Door Opened Today
min: 0
max: 200
step: 1
unit_of_measurement: times
icon: mdi:door-open
basement_studio_door_opened_today:
name: Basement Studio Door Opened Today
min: 0
max: 200
step: 1
unit_of_measurement: times
icon: mdi:door-open
downstairs_bathroom_door_opened_today:
name: Downstairs Bathroom Door Opened Today
min: 0
max: 200
step: 1
unit_of_measurement: times
icon: mdi:door-open
proximity:
home_tony:
devices:
- device_tracker.tony_s_iphone
zone: home
tolerance: 5
unit_of_measurement: mi
home_tina:
devices:
- device_tracker.tinas_iphone
zone: home
tolerance: 5
unit_of_measurement: mi
home:
devices:
- device_tracker.tony_s_iphone
- device_tracker.tinas_iphone
zone: home
tolerance: 5
unit_of_measurement: mi
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.life360_tony_stork"
prob_given_true: 0.8
prob_given_false: 0.2
platform: "state"
to_state: "home"
- 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.life360_christina_stork"
prob_given_true: 0.8
prob_given_false: 0.2
platform: "state"
to_state: "home"
- 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.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.life360_kallen_stork"
prob_given_true: 0.8
prob_given_false: 0.2
platform: "state"
to_state: "home"
- 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') }}
- name: "Tony Home"
unique_id: 4f0d8c3d-dc49-4b7a-a1fc-5d286b4a954d
state: "{{ is_state('device_tracker.tony_s_iphone', 'home') or is_state('device_tracker.life360_tony_stork','home') }}"
device_class: presence
- name: "Tina Home"
unique_id: 3d90e515-b204-4510-af0c-6c784fda2bd4
state: "{{ is_state('device_tracker.tinas_iphone', 'home') or is_state('device_tracker.life360_christina_stork','home') }}"
device_class: presence
- name: "Kallen Home"
unique_id: 2419e826-b276-434c-b5c6-e42c065a73ff
state: "{{ is_state('device_tracker.kallen_iphone','home') or is_state('device_tracker.life360_kallen_stork','home') }}"
device_class: presence
- name: "Nerds Home"
unique_id: 2672a6a2-4be4-495c-b479-ffc7c6df67d2
state: "{{ is_state('group.family','home') and (is_state('person.tony_stork','home') or is_state('person.kallen_stork','home')) }}"
device_class: presence
- name: "Parents Home"
unique_id: 8de02d19-60a6-436d-9187-1cfc70d6c297
state: "{{ is_state('group.adults','home') and (is_state('person.tony_stork','home') or is_state('person.christina_stork','home')) }}"
device_class: presence
- name: "Basement Occupied"
unique_id: 20039c29-8b9d-436d-ba6c-8f2c2bda1db0
state: >
{% if 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') and is_state('binary_sensor.kallen_desktop_idle','on') %}
false
{% elif is_state('binary_sensor.tony_desktop_idle','on') and is_state('binary_sensor.kallen_desktop_on','off') %}
false
{% elif is_state('binary_sensor.kallen_desktop_idle','on') and is_state('binary_sensor.tony_desktop_on','off') %}
false
{% else %}
true
{% endif %}
- name: "Upstairs Bathroom Occupied"
unique_id: 7ec69a26-1013-4b0d-8662-a91ab9f040ca
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: "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
- 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: c63364fb-c3cb-44a6-8fba-5d63e3f9c981
name: "Adults Home Fix"
state: >
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
broken
{% elif is_state('group.adults','home') %}
home
{% elif is_state('group.adults','not_home') %}
not_home
{% endif %}
icon: >
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
mdi:alert-circle
{% elif is_state('group.adults','home') %}
mdi:home
{% elif is_state('group.adults','not_home') %}
mdi:home-outline
{% endif %}
- unique_id: f27a1a56-0c7e-46ee-9f21-a48cc1a0421c
name: "Family Home Fix"
state: >
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
broken
{% elif is_state('group.family','home') %}
home
{% elif is_state('group.family','not_home') %}
not_home
{% endif %}
icon: >
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
mdi:alert-circle
{% elif is_state('group.family','home') %}
mdi:home
{% elif is_state('group.family','not_home') %}
mdi:home-outline
{% endif %}
- 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 %}
{% if person in ['not_home','Stationary'] %}
{{ state_attr('device_tracker.life360_tony_stork','address') }}
{% else %}
{{ states('person.tony_stork') }}
{%- endif %}
{%- 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 %}
{% if person in ['not_home','Stationary'] %}
{{ state_attr('device_tracker.life360_christina_stork','address') }}
{% else %}
{{ states('person.christina_stork') }}
{%- endif %}
{%- 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 %}
{% if person in ['not_home','Stationary'] %}
{{ state_attr('device_tracker.life360_kallen_stork','address') }}
{% else %}
{{ states('person.kallen_stork') }}
{%- endif %}
{%- 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 }}
- unique_id: 6a8bb32e-5f4e-4d1f-8e17-77f07e5b174a
name: "Front Door Opened Today"
unit_of_measurement: 'times'
state: >-
{{ states('input_number.front_door_opened_today') | int }}
icon: >-
{% if states('input_number.front_door_opened_today') | int > 0 %}
mdi:door-open
{% else %}
mdi:door-closed
{% endif %}
- unique_id: 77786cc9-64de-4035-a635-e831a3b0ef63
name: "Back Door Opened Today"
unit_of_measurement: 'times'
state: >-
{{ states('input_number.back_door_opened_today') | int }}
icon: >-
{% if states('input_number.back_door_opened_today') | int > 0 %}
mdi:door-open
{% else %}
mdi:door-closed
{% endif %}
- unique_id: 3d74efd0-2df5-438e-a015-26ac1ce2c4ee
name: "Basement Studio Door Opened Today"
unit_of_measurement: 'times'
state: >-
{{ states('input_number.basement_studio_door_opened_today') | int }}
icon: >-
{% if states('input_number.basement_studio_door_opened_today') | int > 0 %}
mdi:door-open
{% else %}
mdi:door-closed
{% endif %}
- unique_id: cdc850bc-3747-405d-8b16-3b79ba9fbc87
name: "Downstairs Bathroom Door Opened Today"
unit_of_measurement: 'times'
state: >-
{{ states('input_number.downstairs_bathroom_door_opened_today') | int }}
icon: >-
{% if states('input_number.downstairs_bathroom_door_opened_today') | int > 0 %}
mdi:door-open
{% else %}
mdi:door-closed
{% endif %}
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: kallen_at_school
alias: Kallen is at School
mode: single
trigger:
- entity_id: person.tony_stork
event: leave
platform: zone
zone: zone.middle_school
- entity_id: person.christina_stork
event: leave
platform: zone
zone: zone.middle_school
- entity_id: person.kallen_stork
event: enter
platform: zone
zone: zone.middle_school
condition:
- condition: time
before: "11:30:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: input_boolean.kallen_at_school
state: "off"
- condition: state
entity_id: input_boolean.kallen_school_today
state: "on"
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_at_school
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_awake
- service: script.text_notify
data:
type: alert
who: parents
message: "Kallen has been dropped off at school."
title: "Kallen Location Alert"
tag: kallen-dropoff
- if:
- condition: state
entity_id: input_boolean.master_bedroom_sleeping
state: 'on'
then:
- service: light.turn_off
target:
entity_id: light.living_room_lights
initial_state: true
- id: kallen_left_school
alias: Kallen left School
mode: single
trigger:
- entity_id: person.tony_stork
event: leave
platform: zone
zone: zone.middle_school
- entity_id: person.christina_stork
event: leave
platform: zone
zone: zone.middle_school
- entity_id: person.kallen_stork
event: leave
platform: zone
zone: zone.middle_school
condition:
- condition: time
after: "11:30:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: input_boolean.kallen_at_school
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.kallen_at_school
- service: script.text_notify
data:
type: alert
who: parents
message: "Kallen has been picked up from school."
title: "Kallen Location Alert"
tag: kallen-pickup
initial_state: true
# - 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: group.adults
# state: "home"
# 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.dining_room_lamp
# - light.tina_lamp_top
# - light.tina_lamp_side
# - light.tina_desk_strip
# - 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 dining room lamp off"
# service: light.turn_off
# target:
# entity_id: light.dining_room_lamp
# - alias: "Turn Lights On"
# service: light.turn_on
# target:
# entity_id:
# - light.living_room_lights
# - light.tina_lamp
# - light.tina_desk_strip
# - 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: 11eee604-db2a-4ab2-a372-70026a4f1a6f
alias: Door Openings Reset
trigger:
- platform: time
at: 00:00
action:
- service: input_number.set_value
target:
entity_id:
- input_number.back_door_opened_today
- input_number.front_door_opened_today
- input_number.basement_studio_door_opened_today
- input_number.downstairs_bathroom_door_opened_today
data:
value: 0
- 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: group.adults
not_from:
- 'unknown'
- 'unavailable'
to: 'home'
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
- service: automation.turn_on
target:
entity_id: automation.auto_night_porch_light
- 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
data:
stop_actions: true
- 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.emma_air_conditioner
- fan.kallen_bedroom_fan
- service: climate.set_hvac_mode
target:
entity_id: climate.master_bedroom_aircon
data:
hvac_mode: cool
- service: climate.set_preset_mode
target:
entity_id: climate.master_bedroom_aircon
data:
preset_mode: eco
- service: climate.set_temperature
target:
entity_id: climate.master_bedroom_aircon
data:
temperature: "{{ states('input_number.master_bedroom_daytime_temp') | int }}"
- service: climate.set_fan_mode
target:
entity_id: climate.master_bedroom_aircon
data:
fan_mode: Auto
- 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_on
target:
entity_id: light.front_porch_light
script:
family_is_away:
alias: Family Is Away
sequence:
- condition: state
entity_id: group.adults
state: not_home
- 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('group.adults','home') }}"
continue_on_timeout: true
timeout:
minutes: 1
- service: script.text_notify
data:
type: alert
who: all
message: "clear_notification"
tag: skip-away
- if:
- "{{ 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
- dining_room
- 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_dining_room_lamp
- 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
- input_text.dining_room_lamp_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
- dining_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
- dining_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
- input_select.dining_room_lamp_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
- dining_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
- input_select.dining_room_lamp_scenes
data:
option: Adaptive
- service: input_select.select_option
target:
entity_id: input_select.upstairs_bathroom_scenes
data:
option: Nightlight
- service: light.turn_off
target:
area_id:
- furnace_room
- kallen_bedroom
- emma_bedroom
- master_bedroom
- upstairs_hallway
- basement_studio
- downstairs_bathroom
mode: single
icon: mdi:home-account