Setting sensor colour based on value

Hey all, first time poster long time lurker

I’m sure this has been asked a million times but I must seem to be missing the wording. I have a several reed switches wired into several ESP32s that will send an MQTT command back to HA when in Sealed, Alarm or Tamper which is working great (minus colours)

Separately I then have each message (or heartbeat) set a counter for a heartbeat from the ESPs so that if several heartbeats are ever missed I set a sensor called sensor.door_**_ok to False

The template looks like so

{{ states('counter.door_02_heartbeat') | int > 0 }}

What I want to do now is on my dashboard, when sensor.door_02_ok becomes false I want it to go red, otherwise turn green, I import themes.yaml from my configuration.yaml and this is what i’ve found so far - Which I realise isn’t much but a bit of searching on the forum and reading the HA guide on frontend stuff I have had almost 0 luck

# Set under username > theme after reloading HA
my_theme:
  # This one does chance icon colours but not state dependant
  state-icon-color: "#FF0000"
  # None of these appear to do anything
  state-binary_sensor-True-color: "00FF00"
  state-binary_sensor-door_02_ok-color: "00FF00"
  primary-color: "#00FF00"
  accent-color: "#FF0000"
  paper-item-icon-active-color: "#00FF00"
  paper-item-icon-color: "#FF0000"
  label-badge-background-color: "#00FF00"
  label-badge-text-color: "#FFFFFF"
  state-icon-active-color: "#00FF00"
  state-icon-true-color: "#00FF00"
  state-icon-True-color: "#00FF00"

Has anyone got any ideas?
Cheers

The frontend supports themes. This category is for sharing themes.