This is the best I can get for now.
For some reason I can't get the icon to work.
[{"id":"9f4c8d43.a38068","type":"ui_button","z":"9245b569.9f881","name":"3","group":"f26beec9.12872","order":3,"width":"2","height":"3","passthru":false,"label":"","tooltip":"3","color":"","bgcolor":"{{msg.colour}}","icon":"{{msg.payload}}","payload":"X","payloadType":"str","topic":"","x":460,"y":610,"wires":[[]]},{"id":"8fc7a573.52301","type":"change","z":"9245b569.9f881","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"'fa-toggle-on'","tot":"str"},{"t":"set","p":"colour","pt":"msg","to":"red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":610,"wires":[["9f4c8d43.a38068","2b83008b.428b58"]]},{"id":"bb7209a1.e3e3d8","type":"inject","z":"9245b569.9f881","name":"Red","topic":"press","payload":"<font color = \"red\" i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i><font>","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":120,"y":610,"wires":[["8fc7a573.52301"]]},{"id":"f26beec9.12872","type":"ui_group","z":"","name":"Power","tab":"a0ef1d6c.c0bc1","order":2,"disp":true,"width":"6","collapse":false},{"id":"a0ef1d6c.c0bc1","type":"ui_tab","z":"","name":"Real World Control (Relays etc)","icon":"dashboard","disabled":false,"hidden":false}]
This is a working flow (below), and I am trying to be better in what I am doing in that I can see the name of the switch on the dashboard.
Reading the information for the button
I can send a msg.payload
with the icon name and that is shown. Then I can use the label
to put the name of the switch/device.
't would be nice. Then I am not just seeing the toggles and no names.
[{"id":"83e477de.4cb57","type":"inject","z":"9245b569.9f881","name":"Red","topic":"press","payload":"<font color = \"red\" i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i><font>","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":170,"y":390,"wires":[["5bbb8b12.26834c"]]},{"id":"5bbb8b12.26834c","type":"ui_button","z":"9245b569.9f881","name":"3","group":"f26beec9.12872","order":3,"width":"1","height":"2","passthru":false,"label":"{{msg.payload}}","tooltip":"3","color":"","bgcolor":"black","icon":"","payload":"X","payloadType":"str","topic":"","x":310,"y":390,"wires":[["bd779da7.9cae38"]]},{"id":"bd779da7.9cae38","type":"function","z":"9245b569.9f881","name":"push button toggle","func":"let l = context.get('state') || 0;\nlet msg1 = {};\nif (msg.payload == 'X')\n{\n l = (l + 1) % 2;\n context.set('state',l);\n}\nif (l === 0)\n{\n msg.payload = '<font color = \"red\" i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i>';\n msg1.payload = \"off\";\n}\nelse\nif (l === 1)\n{\n //\n msg.payload = '<font color = \"green\" i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i>';\n msg1.payload = \"on\";\n}\nreturn [msg,msg1];","outputs":2,"noerr":0,"x":310,"y":430,"wires":[["5bbb8b12.26834c"],["5b71a1a5.7182b8","1c33e11.9d3391f"]]},{"id":"5b71a1a5.7182b8","type":"debug","z":"9245b569.9f881","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":470,"wires":[]},{"id":"1c33e11.9d3391f","type":"link out","z":"9245b569.9f881","name":"","links":["19850174.2a08ef"],"x":455,"y":430,"wires":[]},{"id":"f26beec9.12872","type":"ui_group","z":"","name":"Power","tab":"a0ef1d6c.c0bc1","order":2,"disp":true,"width":"6","collapse":false},{"id":"a0ef1d6c.c0bc1","type":"ui_tab","z":"","name":"Real World Control (Relays etc)","icon":"dashboard","disabled":false,"hidden":false}]