Sensor gives unknown

There’s the problem. See the first result? It reports:

'Undefined: ‘None’ has no attribute ‘state’

That’s the error you get when you supply the name of a non-existent entity.

Try this and you’ll get the same error message:

{{ states.sensor.abcxyz.state }}

I suspect there’s something wrong with the entity’s name. I can’t see what it is from the screenshots but something isn’t quite what it appears to be.

I’m also suspicious of the name. I did an ord() on each of the characters in the name as pasted above in case there was some weird Greek or Cyrillic character in there, but nothing jumped out.

@brinkgit — please try the following, and importantly, don’t use HA autocompletions when typing:

{{ states.sensor|selectattr('entity_id','>','sensor.wd')|selectattr('entity_id','<','sensor.wf')|list }}

Assuming that gives you a list of items each starting with “<template”, count which item your sensor is starting from 0, and try this with your number in place of the X:

{{ (states.sensor|selectattr('entity_id','>','sensor.wd')|selectattr('entity_id','<','sensor.wf')|list)[X].state }}

Hello:

Tried this:

{{ states.sensor|selectattr('entity_id','>','sensor.wd')|selectattr('entity_id','<','sensor.wf')|list }}

and the name of the sensor did not show up at all.

Changed the name from

sensor.weer_buiten_trend_luchtdruk
to
sensor.weer_buiten_trend

and now it works.

Thanks for the help!!!

That is bizarre. I’m glad it’s fixed for you but I’d love to know what caused that. I even set up my own sensor, by pasting in your definition in your first post and just changing the URL:

- resource: https://mydomain/process.json?presstrend
  scan_interval: 600
  sensor:
    - name: weer_buiten_trend_luchtdruk
      value_template: >-
          {{ value_json.presstrend }}

with that URL set up to send {"presstrend": "Rising slowly"} and it works fine:

So it’s not something about the characters in the name that HA (my installation, at least) doesn’t like.

As I had mentioned in my previous post, there was something wrong with the sensor’s name because this:
{{ states.sensor.weer_buiten_trend_luchtdruk.state }}
produced the same error as when the sensor doesn’t exist.

I agree with Troon that it’s bizarre because Home Assistant creates entity names that adhere to a very strict format (restricted to basic ASCII alphanumeric characters and underscores). One can theorize what might have gone wrong but now there’s no way to confirm it.

Anyway, part of the mystery was solved.