So far I’ve been loving the GPS tracking with the iOS app. ‘Home’ status is fine, but ‘Away’ is less useful. Would something like my mockup below be possible? If the device is ‘Away’ replace it with its distance from home. I already have the Waze travel time sensor working with each of my devices.
You could use a template sensor for each person.
If home set the tracker sate as the template sensor value. If not_home set the travel time sensor as the template sensor value.
Is there a way for a template to have a similar layout, with a photo, name and time?
Yep.
I’ve been trying a few things to get this working. i"m not sure how to get the ‘if’ and ‘else’ statements displaying another sensor. Any ideas?
sensor:
- platform: template
sensors:
familytest:
friendly_name: "FamilyTest"
value_template: >-
{% if is_state('device_tracker.me', 'Home') %}
Home
{% else %}
value_template: >-
{{ states('sensor.travel_time') }}
unit_of_measurement: 'Minutes'
{% endif %}
Try this:
sensor:
- platform: template
sensors:
familytest:
friendly_name: "FamilyTest"
value_template: >-
{% if is_state('device_tracker.me', 'Home') %}
Home
{% else %}
{{ states('sensor.travel_time') }}
{% endif %}
unit_of_measurement: 'Minutes'
I’m not sure you’ll be able to use the unit of measurement though, because the value can sometimes be the string ‘Home’.
Yes it ended up ending in minutes no matter what, like ‘Home Minutes’. I fixed it using this. Thank you so much!
sensor:
- platform: template
sensors:
familytest:
friendly_name: "FamilyTest"
value_template: >-
{% if is_state('device_tracker.me', 'home') %}
Home
{% else %}
{{ states('sensor.travel_time') }}
Minutes
{% endif %}
1 Like
Can you share the code of the sensor.travel_time? Did you use waze component?