Kiosk mode exit when pressing menu


I've managed to setup a kiosk mode that cycles between tabs but the only way to exit is to navigate to a ui button that disables the mode.
Is it possible to retrieve data from the main menu button so when that's pressed it exits the mode?
Or even have a menu button to turn it on and off?

[{"id":"10c7cf8.bbf1731","type":"ui_ui_control","z":"4949ffeb.a969c","name":"","x":800,"y":220,"wires":[[]]},{"id":"9c8cc7e6.318c18","type":"function","z":"4949ffeb.a969c","name":"Tab select","func":"let tabIndex = context.get(\"tabIndex\") || 0;\nlet tabs = [1,2,3,4]; \n \nfunction selectNextTab() \n{\n\n    return tabs[tabIndex++] || (tabIndex=0, tabs[tabIndex++]); \n}\n\nmsg.payload =  {\"tab\" : selectNextTab()};\ncontext.set(\"tabIndex\", tabIndex);\nreturn msg;\n","outputs":1,"noerr":0,"x":600,"y":220,"wires":[["162f93cc.732bcc","10c7cf8.bbf1731"]]},{"id":"162f93cc.732bcc","type":"debug","z":"4949ffeb.a969c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":810,"y":260,"wires":[]},{"id":"9e8fb4b5.1a19f8","type":"ui_switch","z":"4949ffeb.a969c","name":"","label":"kiosk mode","tooltip":"","group":"57b39d9b.54b5a4","order":0,"width":"6","height":"1","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":190,"y":220,"wires":[["23bb490e.ca2e56","ed07d21e.93adb"]]},{"id":"23bb490e.ca2e56","type":"trigger","z":"4949ffeb.a969c","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-10","extend":false,"units":"s","reset":"false","bytopic":"all","name":"","x":410,"y":220,"wires":[["9c8cc7e6.318c18"]]},{"id":"ed07d21e.93adb","type":"debug","z":"4949ffeb.a969c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":140,"wires":[]},{"id":"57b39d9b.54b5a4","type":"ui_group","z":"","name":"Curing bins 1","tab":"9e0c87f5.bcf8c8","order":1,"disp":false,"width":30,"collapse":false},{"id":"9e0c87f5.bcf8c8","type":"ui_tab","z":"","name":"Home","icon":"home","order":2,"disabled":false,"hidden":false}]

Just off the top of my head as I'm not at a computer.
You could have a button labelled Halt/Continue on each page/tab that sets a global flow variable. This variable could be checked in your JavaScript to halt the script or allow it to continue.

Not that elegant, but I'm sure it would work.

Thanks for the reply
The tabs i'm displaying are web servers from different devices in iframe such as PLC's, power monitors and Grafana so there isn't any space for a button. I also don't want to add a button to the menu bar because it looks untidy and i would rather add a logo and time there

Just saw your last comment about elegance that's exactly what i am aiming for! :slight_smile:
another option, maybe more complicated would be to set a timer so if the screen hasn't seen any user activity then automatically enter the mode. Basically a screensaver of the tabs.
Either way i need a menu click or general mouse click as a bit in the flow to solve this

the menu can only hold links to tabs or we links to other pages... I've not tried it - but you may be able to create an http endpoint in your flow that then fires the same as your original button, that you could then link to.

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