How can I tell if a sensor can be used in numeric_state for automation?

Hi, I’m trying to use some sensors in an automation, but it seems even though the sensor is a number, the numeric_state automation gives an error:

Error rendering data template: UndefinedError: 'None' has no attribute 'state'

I think that the sensor could be giving a string value.

How can I determine if a sensor is a number or a string?


It would appear that the error message is not referring to string vs number issue. It’s complaining about attempting to get the attribute state from something it can’t find (None).

Please post the automation in question as well as the configuration of the sensors it uses.

Ah, thanks, that makes sense, it helped find what was causing the issue.

It was that I was indeed using the wrong way of accessing the state value.

I’m using an automation with multiple entities for the trigger, and I was using


to get the value which was giving me the error

turns out:


is what I needed to use :slight_smile: