Template - Humidity Colour

Hi Team.

I am trying to understand templates. I have an entity for humidity. I am looking for what i think is a simple template that will change the icon red if humidity greater than X and then turn it green if less than X

I am using Mushroom cards where possible

Can anyone help me?

Many thanks

Craig

Copy the following into the icon_color field:


{% set s = states(entity) |float(0) %}
{{ 'red' if s > 60 else 'green' }}

What are you not understanding? Feel free to ask :slight_smile:

Thanks mate. I am just trying to get my head around templates and how they work. I forgot that i need to also include the actual humidity reading value