Ui control icon does not work

Hi.

I have a simple fuction nod that controls a button ui. I woks in an other node red installation but not in this with a newer version.

any ideá?

[{"id":"cf13d41c.694c28","type":"function","z":"adb4fa3e.086538","name":"Gate","func":"if (msg.payload === \"true\")node.send({ui_control:{icon:\"fa-2x fa-lock\"},bgcolor:\"red\",color:\"black\",label : msg.label,payload:msg.payload});\nif (msg.payload === \"false\")node.send({ui_control:{icon:\"fa-2x fa-unlock\"},bgcolor:\"green\",color:\"white\",label : msg.label,payload:msg.payload});\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1330,"y":1700,"wires":[["5a914daf.3a3bf4"]]},{"id":"5a914daf.3a3bf4","type":"ui_button","z":"adb4fa3e.086538","name":"button","group":"1d41e4a0.a1f66b","order":11,"width":"0","height":"0","passthru":true,"label":"{{msg.label}}","tooltip":"","color":"{{msg.color}}","bgcolor":"{{msg.bgcolor}}","icon":"{{msg.icon}}","payload":"pushed","payloadType":"str","topic":"","x":1450,"y":1700,"wires":[["2a9752f.54a31ae"]]},{"id":"2a9752f.54a31ae","type":"debug","z":"adb4fa3e.086538","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1570,"y":1700,"wires":[]},{"id":"bd539dcb.19bf","type":"inject","z":"adb4fa3e.086538","name":"","props":[{"p":"payload"},{"p":"label","v":"Låst","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"str","x":1110,"y":1700,"wires":[["cf13d41c.694c28"]]},{"id":"a7356631.f86c98","type":"inject","z":"adb4fa3e.086538","name":"","props":[{"p":"payload"},{"p":"label","v":"upplåst","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"str","x":1110,"y":1740,"wires":[["cf13d41c.694c28"]]},{"id":"1d41e4a0.a1f66b","type":"ui_group","name":" Kontor","tab":"b0d81940.9ab938","order":1,"disp":true,"width":"6","collapse":false},{"id":"b0d81940.9ab938","type":"ui_tab","name":"Testing","icon":"dashboard","disabled":false,"hidden":false}]

payload 6

Errr - your node is set to use {{msg.icon}} for the icon (as it should) - and then you send in a ui_control property ? maybe just set an icon property instead

[{"id":"cf13d41c.694c28","type":"function","z":"ac5a770f.97b148","name":"Gate","func":"if (msg.payload === \"true\")node.send({icon:\"fa-2x fa-lock\",bgcolor:\"red\",color:\"black\",label : msg.label,payload:msg.payload});\nif (msg.payload === \"false\")node.send({icon:\"fa-2x fa-unlock\",bgcolor:\"green\",color:\"white\",label : msg.label,payload:msg.payload});\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":390,"y":500,"wires":[["5a914daf.3a3bf4"]]},{"id":"5a914daf.3a3bf4","type":"ui_button","z":"ac5a770f.97b148","name":"button","group":"1d41e4a0.a1f66b","order":11,"width":"0","height":"0","passthru":true,"label":"{{msg.label}}","tooltip":"","color":"{{msg.color}}","bgcolor":"{{msg.bgcolor}}","icon":"{{msg.icon}}","payload":"pushed","payloadType":"str","topic":"","topicType":"str","x":550,"y":500,"wires":[["2a9752f.54a31ae"]]},{"id":"2a9752f.54a31ae","type":"debug","z":"ac5a770f.97b148","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":670,"y":500,"wires":[]},{"id":"bd539dcb.19bf","type":"inject","z":"ac5a770f.97b148","name":"","props":[{"p":"payload"},{"p":"label","v":"Låst","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"str","x":210,"y":500,"wires":[["cf13d41c.694c28"]]},{"id":"a7356631.f86c98","type":"inject","z":"ac5a770f.97b148","name":"","props":[{"p":"payload"},{"p":"label","v":"upplåst","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"str","x":210,"y":540,"wires":[["cf13d41c.694c28"]]},{"id":"1d41e4a0.a1f66b","type":"ui_group","name":" Kontor","tab":"b0d81940.9ab938","order":1,"disp":true,"width":"6","collapse":false},{"id":"b0d81940.9ab938","type":"ui_tab","name":"Testing","icon":"dashboard","disabled":false,"hidden":false}]

Thank you! Now it work as it schould. Can i also ask you if it´s possible to do something like this tp set Label?
if (msg.payload.motor_lock_state[0] === true)node.send({icon:"fa-2x fa-lock",bgcolor:"red",color:"black"**,label:payload.external_id[0]});

Regards Niclas

Did you try ? it was working in my example above.

Your example worked just fine! the icon appear. But if i want to change the label from msg.label and insted look for payload.external_id[0] is that possible to do somehow?

do you mean msg.payload.external_id[0]

Yes.:slight_smile: Sorry. It also worked! How could i miss

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.