Basics may be something like this
[{"id":"982bfb95.2053d8","type":"ui_ui_control","z":"3dd56201.af994e","name":"","events":"all","x":300,"y":160,"wires":[["a110e2ba.085ae"]]},{"id":"dbf26e9d.177","type":"debug","z":"3dd56201.af994e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":720,"y":160,"wires":[]},{"id":"a110e2ba.085ae","type":"function","z":"3dd56201.af994e","name":"store dashboard state","func":"let state = global.get('dashboardState');\nlet event = {} \nif(msg.payload == 'connect'){\n if(state != 'online'){\n state = 'online'\n event.payload = 'online'\n }\n}\nif(msg.payload == 'change'){\n if(state != 'online'){\n state = 'online'\n event.payload = 'online'\n }\n}\nif(msg.payload == 'lost'){\n if(state != 'offline'){\n state = 'offline'\n event.payload = 'offline';\n }\n}\nif(event.payload){\n global.set('dashboardState',state);\n event.topic = \"dashboard-state\" ;\n return event;\n}\n\n","outputs":1,"noerr":0,"x":500,"y":160,"wires":[["dbf26e9d.177"]]},{"id":"e711a82a.9b9668","type":"switch","z":"3dd56201.af994e","name":"","property":"dashboardState","propertyType":"global","rules":[{"t":"eq","v":"online","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":260,"wires":[["2aafefe5.d0046"]]},{"id":"3fc37183.dc643e","type":"inject","z":"3dd56201.af994e","name":"","topic":"","payload":"DASHBOARD CHECK","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":260,"wires":[["e711a82a.9b9668"]]},{"id":"2aafefe5.d0046","type":"ui_toast","z":"3dd56201.af994e","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":760,"y":260,"wires":[]}]