I would like to have a table with entities and temperatures.
My problem is that I don’t know the markdown card well enough to achieve the result.
I can create the Markdown String using Developer Tools > Template
|Entity Name|°F|
|-|-|
{%- for state in states.sensor | selectattr('attributes.unit_of_measurement', '==', '°F') | rejectattr('state', 'in', ['unavailable', 'unknown']) %}
| {{- state.name }} | {{ state.state | int }} {{ state_attr(state.entity_id, 'unit_of_measurement') }} |
{%- endfor %}
which generates a markdown table that when previewed in Markdown looks like this
But I can not figure out how to have a markdown card display the result
I was only able to create a list of entities with temperatures, but I can only show the ‘name’ or the ‘state’ but not both
type: markdown
content: |-
{%
set entities_with_temperature = states.sensor
| selectattr('attributes.unit_of_measurement', 'defined')
| rejectattr('state', 'in', ['unavailable', 'unknown'])
| selectattr('attributes.unit_of_measurement', '==', '°F')
| map(attribute='name')
%}
- {{ entities_with_temperature | join('\n - ') }}
title: Entities with Temperatures
which resulted in this:
But I did that by reading other examples… and not fully understanding.
How do I create a Markdown Card showing Temperatures for Entities with °F Unit Of Measurement?