Card-mod in picture-elements ignoring color based on state

Hi

I have two state-label where I’d like the text color being changed based on value.

This one works perfectly:

  - type: state-label
    entity: sensor.tpms_post_sx_int_pressure
    style:
      font-weight: bold
      top: 22%
      left: 31%
      transform: scale(1.1,1.1)
    card_mod:
      style: |
        :host {
          color:
            {% if states(config.entity) | float < 4 %} 
              red
            {% elif states(config.entity) | float > 7 %}
              red
            {% endif %}
              white
            ;
        }

This one is being ignored and always showing black color:

  - type: state-label
    entity: sensor.tpms_post_sx_int_temperature
    style:
      font-weight: bold
      top: 22%
      left: 37%
      transform: scale(1.1,1.1)
    card_mod:
      style: |
        :host {
          color:
            {% if states(config.entity) | float < 4 %} 
              red
            {% elif states(config.entity) | float > 7 %}
              red
            {% endif %}
              white
            ;
        }

If I template the sensor in the dev tool:

          value_template: >
                        {% if states('sensor.tpms_post_sx_int_temperature') | float > 1 %}
                            1
                            {% else %}
                                0
                            {% endif %}

I’m getting a proper value (1/0) deepening on state, so I’m assuming the sensor is not being read as a str.

Can anyone help me understand my mistake? Thanks!

any help/suggestions?

still trying :slight_smile:

heeeeeeeeeeeelp :smiley:

anyone has anything to suggest looking at?