Custom card entity node red color

Hi,

I would like to be able to change the color of the text depending on the state of the entity.

1

I am starting with home assistant and I am not very sure how I could do it. I don’t know if I should configure the entity better, but I don’t know.

It is to know the status of a PLC, that its states are 1/0

If someone could help me I would be grateful.

Rather than having text-based HA sensors, can you change them to (for example) MQTT sensors? That way you can have lights as actual light entities and appear with the globe icon, and click it to turn it off and on (assuming you can communicate back to the devices).

So rather than using the “sensor node”, publish a message with an “mqtt-out node”, and then this is received by the MQTT sensor. And remember to set the “retain” flag so HA knows the state after a restart.

Alternatively if you instead use a “binary sensor node” I would think sending “on/off” in English should translate it to your language - but I only know English so I’m not 100% sure. The limitation of this approach is everything is just a binary sensor showing you whether it’s on or off, and cannot be interacted with.

hi,
Thank you very much for your endorsement.

The truth is that I would get lost in mqtt sensors, I have managed to do it easily and I would not like to have to complicate it more now.

I only want to change the color from red to green based on the text of node red.

You want to use the tools available in HA UI to change the color.

https://github.com/thomasloven/lovelace-card-mod
https://community.home-assistant.io/t/card-mod-add-css-styles-to-any-lovelace-card/120744/3000