Tweaking location sensors and presence things.

This commit is contained in:
Jeffrey Stone 2022-02-24 23:29:25 -05:00
parent aee5b1e79b
commit 914e65f0df
1 changed files with 259 additions and 257 deletions

View File

@ -20,6 +20,7 @@ input_datetime:
has_time: true
# Testing Proximity Sensors
proximity:
home_jeff:
@ -46,8 +47,8 @@ sensor:
- platform: template
sensors:
jeff_location:
friendly_name: "Jeff's Current Location"
unit_of_measurement: ''
friendly_name: "Jeff"
unit_of_measurement: ""
value_template: >-
{% set person = states.person.jeffrey.state %}
{%- if person in ['Sprouts','Kroger1','Kroger2'] %}
@ -58,37 +59,37 @@ sensor:
Super Store
{% else %}
{% if person in ['not_home'] %}
{{ states.device_tracker.life360_jeffrey_stone.attributes.address }}
{{ state_attr('device_tracker.life360_jeffrey_stone','address') }}
{% else %}
{{ states.person.jeffrey.state }}
{{ states('person.jeffrey') }}
{%- endif %}
{%- endif %}
- platform: template
sensors:
skylar_location:
friendly_name: "Skylar's Current Location"
unit_of_measurement: ''
friendly_name: "Skylar"
unit_of_measurement: ""
value_template: >-
{% if is_state('input_boolean.skylar_school', 'on') %}
school
{% elif is_state('calendar.skylar_events', 'on') %}
{{ states.calendar.skylar_events.attributes.message }}
{{ state_attr('calendar.skylar_events', 'message') }}
{%- elif is_state('person.jeffrey', 'home') and is_state('person.katherine', 'home') and is_state('input_boolean.skylar_school', 'off')%}
home
{%- elif is_state('person.jeffrey', 'Summit') and is_state('input_boolean.skylar_school', 'off')%}
{{ states.sensor.kat_location.state }}
{{ states('sensor.kat_location') }}
{%- elif is_state('person.katherine', 'ZooAtlanta') and is_state('input_boolean.skylar_school', 'off')%}
{{ states.person.jeffrey.state }}
{{ states('person.jeffrey') }}
{% else %}
{{ states.person.skylar.state }}
Unknown
{%- endif %}
- platform: template
sensors:
kat_location:
friendly_name: "Kat's Current Location"
unit_of_measurement: ''
friendly_name: "Kat"
unit_of_measurement: ""
value_template: >-
{% set person = states.person.katherine.state %}
{% set person = states('person.katherine') %}
{%- if person in ['Sprouts','Kroger1','Kroger2'] %}
Grocery Store
{% elif person in ['HomeDepot','Lowes'] %}
@ -99,9 +100,9 @@ sensor:
{%- if person in ['ZooAtlanta'] %}
Zoo Atlanta
{% elif person in ['not_home'] %}
{{ states.device_tracker.life360_kat_stone.attributes.address }}
{{ state_attr('device_tracker.life360_kat_stone', 'address') }}
{% else %}
{{ states.person.katherine.state }}
{{ states('person.katherine') }}
{%- endif %}
{%- endif %}
- platform: mqtt
@ -134,19 +135,19 @@ automation:
trigger:
- platform: state
entity_id: binary_sensor.skylar_bedroom_motion_occupancy
to: 'on'
from: 'off'
to: "on"
from: "off"
- platform: state
entity_id: binary_sensor.skylar_room_occupancy
to: 'on'
from: 'off'
to: "on"
from: "off"
condition:
- condition: time
after: '05:00:00'
before: '08:30:00'
after: "05:00:00"
before: "08:30:00"
- condition: state
entity_id: input_boolean.skylar_awake
state: 'off'
state: "off"
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.skylar_awake_at
@ -154,6 +155,8 @@ automation:
time: "{{ now().strftime('%H:%M') }}"
- service: input_boolean.turn_on
entity_id: input_boolean.skylar_awake
- service: switch.turn_off
entity_id: switch.rainbow_light
- id: skylar_early_morning_tv
alias: Skylar Early Morning TV
@ -161,18 +164,21 @@ automation:
trigger:
- platform: state
entity_id: media_player.theater_tv
to: 'off'
from: 'on'
to: "on"
from: "off"
- platform: state
entity_id: media_player.croft_tv
to: 'playing'
to: "playing"
condition:
- condition: time
after: '05:00:00'
before: '08:30:00'
after: "05:00:00"
before: "08:30:00"
- condition: state
entity_id: input_boolean.skylar_dressed_reminder
state: 'off'
state: "off"
- condition: state
entity_id: input_boolean.skylar_awake
state: "on"
action:
- service: script.status_annc
data:
@ -200,8 +206,8 @@ automation:
entity_id: input_boolean.kat_travel_monitor
- service: script.status_annc
data:
who: '{{ states.sensor.room_presence.state }}'
speech_message: 'Kat has arrived at work.'
who: "{{ states('sensor.room_audio') }}"
speech_message: "Kat has arrived at work."
- id: kat_leaves_zoo
alias: Kat Leaves Zoo Notification
@ -216,11 +222,10 @@ automation:
entity_id: input_boolean.kat_travel_monitor
- service: script.status_annc
data_template:
who: '{{ states.sensor.room_presence.state }}'
who: "{{ states('sensor.room_audio') }}"
call_interpruption: 1
call_kat_location: 1
- id: skylar_at_school
alias: Skylar is at School
trigger:
@ -247,7 +252,7 @@ automation:
- fri
- condition: state
entity_id: input_boolean.skylar_school
state: 'off'
state: "off"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.skylar_school
@ -283,7 +288,7 @@ automation:
- fri
- condition: state
entity_id: input_boolean.skylar_school
state: 'on'
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.skylar_school
@ -293,8 +298,6 @@ automation:
message: "Skylar has been picked up from school."
initial_state: true
- id: jeff_arrives_summit
alias: Jeff Arrives At Summit
trigger:
@ -307,19 +310,21 @@ automation:
data:
who: "kat"
message: "Jeff has arrived at Summit"
initial_state: true
- id: jeff_arrives_summit_notification
alias: Notify Kat Jeff At Summit
trigger:
- entity_id: person.jeffrey
event: enter
platform: zone
zone: zone.summit
action:
- service: script.jeff_destination_na
initial_state: true
- id: e1cb15b0-0423-11eb-adc1-0242ac120002
alias: Zone Debugger
trigger:
- platform: state
entity_id: person.jeffrey
condition:
- condition: state
entity_id: input_boolean.jeff_location_debug
state: 'on'
action:
- service: script.jeff_location_debug
- id: jeff_leaves_summit
alias: Jeff Leaves Summit
initial_state: true
@ -343,8 +348,8 @@ automation:
- person.uncle_matt
- person.papa
- person.skylar
from: 'not_home'
to: 'home'
from: "not_home"
to: "home"
action:
- choose:
- conditions:
@ -361,10 +366,10 @@ automation:
add_entities: >-
{{ trigger.to_state.entity_id }}
- wait_template: "{{ is_state('binary_sensor.laundry_room_door', 'on') }}"
timeout: '00:3:00'
timeout: "00:3:00"
- service: script.status_annc
data_template:
who: '{{ states.sensor.room_presence.state }}'
who: "{{ states.sensor.room_presence.state }}"
call_interuption: 1
speech_message: >
{% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
@ -417,7 +422,6 @@ automation:
entity_id: input_boolean.guest_mode
initial_state: true
- id: disable_bad_traffic_home_jeff
alias: Disabling Jeff Bad Traffic Home
initial_state: true
@ -431,7 +435,7 @@ automation:
condition:
- condition: state
entity_id: input_boolean.jeff_traffic_alert_home
state: 'on'
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.jeff_traffic_alert_home
@ -440,22 +444,15 @@ script:
family_is_home:
sequence:
- condition: state
entity_id: sensor.family_status
state: Away
entity_id: group.family
state: "home"
- service: script.standby
- service: mqtt.publish
data:
topic: house/family/status
payload_template: Home
retain: true
- service: script.turn_on
entity_id: script.welcome_briefing
family_is_away:
sequence:
- condition: state
entity_id: sensor.family_status
state: Home
entity_id: group.family
state: "not_home"
- service: script.appliances_off
- service: scene.turn_on
entity_id: scene.lights_out
@ -463,11 +460,6 @@ script:
entity_id: input_boolean.sentry_mode
- service: scene.turn_on
entity_id: scene.all_fans_off
- service: mqtt.publish
data:
topic: house/family/status
payload_template: Away
retain: true
- service: input_boolean.turn_on
entity_id: input_boolean.welcome_home
@ -480,3 +472,13 @@ script:
time: "00:00:00"
- service: input_boolean.turn_off
entity_id: input_boolean.skylar_awake
jeff_location_debug:
sequence:
- condition: state
entity_id: input_boolean.jeff_location_debug
state: 'on'
- service: script.text_alert
data:
who: jeff
message: "Jeff is at {{ states('person.jeffrey') }}"