Help with an if statement

Hi,

I have an if statement which isn’t working and I can’t find what’s wrong :roll_eyes:

The if statement checks if the has_firmware_update attribute for a Shelly device to see if there is an update available. The device in question has an update available so the has_firmware_update is ‘true’.

shelly_type: Shelly Dimmer 2
shelly_id: E098069667B3
ip_address: 192.168.70.28
protocols:
  - CoAP-discovery
  - CoAP-msg
  - poll
over_temp: 0
has_firmware_update: true
cloud_status: disabled
card:
            - background-color: |
                [[[ 
                  if (states['light.shelly_shdm_2_e098069667b3'].attributes.has_firmware_update == 'true')
                    return 'green';
                  else
                    return 'rgba(10,10,10,0.4)';
                ]]]

Can anyone point out where I have gone wrong?

James

Take the quotes off true in the template?

1 Like

He can also just remove the == true all together

Many thanks that solved it!

Regards