What is the correct 'states' notation

By trial & error I found out that in some cases I need to use:

states('sensor.xyz')

instead of:

states.sensor.xyz

I spent some hours to find the documentation about ‘states’, but didn’t find a clear description. Which notation should I use in which situation?

That should cover it all fairly well, along with State Objects - Home Assistant

The second of those you wrote returns a state object, the first returns the actual state of the entity.

1 Like

Thnx!!! I am working a month now with HA (coming from Domoticz), but I have to say that I still struggle with the HA documentation and its examples.

If you get stuck, the Discord server has a templates channel