Climate state and cards

I’ve got a Google Nest thermostat that works great, the state can be either ‘heat’ or ‘off’. With my setup it never changes to off because it remains on heat when the temperature is reached and then becomes idle.

I’m trying to setup a card that changes when the heating is on but can’t seem to get it to work, it must be possible because the customer mushroom climate card does exactly that but I can’t figure out what it is using to identify the difference between heating and idle.

Any pointers would be greatly apprecaited.

You want to use hvac_action: as an attribute in your IF statement.

For example…

card_mod:
 style: |
   ha-card {
    background: {{ 'orange' if state_attr('climate.living_room', 'hvac_action') ==
      'heating' else ' black' }}

That worked great, thanks.