Template question: sensors with a specific name without attributes

Hi I struggle with this template. I want to show sensors with a specific name that doesnt have any attributes.

{% for state in states.sensor | selectattr('attributes' is 'undefined') %}
{{ state.name }} - {{ state.state }}
{% endfor %}

Error
TemplateSyntaxError: expected token 'name', got 'string

The other way around works?! Undefined should be supported right?

{% for state in states.sensor | selectattr('attributes','defined') %}
{{ state.name }} - {{ state.state }}
{% endfor %}

But this doesnt have the specific name included yet, any suggestions?

You do see that your operator-use is different between the two, not :slight_smile:

Yes I’m aware
When I give this a try the result is empty. While I expect at least one sensor that doesnt have an attribute

{% for state in states.sensor | selectattr('attributes','undefined') %}
{{ state.name }} - {{ state.state }}
{% endfor %}

Well… that I cannot tell but the erorr you posted was related to the operator, not to the attr

EDIT: I am not sure if entities exist without any attribute content, hence

Hm what I’m looking for is the own defined attributes, not the ones that HA uses(like unit of measurement for instance)

But attributes will always present a list of all (!) attributes, and there is always one called ‘friendly_name’ so always defined. You may need to select differently

I was already afraid of that, I have to look for another solution :frowning:

What you can do is to count the list of attributes and if this is 1 then highly likely the rest is non existing