Incorrect value of template sensor

Hello, I am trying to create a sensor that returns the “worst” air-quality from two different sensors.

when i use {% set netatmo=states('sensor.netatmo_innemodul_air_health') %} and try to compare the state with is_state(netatmo, 'Bra') I get “False” back, even when it is True, see picture:

i.e when i set a variable the value isnt correct/comparable
Am I doing something obvious wrong?

Have you tried {{ is_state(netatmo, 'Bra') }} ?
‘netatmo’ without quotes.

{{ netatmo == 'Bra' }}

good catch, but yields the same result…

My mistake… netatmo already have the state value.

So it should be netatmo == 'Bra'

You use is_state when you have entity_id.

1 Like

That works, and makes sense!
Thank you very much!

the same for p1

1 Like