Template syntax for entity IDs starting with numbers / was:Can't use sensor ID in template

was tempted putting this in the WTH thread… :smirk:

got a template sensor with an id ending in “_energy_output” - it’s working fine, it’s got a state, history, just like every other sensor.

but i just can’t use it in another template as the editor doesn’t seem to like it’s name:

details

wth?

Something to do with the name beginning with a number, I think.

2 Likes

Indeed. Use states("sensor.4850...") notation

indeed, indeed :face_with_hand_over_mouth:

to complete things: there’s no ‘state’ needed/allowed with this notation.

so just
{{ states('sensor.123') }}
gives the current state.

whereas with the ‘other’ notation one needs to ‘select’ the state
{{ states.sensor.abc123.state }}
with ‘.state’ at the end