That old problem with dashboards and layout

#1

This problem has been quiet for a long time.

It has returned.

Two pictures:
1 - the edit screen.
You see "all stop" as the area in which I am working.
You also see the 3 "points of interest" and their position in the list to the right.
2 - the web view.
The are in a different order.
Originally they were as per the first edit screen order. Just now they have decided to play silly with me.

Typically they will change throughout the next few hours as I am working on them.

0 Likes

#2

refresh the browser for the editor and will show the correct one.

Regards

0 Likes

#3

Fourth - edit.
The switch is not set correctly.
You have to have it set to ON PAYLOAD - STRING true
OFF PAYLOAD - BOOLEAN false
Sorry.

THIRD attempt.

Ok, you have a flow with a “big nasty red button” that you don’t want to be easily pressed.

This is my new solution. Though I have posted one before. This one is totally using supplied nodes, so a new person should be able to load it.

There are two buttons and one switch.

The switch was used to indicate the valid time when you can press THE BUTTON.

So, the idea is you press the first button - to ENABLE the real one.

You have 2 seconds.

If in that time, you press the second button, the payload is sent.

Otherwise nothing will be sent.

Sorry for the layout of the flow, but I made it nice and open for new people.

I had to “cheat” and modify a couple of nodes (the two FUNCTION nodes) and give them two outputs.
Seems that if I don’t it all falls over - as I discovered.

Walk through:
You press the first button. (or injection point)
It sends a message to start things.
The message is split and part is used to set the colour of the second switch. The first starts a trigger of two seconds.
The message then goes to the node which will then enable any OTHER message to pass through.
You will see a yellow dot below this node.
Then pressing the other (the REAL) button, the message is sent and you will see it in the debug node.

After the two seconds, the trigger trips and any button pressing on THE button is ignored.
Also the colour is reset.

Hope you enjoy it.

[{"id":"b542684a.d8c74","type":"ui_button","z":"2a3d00b1.eaab1","name":"","group":"5e674ec.9bfc5b","order":1,"width":0,"height":0,"passthru":true,"label":"Enable","color":"black","bgcolor":"cyan","icon":"","payload":"true","payloadType":"str","topic":"","x":140,"y":160,"wires":[["bba00b7e.fd5088"]]},{"id":"ea325790.11ce3","type":"ui_switch","z":"2a3d00b1.eaab1","name":"","label":"switch","group":"5e674ec.9bfc5b","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":550,"y":140,"wires":[["ce251ce6.85b1d8"]]},{"id":"fb3ab29.d658bd","type":"ui_button","z":"2a3d00b1.eaab1","name":"","group":"5e674ec.9bfc5b","order":3,"width":0,"height":0,"passthru":false,"label":"ACTION WHAT YOU WANT","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"toggle","payloadType":"str","topic":"","x":360,"y":300,"wires":[["5e3eb8bb.9a7a9"]]},{"id":"5f8f30fd.0b73d8","type":"inject","z":"2a3d00b1.eaab1","name":"Enable","topic":"","payload":"true","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":120,"wires":[["b542684a.d8c74"]]},{"id":"bba00b7e.fd5088","type":"function","z":"2a3d00b1.eaab1","name":"Set Topic","func":"msg.topic=\"ENABLE\";\nvar msg2 = { payload:\"\", background:\"lime\"};\nreturn [msg,msg2];","outputs":2,"noerr":0,"x":140,"y":200,"wires":[["ae166d5e.e42ed8"],["fb3ab29.d658bd"]]},{"id":"5e3eb8bb.9a7a9","type":"function","z":"2a3d00b1.eaab1","name":"EN","func":"if (msg.topic === \"ENABLE\")\n{\n    //\n    if (msg.payload === 'true')\n    {\n        node.status({fill:\"yellow\",shape:\"dot\",text:\"ENABLED\"});\n        context.set('enable',1);\n    }\n    //if (msg.payload === 'false')\n    else\n    {\n        context.set('enable',0);\n//        context.enable = 0;\n//        context.set('enable',enable_topic);\n        node.status({fill:\"red\",shape:\"dot\",text:\"DISABLED\"});\n    }\n}\nif (msg.topic != \"ENABLE\")\n{\n    if (context.get('enable') == 1)\n    {\n        //\n        msg.topic = 'RESET';\n        node.status({fill:\"green\",shape:\"dot\",text:\"On-line\"});\n        return msg;\n    }\n}\n","outputs":1,"noerr":0,"x":539,"y":248,"wires":[["7837a46e.bfb3e4"]]},{"id":"ce251ce6.85b1d8","type":"debug","z":"2a3d00b1.eaab1","name":"Junk","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":670,"y":140,"wires":[]},{"id":"317cf275.120c76","type":"inject","z":"2a3d00b1.eaab1","name":"Test ACTION OUTPUT","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":360,"wires":[["fb3ab29.d658bd"]]},{"id":"7837a46e.bfb3e4","type":"debug","z":"2a3d00b1.eaab1","name":"The message to get the job done.","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":759,"y":248,"wires":[]},{"id":"f9c6734a.a5b62","type":"function","z":"2a3d00b1.eaab1","name":"Set Topic","func":"var msg2 = { payload:\"\", background:\"red\"};\nreturn [msg,msg2];","outputs":2,"noerr":0,"x":440,"y":200,"wires":[["ea325790.11ce3","5e3eb8bb.9a7a9"],["fb3ab29.d658bd"]]},{"id":"ae166d5e.e42ed8","type":"trigger","z":"2a3d00b1.eaab1","op1":"","op2":"false","op1type":"pay","op2type":"str","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":300,"y":200,"wires":[["f9c6734a.a5b62"]]},{"id":"5e674ec.9bfc5b","type":"ui_group","z":"","name":"ALL STOP","tab":"f009d454.1d0c18","order":5,"disp":true,"width":"4","collapse":false},{"id":"f009d454.1d0c18","type":"ui_tab","z":"","name":"Control Display","icon":"dashboard","order":7}]
0 Likes