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