Icon Color Change for non binary sensors

Use case:

I have some Window Sensors (binary) and some Window Handle Sensors (non binary).

The Window / Door Sensors have the device_class: Window or device_class: Door.
They usually have two possible states: OPEN and CLOSED.

The Icon color change in the entity card, does work just fine for these binary sensors…

But:
the Handle-Sensors can have the following states:

  • Closed
  • Open
  • Tilted

the Window sensor can detect the window as closed, but actually, the handle is “open”.
This means, the Window itself is not fully closed and could be easily opened from the outside.

While the icon itself can be changed for such a sensor (depending on its state) - the icon color does not change, when the handle sensor has any other state than closed.

Condition #1
Binary Sensor: Closed
Non Binary Sensor: Closed
grafik

Condition #2
Binary Sensor: Closed
Non Binary Sensor: Open
grafik
As you can see, the Icon itself has changed for the door / window handle Sensor.

Condition #3
Binary Sensor: Open
Non Binary Sensor: Open
grafik
The binary sensor has changed its color based on the state - the non binary sensor does not change the color.

Condition #4
Binary Sensor: Closed
Non Binary Sensor: Tilted
grafik
Even with tilted, the Icon has changed to “open”… But it does not change its color.

Condition #5
grafik


Binary Sensors do have the device_class: Door or Window
it could be considered, to apply this device_class to non binary sensors, too?

A door / Window can have more than two states - maybe, that does not apply to all Windows - or even only to Windows in Europa / Germany ?

If it is not possible to implement an Icon Color Change to non binary sensors (with a specific device class), it would be great if conditions and dependencies for Icon Color Changes could be set up within the UI.
For example a dependency / condition like:

If binary_sensor.A == on
  set Active_Icon for Sensor.B = true