From e99cc40249c428ecd8cecf16af3f5a81b09b61a6 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 25 Apr 2022 23:03:13 -0400 Subject: [PATCH] Added template location sensors --- packages/presence.yaml | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/packages/presence.yaml b/packages/presence.yaml index 113f9f6..148b88c 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -34,6 +34,59 @@ proximity: unit_of_measurement: mi sensor: + - platform: template + sensors: + tony_location: + friendly_name: "Tony" + unit_of_measurement: "" + value_template: >- + {% set person = states.person.tony_stork.state %} + {%- if person in ['Wal-Mart','Kroger','Chief','Meijer'] %} + Grocery Store + {% else %} + {% if person in ['not_home'] %} + {{ state_attr('device_tracker.life360_tony_stork','address') }} + {% else %} + {{ states('person.tony_stork') }} + {%- endif %} + {%- endif %} + - platform: template + sensors: + tina_location: + friendly_name: "Tina" + unit_of_measurement: "" + value_template: >- + {% set person = states.person.christina_stork.state %} + {%- if person in ['Wal-Mart','Kroger','Chief','Meijer'] %} + Grocery Store + {% elif person in ['Chipotle'] and is_state('binary_sensor.tina_work','on') %} + Work + {% else %} + {% if person in ['not_home'] %} + {{ state_attr('device_tracker.life360_christina_stork','address') }} + {% else %} + {{ states('person.christina_stork') }} + {%- endif %} + {%- endif %} + - platform: template + sensors: + kallen_location: + friendly_name: "Kallen" + unit_of_measurement: "" + value_template: >- + {% if is_state('input_boolean.kallen_school', 'on') %} + school + {% elif is_state('calendar.kallen_events', 'on') %} + {{ state_attr('calendar.kallen_events', 'message') }} + {%- elif is_state('person.tony_stork', 'home') and is_state('person.christina_stork', 'home') and is_state('input_boolean.kallen_school', 'off')%} + home + {%- elif is_state('person.tony_stork', 'Hospital') and is_state('input_boolean.kallen_school', 'off')%} + {{ states('sensor.tina_location') }} + {%- elif is_state('person.christina_stork', 'Chipotle') and is_state('input_boolean.kallen_school', 'off')%} + {{ states('sensor.tony_location') }} + {% else %} + Unknown + {%- endif %} - platform: mqtt name: "Family Status" state_topic: "house/family/status"