Hi,
I configured a sensor using the Multiscrape add-on.
This sensor has 24 attributes (I am scraping a timetable).
To display the sensor’s attributes states in a markdown card I use the following template:
{% set d = states.sensor.tram_horaires2.attributes %}
{% for x in d %}
{{ state_attr('sensor.tram_horaires2',x) |replace("\n"," ") | replace("tram_horaires2","")}}
{% endfor%}
By iterating through all attributes, I also bring in the “friendly_name” attribute which I don’t need.
So I replace it with an empty string in the result.
No very elegant.
I tried to use filter rather than a loop:
{{ states.sensor.tram_horaires2 | rejectattr('attributes.friendly_name','ne','tram_horaires2') }}
But this results in
<generator object select_or_reject at 0xffff7bb9c160>
Can you help me figure out how to use the rejectattr filter ?