go to developer tools
this one works
{% set jackie_lat = state_attr('device_tracker.jackie','latitude') %}
{% set jackie_long = state_attr('device_tracker.jackie','longitude') %}
{% set close_devices = namespace(devices=[]) %}
{% for item in states['device_tracker'] %}
{% set entity_id1 = item.entity_id %}
{{ item.state }}
{% if entity_id1 != 'device_tracker.jackie' and item.state != 'home' and item.state == entity_id1 %}
{% set state = states.entity_id1 %}
{% set device_lat = state_attr(entity_id1, 'latitude') %}
{% set device_long = state_attr(entity_id1, 'longitude') %}
{% set distance = distance(jackie_lat, jackie_long, device_lat, device_long) %}
{% if distance <= 1 %}
{% set close_devices.devices = close_devices.devices + [{'entity_id': entity_id1, 'distance': distance}] %}
{% endif %}
{% endif %}
{% endfor %}
{{ close_devices.devices | length > 0 }}
this does not?
{% set jackie_lat = state_attr('device_tracker.jackie','latitude') %}
{% set jackie_long = state_attr('device_tracker.jackie','longitude') %}
{% set close_devices = namespace(devices=[]) %}
{% for item in states['device_tracker'] %}
{% set entity_id1 = item.entity_id %}
{{ item.state }}
{% if entity_id1 != 'device_tracker.jackie' and item.state != 'home' %}
{% set state = states.entity_id1 %}
{% set device_lat = state_attr(entity_id1, 'latitude') %}
{% set device_long = state_attr(entity_id1, 'longitude') %}
{% set distance = distance(jackie_lat, jackie_long, device_lat, device_long) %}
{% if distance <= 1 %}
{% set close_devices.devices = close_devices.devices + [{'entity_id': entity_id1, 'distance': distance}] %}
{% endif %}
{% endif %}
{% endfor %}
{{ close_devices.devices | length > 0 }}
checking to see if device_tracker is not jackie and not home causes error TypeError: ‘<=’ not supported between instances of ‘NoneType’ and ‘int’.
this works
{% if entity_id1 != ‘device_tracker.jackie’ and item.state == ‘home’ %}
this does not
{% if entity_id1 != ‘device_tracker.jackie’ and item.state != ‘home’ %}
this does not work
{% if entity_id1 != ‘device_tracker.jackie’ %}
yet this works
{% if entity_id1 != ‘device_tracker.jackie’ and item.state != ‘home’ and item.state == entity_id1 %}
huh?