States can be more than just binary values, AFAIK, but even so… If the state is literally'unknown' (as demonstrated by dumping it with the states() above), shouldn’t testing for it with is_state() return True?
A couple things, what’s the expected data format for sensor.home_realfeal_temperature? If it’s anything but a string, then your is_state will return False because you can’t compare a value and a string.
Other thing I can think of and I have encountered this when restarting HA is the frontend and using states() will return unknown and visually it will be displayed as unknown but in reality HA has no clue what the sensor’s value is so it can’t even compare against unknown. I work in Industrial Automation and frequently see issues around compare statements of numeric values and when a sensor or register overflows and therefore is unknown, I get “QNaN is not a number!” errors. I can’t compare against QNaN.
Thank you! I understand and I have considered this, I’ve tried unquoting unknown, but my Python/Jinja skills suck, so I didn’t really understand what was going on behind the scenes.
Let me rephrase my question then…
How can I check to see whether a certain entity exists?
I want to {% set %} a certain value to another variable depending on whether a certain integration exists and, in turn, whether the sensor.home_realfeel_temperature entity is available and has a state value or not.