Unable to set a device_tracker with entity_picture_template

I’m looking to change my device_tracker entity_picture based on a value.

In customize.yaml I can successfully set my entity_picture to a static value:

person.my_name:
  entity_picture: "/local/profiles/my_pic.png"

However entity_picture**_template** results in lovelace reverting back to the icon (no entity_picture). Here’s my code.

person.my_name:
  entity_picture_template: >-
    {% if is_state('sun.sun', 'above_horizon') %}
      "/local/profiles/my_pic_one.png"
  {% else %}
    "/local/profiles/my_pic_two.png"
  {% endif %}

entity_picture_template works on sensors, but I’m having difficulty with device_trackers.

1 Like