Template sensor unknow despite underlying sensor having a value

Any idea why my template sensor would be showing as unknow?

Here is the underlying sensor

Try the following template:

{{ states.sensor.vehicle_fuel_level_from_engine_ecu.state }}

If the result is the following error message:

UndefinedError: ‘None’ has no attribute ‘state’

then it means Home Assistant can’t find the specified entity.

Someone recently had the same problem and the theory was that a character in the entity’s name wasn’t quite what it appeared to be. It’s just a theory because after the user renamed the entity, the problem resolved itself.

Rename the entity (perhaps just shorten it) and see if it helps.


Which integration produced the sensor?

Same sort of issue

It’s this integration
Torque - Home Assistant (home-assistant.io)

As seems to be a known bug
Torque sensors become unavailabe when Home Assistant is restarted · Issue #31166 · home-assistant/core (github.com)

Are you sure it’s the same bug? The reported bug says the sensors disappeared after a restart.

Your screenshot shows that the sensor exists and contains a value (90.98039). Have you tried renaming it?