Change entity color based on its state

Hi Guys,

i’m using custom component of smart IR to control my TV’s.
link to the component : https://github.com/smartHomeHub/SmartIR
i’m trying to change icon color based on its state, if the TV is on change to yellow and if not to return to its default state.

in order to do it, i configured the device class to power

as i did before to my binary sensors ( Xiaomi door sensor ), for the binary sensors its working, but when i’m doing the same thing for the custom component nothing happens.

Someone?

Device classes only work with binary sensors, sensors or covers. Not media players. https://www.home-assistant.io/docs/configuration/customizing-devices/#device-class

Any suggestions?

Some of the custom Lovelace cards support icon templating. Custom UI, I think.

Try this and replace the broadlink service calls with the ones for your component.

Otherwise you can do as @tom_l suggests and use the custom button card which allows for custom colors depending on state.

i don understand would you mind help out the type it for me?
TX for the help and sorry for the inconvenience