Trigger an event by calling the dashboard

can i trigger an event by calling the dashboard specified group to log when the page was called or to read and display a current value from the database by opening that group?

When the page was loaded - yes, you can use the ui control node for that I think. Not sure about when opening a tab if that's what you meant.

1 Like

Yes ui_control will report

  • payload - connect , lost , change , or group .
  • socketid - the ID of the socket (this will change every time the browser reloads the page).
  • socketip - the ip address from where the connection originated.
  • tab - the number of the tab. (only for 'change' event).
  • name - the name of the tab. (only for 'change' event).
  • group - the name of the group. (only for 'group' event).
  • open - the state of the group. (only for 'group' event).
1 Like

I don't know if I understood everything you are asking but here is a flow that tells you the time when a dashboard tab has been opened:
if you inject "1", you will open tab 1 and tell you what time it was opened...

[{"id":"f9b032ae.2bd87","type":"inject","z":"fe2c7bc6.bd49c8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"1","payloadType":"str","x":710,"y":3210,"wires":[["4666aac0.c016f4"]]},{"id":"4666aac0.c016f4","type":"ui_ui_control","z":"fe2c7bc6.bd49c8","name":"change group","events":"change","x":880,"y":3210,"wires":[["7ebcc133.3fcb3","2bb70992.1a6be6","bd09ad5f.9e37b"]]},{"id":"bd09ad5f.9e37b","type":"function","z":"fe2c7bc6.bd49c8","name":"d_h","func":"var hourChange = picHour(new Date());\n\nmsg= [{\n    payload:    msg.payload,\n,\n,\n    hourChange:   hourChange,\n    }];     // set a new \nreturn msg;\n\n//////////////////////// fonction /////////////////////////////\n//========== picHour ==========\nfunction picHour(d) {\nvar hour = d.getHours();    //hour\nhour = hour.toString();\n    if (hour < 10) {hour = \"0\"+ hour}\nvar minutes = d.getMinutes();\nminutes = minutes.toString();\n    if (minutes < 10) {minutes = \"0\"+ minutes}\nvar secondes = d.getSeconds();\nsecondes = secondes.toString();\n    if (secondes < 10) {secondes = \"0\"+ secondes}\nvar time = (hour+':'+ minutes+':'+secondes);//(hour+minutes+secondes);//\nreturn time;\n}   // fin de picHour\n\n/*\n\n\n\n*/","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1040,"y":3210,"wires":[["51894f7b.a1e1e"]]},{"id":"51894f7b.a1e1e","type":"debug","z":"fe2c7bc6.bd49c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1160,"y":3210,"wires":[]},{"id":"7ebcc133.3fcb3","type":"debug","z":"fe2c7bc6.bd49c8","name":"ui_control","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1040,"y":3170,"wires":[]}]
1 Like

Thanks for the great help.
I did not know the function of ui_control yet.
It makes it even easier for me to get the IP address delivered.
I still have to understand the function lost, but it is not important for me at the moment.

@SuperNinja thanks for your example.
Interesting your function. It makes it easier in some points. Also here I did not know that you can write a function in a function.

Today I learned a lot again! THANK YOU

1 Like

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