Based on the guidance by jbudd I have deduced that the colour of a Custom icon can be set dynamically by passing a message to the switch node which in my example includes msg.className "SUCCESS" with a ui_template of
What does the html look like when in these 2 different states? Perhaps you can use a more specific selector for the css (it depends on how the html is generated)
Thanks, even more enlightening. The first suggestion enables one to independently set the colour of the Custom icon within the widget ui_switch, while the second suggestion sets the colour of the widget but not the Custom icon.
Yes. I didn't address the icon specifically but you can change the CSS selector to refer to whatever aspect of the widget you want.
I am sure you can combine both suggestions but without a picture of the sort of dashboard you are making I can't imagine how it would work.
Edit - determining CSS selectors.
There may be a better way to do this, if someone knows one please enlighten me!
Using the browser "Inspect" option you can select a screen element and see it's properties.
Using right click, copy CSS Path.
I have found that including md-card sometimes makes the difference between needing !important or not. I don't know why.
I am also ignorant if it makes a difference including spaces and "div." in the selector.
I am controlling x3 433MHz remote control sockets via a PICO from Node Red on a raspberry Pi. Each switch can send a specific on or off code for each remote by a Http Request node. Sometimes because of local conditions the Http Request is unresponsive, resulting in several requests, while host unreachable can be picked up by an error, it is preferable that the switch can show 3 conditions, an off condition, Http Requesting, and Successfully reached. Now that I know how to set the colour of the icon, my objectives should now be attainable. Of course there is no way of knowing whether the Remote has responded, but at least one of weak links in the system is detectable.
Can you request a status report from them?
I use MQTT rather than HTTP and my smart sockets use Tasmota.
I send a message "ON" and they (hopefully) respond "ON".
I can also periodically send "STATUS" which returns a status message including "ON". That way the dashboard can reflect presses on the physical button on the socket.
The Remotes are inexpensive 433Mhz remote control socket plugs with a simple hand controller from which the signals have been decoded. So alas I am unable to request a status report.
I have an identical set of remote controlled UK mains switches that are in a cupboard gathering dust.
Just interested what hardware you used to "talk" from the Pico via 433MHz to the switches?
Hi Dave, the 433Mhz transmitter (FS1000A) and receiver (MX-RM-5V) modules are widely available online. In 2020 I paid less than ÂŁ6 for thee pairs of modules. The recievers are needed to initially decode the 433 Mhz signals from the hand controller for the socket plugs. I've used them on PICO WH, and on a Pi Zero WH. The range of the transmitter on the Zero seems better than that on the PICO, whether due to individual pecularities of the modules or the raspberry devices. On both devices the transmitter modules are powered by the 5v output. No additional antennas used, but transmits through exterior/interior walls without issue using either the PICO or Pi Zero