Forgive me now for going "off topic" as here is the latest problem which actually has been pestering me for quite a while.
Here is the screen shot of the default (starting) dashboard I put on machines.
Note the bit circled in red.
Nothing wrong with it.
here is the code:
[{"id":"b17ce1b0.c16b38","type":"inject","z":"5b95490e.a46ab8","name":"Boot detector","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"5","x":170,"y":1400,"wires":[["bceea0e2.1645c8"]]},{"id":"bceea0e2.1645c8","type":"function","z":"5b95490e.a46ab8","name":"","func":"//msg1 = {payload: '<font color = \"red\" i class=\"fa fa-bullseye fa-2x\"></i>', topic:device + \"/Off-line\",device_ID:device, background:\"brown\"};\nif (msg.payload === 0)\n{\n msg = {payload: '<font color = yellow i class=\"fa fa-asterisk fa-2x\"></i>'};\n} else\nif (msg.payload === 1)\n{\n msg = {payload: '<font color = grey i class=\"fa fa-asterisk fa-2x\"></i>'};\n}\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":1400,"wires":[["b3744d89.00517","4b9a87eb.6ca058"]]},{"id":"b3744d89.00517","type":"ui_text","z":"5b95490e.a46ab8","group":"2baddfee.9693a8","order":2,"width":"1","height":"1","name":"Boot indicator","label":"","format":"{{msg.payload}}","layout":"row-right","x":510,"y":1400,"wires":[]},{"id":"4b9a87eb.6ca058","type":"debug","z":"5b95490e.a46ab8","name":"Uptime output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":510,"y":1440,"wires":[]},{"id":"258ff894.df3ef8","type":"ui_button","z":"5b95490e.a46ab8","name":"Ack Boot","group":"2baddfee.9693a8","order":3,"width":"1","height":"1","passthru":true,"label":"Ack","tooltip":"","color":"black","bgcolor":"coral","icon":"","payload":"1","payloadType":"num","topic":"","x":190,"y":1440,"wires":[["bceea0e2.1645c8"]]},{"id":"334bb56b.832b02","type":"inject","z":"5b95490e.a46ab8","name":"Test","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1480,"wires":[["258ff894.df3ef8"]],"icon":"node-red/alert.png"},{"id":"2baddfee.9693a8","type":"ui_group","z":"","name":"Uptime","tab":"13e974d8.c41ca3","order":2,"disp":false,"width":"9","collapse":false},{"id":"13e974d8.c41ca3","type":"ui_tab","z":"","name":"PiFaceMain","icon":"dashboard","order":1}]
Again: Not rocket science.
My "tweak" is to make the ACK
also become the same colour as the *
- grey - when pressed.
Both the background and font colour.
I change the code to:
(From another machine where it works.)
[{"id":"59a1ddbf.37815c","type":"inject","z":"9b7e7466.a4b698","name":"Boot detector","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"5","x":150,"y":1700,"wires":[["8bc24dec.712b98","cdd46d3c.4b0408","b3f0be31.e6fff8"]]},{"id":"8bc24dec.712b98","type":"function","z":"9b7e7466.a4b698","name":"Boot ack","func":"//msg1 = {payload: '<font color = \"red\" i class=\"fa fa-bullseye fa-2x\"></i>', topic:device + \"/Off-line\",device_ID:device, background:\"brown\"};\n// var msg1;\nif (msg.payload === 0)\n{\n msg = {payload: '<font color = yellow i class=\"fa fa-asterisk fa-2x\"></i>'};\n msg1 = {colour: \"yellow\",font:\"black\"};\n} else\nif (msg.payload === 1)\n{\n msg = {payload: '<font color = grey i class=\"fa fa-asterisk fa-2x\"></i>'};\n msg1 = {colour: \"grey\",font:\"grey\"};\n}\nreturn [msg, msg1];","outputs":2,"noerr":0,"x":310,"y":1700,"wires":[["b7456952.308fd8","8e5c2f05.ae48f"],["ffb85d96.2172f"]]},{"id":"ffb85d96.2172f","type":"ui_button","z":"9b7e7466.a4b698","name":"Ack Boot","group":"a25d8b3.951fcf8","order":3,"width":"1","height":"1","passthru":false,"label":"Ack","tooltip":"","color":"{{msg.font}}","bgcolor":"{{msg.colour}}","icon":"","payload":"1","payloadType":"num","topic":"","x":170,"y":1740,"wires":[["bcfa6773.f94558"]]},{"id":"b7456952.308fd8","type":"ui_text","z":"9b7e7466.a4b698","group":"a25d8b3.951fcf8","order":2,"width":"1","height":"1","name":"Boot indicator","label":"","format":"{{msg.payload}}","layout":"row-right","x":510,"y":1700,"wires":[]},{"id":"a25d8b3.951fcf8","type":"ui_group","z":"","name":"Uptime","tab":"3245f51f.065aba","order":9,"disp":false,"width":"9","collapse":false},{"id":"3245f51f.065aba","type":"ui_tab","z":"","name":"Telemetry","icon":"track_changes","order":1,"disabled":false,"hidden":false}]
Basically I modify the button
to accept the colour for the background and text.
I also modify the function
node code from:
//msg1 = {payload: '<font color = "red" i class="fa fa-bullseye fa-2x"></i>', topic:device + "/Off-line",device_ID:device, background:"brown"};
if (msg.payload === 0)
{
msg = {payload: '<font color = yellow i class="fa fa-asterisk fa-2x"></i>'};
} else
if (msg.payload === 1)
{
msg = {payload: '<font color = grey i class="fa fa-asterisk fa-2x"></i>'};
}
return msg;
To:
//msg1 = {payload: '<font color = "red" i class="fa fa-bullseye fa-2x"></i>', topic:device + "/Off-line",device_ID:device, background:"brown"};
// var msg1;
if (msg.payload === 0)
{
msg = {payload: '<font color = yellow i class="fa fa-asterisk fa-2x"></i>'};
msg1 = {colour: "yellow",font:"black"};
} else
if (msg.payload === 1)
{
msg = {payload: '<font color = grey i class="fa fa-asterisk fa-2x"></i>'};
msg1 = {colour: "grey",font:"grey"};
}
return [msg, msg1];
And loop the second output to the button
.
Doing that, the machine just (usually, and now won't because I am posting this) goes nuts and pretty well locks up.
Ok, I am wrong. (That seems to be the default for every thing I say.) But something in there is screwing (sorry, I just can't think of a better word which is not going to get me in more trouble) with the machine.
Ok, guess what.
(Some one shoot me.)
I forgot to un tick the "message pass through" on the button.
Working now.
But a second check would be appreciated.
Thoughts?