I am making a card for my ember mug and part of it I need to list out if the state of the mug is heating, warming or perfect. I’m trying to use this code here, and it works if the mug is heating, but not if it’s cooling or perfect. I also tried playing around with arrays but that didn’t seem to work either. Can someone please point me in the right direction?
{% if states('sensor.ember_mug_state') == ('heating' or 'cooling' or 'perfect') %}
True
{% else %}
False
{% endif %}
OK so that’s working, but now I would like to clean up the config a little bit. I’m looking to perform some actions if the state is in one of those 3 options, so instead of defining it each time I need to reference it, I was thinking I could set a variable. But I can’t figure out how to do that with an if/then statement.
{% set mugstate = {
if states('sensor.ember_mug_state') in ['heating','cooling','perfect']
doingsomething
else
idle
}
edit, I hadn’t bothered with formatting the code because I figured I was far off, good to know I was close