Is it possible to change the color of a disabled switch's label?

#1

Hey, everyone

I have a couple of switches in a dashboard that can be enabled or disabled by a "master switch". However, I want the labels to show the if the object that the switch represents is on or off. I need a way to change the color of the label even if the switch is disabled instead of it being greyed off.

#2

Maybe this is insteresting for your purpose....

[{"id":"d748a598.9b70a8","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,78,20,39,20,19,21,19,20,40,19,19,20,19,20,20,20,38,21,19,20,19,20,19,21,19,0,3,96,78,20,39,20,19,20,19,21,38,20,20,20,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,96,80,19,38,21,19,20,19,20,39,20,19,20,20,20,21,18,39,20,21,18,21,19,21,18,19,0,3,98,80,18,41,18,19,20,20,20,38,21,19,20,19,20,21,19,40,19,19,20,21,18,19,20,21,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":2980,"wires":[["41c6840f.0d9d5c"]]},{"id":"fda5837a.dccde","type":"ui_button","z":"dfeaf865.51c758","name":"0","group":"e41daecb.93f06","order":37,"width":"1","height":"1","passthru":false,"label":"0","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":2980,"wires":[["d748a598.9b70a8"]]},{"id":"f3567a67.b20688","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,80,19,21,18,21,18,19,21,19,20,21,18,21,19,21,18,40,19,19,20,19,20,21,19,19,0,3,135,79,20,21,18,19,20,21,19,21,18,21,18,21,19,19,20,39,20,21,18,19,20,21,19,21,0,3,133,78,21,19,20,19,20,19,20,19,21,19,20,21,18,20,20,38,21,19,20,21,18,21,18,21,0,3,136,78,20,21,18,19,21,20,19,21,18,21,18,21,19,21,18,41,18,19,20,19,21,19,20,21,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3020,"wires":[["41c6840f.0d9d5c"]]},{"id":"e5763e25.a7708","type":"ui_button","z":"dfeaf865.51c758","name":"1","group":"e41daecb.93f06","order":38,"width":"1","height":"1","passthru":false,"label":"1","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3020,"wires":[["f3567a67.b20688"]]},{"id":"8fd21748.bd41b8","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,140,0,78,21,38,21,19,20,19,20,19,21,19,20,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,116,78,20,39,20,19,20,20,20,19,20,19,20,19,21,19,20,39,20,19,20,19,20,20,20,19,0,3,116,78,20,39,20,19,20,19,21,19,20,19,20,19,21,19,20,39,20,19,20,19,20,19,21,19,0,3,117,78,20,39,20,19,21,19,20,19,20,19,21,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,118,78,20,39,20,19,20,19,21,19,20,19,20,19,20,20,20,39,20,19,20,19,20,19,21,19,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3060,"wires":[["41c6840f.0d9d5c"]]},{"id":"ba6ffa1e.008ef8","type":"ui_button","z":"dfeaf865.51c758","name":"2","group":"e41daecb.93f06","order":39,"width":"1","height":"1","passthru":false,"label":"2","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3060,"wires":[["8fd21748.bd41b8"]]},{"id":"e594165.ebaafe8","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,78,20,19,20,39,20,19,21,19,20,19,20,19,20,19,21,38,21,19,20,19,20,19,21,19,0,3,115,78,21,19,20,39,20,19,20,19,21,19,20,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,116,78,20,20,20,39,20,19,20,19,20,19,21,19,20,19,20,39,20,19,20,20,20,19,20,19,0,3,118,78,20,19,20,39,20,19,20,19,21,19,20,19,20,19,21,38,21,19,20,19,20,19,20,20,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3100,"wires":[["41c6840f.0d9d5c"]]},{"id":"13b60fbb.1d888","type":"ui_button","z":"dfeaf865.51c758","name":"3","group":"e41daecb.93f06","order":40,"width":"1","height":"1","passthru":false,"label":"3","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3100,"wires":[["e594165.ebaafe8"]]},{"id":"31ba3df7.bf26f2","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,140,0,78,20,39,20,39,20,19,20,19,21,19,20,19,20,19,20,39,20,20,20,19,20,19,20,19,0,3,96,79,20,39,20,38,21,19,20,19,20,19,21,19,20,19,20,39,20,19,20,19,21,19,20,19,0,3,96,78,21,38,20,39,20,19,21,19,20,19,20,19,21,19,20,39,20,19,20,19,20,19,21,21,0,3,96,78,20,39,20,39,20,19,20,19,20,21,19,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,98,78,20,39,20,39,20,19,21,19,20,19,20,21,18,20,20,38,21,19,20,19,20,19,21,19,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3140,"wires":[["41c6840f.0d9d5c"]]},{"id":"a5cc3d2d.10131","type":"ui_button","z":"dfeaf865.51c758","name":"4","group":"e41daecb.93f06","order":41,"width":"1","height":"1","passthru":false,"label":"4","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3140,"wires":[["31ba3df7.bf26f2"]]},{"id":"ec3df9e6.6b6038","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,140,0,78,20,19,20,19,21,38,21,19,20,19,20,19,20,20,20,38,21,19,20,19,20,19,21,19,0,3,115,78,20,20,20,19,20,39,20,19,20,19,21,19,20,19,20,39,20,19,20,19,21,19,20,19,0,3,116,78,20,19,20,19,21,38,21,19,20,19,20,19,20,19,21,38,21,19,20,19,20,19,21,19,0,3,117,78,20,19,21,19,20,39,20,19,20,21,18,19,21,19,20,39,20,19,20,19,20,20,20,19,0,3,117,78,20,20,20,19,20,39,20,19,20,19,21,19,20,19,20,39,20,19,20,19,21,19,20,19,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3180,"wires":[["41c6840f.0d9d5c"]]},{"id":"2cfb4df3.7d6ee2","type":"ui_button","z":"dfeaf865.51c758","name":"5","group":"e41daecb.93f06","order":42,"width":"1","height":"1","passthru":false,"label":"5","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3180,"wires":[["ec3df9e6.6b6038"]]},{"id":"216238c8.035bc8","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,79,19,39,20,19,20,39,20,19,21,19,20,19,20,19,21,38,20,20,20,19,20,19,20,19,0,3,97,78,20,39,20,19,20,39,20,19,20,19,21,19,20,19,20,39,20,19,20,20,20,19,20,19,0,3,96,78,20,39,20,19,21,38,21,19,20,19,20,19,21,19,20,39,20,19,20,19,20,19,21,19,0,3,97,79,20,38,21,19,20,39,20,19,20,19,21,19,20,19,20,39,20,19,20,19,21,19,20,19,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3220,"wires":[["41c6840f.0d9d5c"]]},{"id":"b28f5689.cd0838","type":"ui_button","z":"dfeaf865.51c758","name":"6","group":"e41daecb.93f06","order":43,"width":"1","height":"1","passthru":false,"label":"6","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3220,"wires":[["216238c8.035bc8"]]},{"id":"9029c5ff.c10168","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,78,20,19,20,39,20,39,20,19,21,19,20,19,20,19,21,38,20,20,20,19,20,19,20,19,0,3,97,78,20,19,20,39,20,39,20,19,20,19,21,19,20,19,20,39,20,19,20,20,20,19,20,19,0,3,96,79,20,19,20,39,20,38,21,19,20,19,20,19,21,19,20,39,20,19,20,19,20,19,21,19,0,3,97,79,20,19,20,39,20,39,20,19,20,19,20,19,21,19,20,39,20,19,20,19,20,20,20,20,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3260,"wires":[["41c6840f.0d9d5c"]]},{"id":"c7d3b1aa.1f668","type":"ui_button","z":"dfeaf865.51c758","name":"7","group":"e41daecb.93f06","order":44,"width":"1","height":"1","passthru":false,"label":"7","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3260,"wires":[["9029c5ff.c10168"]]},{"id":"66953ca6.9a7374","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,78,20,39,20,39,20,39,20,19,20,19,20,20,20,19,20,39,20,19,20,19,21,19,20,19,0,3,76,78,21,38,21,38,21,38,21,19,20,19,20,19,20,19,21,38,21,19,20,19,20,19,21,19,0,3,76,78,20,39,20,39,20,39,20,19,20,20,20,19,20,19,20,39,20,19,21,19,20,19,20,19,0,3,77,79,21,38,20,39,20,39,20,19,21,19,20,19,20,19,20,39,20,19,21,19,20,19,20,19,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3300,"wires":[["41c6840f.0d9d5c"]]},{"id":"af6bb867.1d54d8","type":"ui_button","z":"dfeaf865.51c758","name":"8","group":"e41daecb.93f06","order":45,"width":"1","height":"1","passthru":false,"label":"8","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3300,"wires":[["66953ca6.9a7374"]]},{"id":"dc578d0d.340e3","type":"function","z":"dfeaf865.51c758","name":"","func":"var data = [38,0,112,0,78,20,19,21,19,20,19,20,40,19,19,20,19,21,20,19,39,20,19,20,19,20,19,21,19,0,3,115,78,21,20,19,19,20,19,21,38,20,20,20,19,20,19,20,40,19,19,21,19,20,19,20,19,0,3,116,78,20,19,20,20,20,19,20,39,20,19,20,19,21,19,20,39,20,19,20,19,20,19,21,19,0,3,117,78,20,19,21,19,20,19,20,39,20,20,19,20,20,19,20,39,20,19,20,19,21,19,20,19,0,13,5,0,0,0,0,0,0,0,0];\nmsg.payload.action = 'send';\nmsg.payload.data = data;\nmsg.repeat = 3;\n\nreturn msg;","outputs":1,"noerr":0,"x":1550,"y":3340,"wires":[["41c6840f.0d9d5c"]]},{"id":"4bb3cc40.c8e9f4","type":"ui_button","z":"dfeaf865.51c758","name":"9","group":"e41daecb.93f06","order":46,"width":"1","height":"1","passthru":false,"label":"9","color":"{{msg.color}}","bgcolor":"{{msg.background}}","icon":"","payload":"{}","payloadType":"json","topic":"","x":1350,"y":3340,"wires":[["dc578d0d.340e3"]]},{"id":"41c6840f.0d9d5c","type":"function","z":"dfeaf865.51c758","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1830,"y":3140,"wires":[["7aac67cf.b1ee08"]]},{"id":"25844aaa.b98106","type":"inject","z":"dfeaf865.51c758","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":410,"y":3140,"wires":[["335fddda.8cd5b2"]]},{"id":"335fddda.8cd5b2","type":"switch","z":"dfeaf865.51c758","name":"","property":"TV","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":3140,"wires":[["baf68ded.7d65"],["e6cc2944.98b188"]]},{"id":"baf68ded.7d65","type":"function","z":"dfeaf865.51c758","name":"aparecer boton","func":"msg.color = \"blue\";\nmsg.background = \"#454545\";\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":3100,"wires":[["4ad5d0f2.6e736"]]},{"id":"e6cc2944.98b188","type":"function","z":"dfeaf865.51c758","name":"desaparecer boton","func":"msg.color = \"#323232\";\nmsg.background = \"#323232\";\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":3180,"wires":[["4ad5d0f2.6e736"]]},{"id":"4ad5d0f2.6e736","type":"function","z":"dfeaf865.51c758","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":950,"y":3140,"wires":[["fda5837a.dccde","e5763e25.a7708","ba6ffa1e.008ef8","13b60fbb.1d888","a5cc3d2d.10131","2cfb4df3.7d6ee2","b28f5689.cd0838","c7d3b1aa.1f668","af6bb867.1d54d8","4bb3cc40.c8e9f4"]]},{"id":"7aac67cf.b1ee08","type":"switch","z":"dfeaf865.51c758","name":"","property":"TV","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1990,"y":3140,"wires":[["eaa454e6.282ce8"]]},{"id":"e41daecb.93f06","type":"ui_group","z":"","name":"MEDIA","tab":"b5ad9abd.3a6c38","order":3,"disp":true,"width":"7","collapse":false},{"id":"b5ad9abd.3a6c38","type":"ui_tab","z":"","name":"TV & AUDIO","icon":"wifi","order":4}]

What I do... if TV is OFF then buttons disappear from dashboard as background and label button color is set to the same than the dashboard background and from other side the output of the buttons is disabled by a switch node.

If TV is ON the buttons appears and you can use them.

Regards