I am having trouble understanding how to modify my “someone_home” sensor to ignore the ‘unavailable’ or ‘unknown’ states. I am using Life360 for location tracking and whenever the service is unreachable, the sensor switches to no one is home. Here’s the sensor template code. What is the right way to identify both sensors (me and my wife) and ignore unavailable or unknown?
The intent is to not change the state of the someone_home sensor if either tracker is ‘unknown’ or ‘unavailable’. If there’s a better way to do this, I am open to ideas!
platform: template
sensors:
someone_home:
friendly_name: Someone Home
icon_template: >-
{% if is_state('binary_sensor.someone_home','on') %}
mdi:home-account
{% else %}
mdi:home-outline
{% endif %}
value_template: >-
{%- if (states('device_tracker.me') not in ['unavailable','unknown']) and (states('device_tracker.wife') not in ['unavailable','unknown']) -%}
{{ is_state('device_tracker.me','home') or is_state('device_tracker.wife','home') }}"
{%- else -%}
{{ states('binary_sensor.someone_home') }}
{%- endif -%}
1 post - 1 participant