(Believe me I don't like this any more than you)
This is really driving me batty.
This is the button
:
It works. I see the icon.
[{"id":"5ef1b432.4ab89c","type":"ui_button","z":"26262ba1.62dcbc","name":"","group":"1430591a.926dbf","order":0,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"fa-toggle-on fa-rotate-90","payload":"","payloadType":"str","topic":"","x":610,"y":560,"wires":[[]]},{"id":"1430591a.926dbf","type":"ui_group","name":"Group 2","tab":"aa487daa.33c1c","order":2,"disp":true,"width":6},{"id":"aa487daa.33c1c","type":"ui_tab","z":"","name":"Tasmota stuff","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
So, I replace the icon
field with {{msg.icon}}
and have this flow:
[{"id":"41f64a6c.76638c","type":"change","z":"26262ba1.62dcbc","name":"Icon","rules":[{"t":"set","p":"icon","pt":"msg","to":"fa-toggle-on fa-rotate-90","tot":"str"},{"t":"set","p":"background","pt":"msg","to":"lime","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":560,"wires":[["5ef1b432.4ab89c","fd9c7398.8dfbb"]]},{"id":"38c571db.9db896","type":"inject","z":"26262ba1.62dcbc","name":"","topic":"","payload":"X","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":560,"wires":[["41f64a6c.76638c"]]},{"id":"5ef1b432.4ab89c","type":"ui_button","z":"26262ba1.62dcbc","name":"","group":"1430591a.926dbf","order":0,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"{{msg.icon}}","payload":"","payloadType":"str","topic":"","x":610,"y":560,"wires":[[]]},{"id":"fd9c7398.8dfbb","type":"debug","z":"26262ba1.62dcbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":520,"wires":[]},{"id":"1430591a.926dbf","type":"ui_group","name":"Group 2","tab":"aa487daa.33c1c","order":2,"disp":true,"width":6},{"id":"aa487daa.33c1c","type":"ui_tab","z":"","name":"Tasmota stuff","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
I see this in the debug
node:
{"_msgid":"1fdf1d24.0023e3","topic":"","payload":"X","icon":"fa-toggle-on fa-rotate-90","background":"lime"}
There is a msg.icon
and it is the same as it is/was when it was in the button
node.
I deploy the flow and press the inject
button.
All I see is a button with a ?
and the word button
written after it.
Editing the button
node and putting the fa-toggle-on fa-rotate-90
back in the icon
field and deploying: It works and I see the fa-toggle-on fa-rotate-90
icon clear as.
I am really paying penance for my mistakes.
I don't know the magic to make this all in a template
node.
Even if I did, I use different kinds of buttons there too and don't know if they allow enabled
conditions.
So the problem is:
Why is it when I enter the icon name directly in the button
node (even with rotation) it works.
If I inject it as msg.icon
it doesn't?