Need help inverting esphome template output

Hi all,

I have a text sensor on a ultrasonic sensor that I use to determine if there is a car in my garage or not. It’s all working fine, except that when the car is in the garage the HA sensor is colored like it’s on, I would like it to be colored as if it were off.

ESPHome code

  - platform: template
    name: "Left Garage Occupied"
    lambda: |-
      if (id(rawdist).state > .5) {
        // Left Garage is Empty.
        return {"Empty"};
      } else {
        // Left Garage is Occupied.
        return {"Car Detected"};
      }

Lovelace
image
If the bay is empty, the icon goes grey.

I would like to switch this so when the bay is occupied its grey and when its empty its blue. I tried swapping the if statement around but it didn’t change the output.

Maybe try to invert it

< .5
  - platform: template
    name: "Left Garage Occupied"
    lambda: |-
      if (id(rawdist).state < .5) {
        // Left Garage is Occupied.
        return {"Car Detected"};
      } else {
        // Left Garage is Empty.
        return {"Empty"};
      }

Tried that too, no dice.