Skip to content

Instantly share code, notes, and snippets.

@suhlig
Created February 20, 2023 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhlig/e49dc9e9b0a9398458abed436b427154 to your computer and use it in GitHub Desktop.
Save suhlig/e49dc9e9b0a9398458abed436b427154 to your computer and use it in GitHub Desktop.
Dealing with attributes in HA templates
{% set SENSOR = 'device_tracker.hexa' -%}
{{ SENSOR }} manufactured by {{ device_attr(SENSOR, 'manufacturer') }}
Attributes:
{% for attr in states[SENSOR].attributes -%}
- {{ attr }}: {{state_attr(SENSOR, attr)}}
{% endfor %}
hexa has {{ state_attr('device_tracker.hexa', 'AP SSID') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment