Identify data from device using dashboard

Hi all,

a dashboard created with Node-RED can be accessed by more than one devices (if the url is known).
Is it possible to detect which device is e.g. operating a dashboard node switch / button (e.g by reading the IP address, device name ...) and to inhibit this action?

Thx!

yes, look at ui-control node.

The UI Control node gives msg.socketid and msg.socketip when a client connects to the dashboard.
And a button click sends socketid. Unfortunately the socketids don't match.
Untitled 1

Ok, you mean I can use socketip from the message emitted by node ui control when somebody is doing what?
In the help is mentioned 'changes tab'. Is that similar to 'operating and switch / button?

Nevertheless, I will test it and come back with questions again.

Thank you all!
:slightly_smiling_face:

When someone connect to the ui you can use the IP to disable tabs/groups, hide tabs/groups. or disable ability to run flow, it all depends on how you wish to code/run flow.

Clicking a UI button does not result in an output from ui-control, regardless of the ui-control node settings.
Apparently it can do when the user changes tab or group, so maybe it would work if your buttons are each in a different group (not tried this yet)

Is there an example flow somewhere for this @E1cid?

@jbudd
But if the socketids do not match how can i know from which user the button is clicked if the button (or switch) does not send IP address?

OK, I have now seen the latest answer from @E1cid and I understand that with this I can handle it. But as always: The devil is in the detail!

I hope you will help me when when it comes to implement it...

A VERY CRUDE EXAMPLE HERE

[{"id":"c2ef87a2.1a2908","type":"ui_ui_control","z":"c791cbc0.84f648","name":"","events":"connect","x":210,"y":1620,"wires":[["1a59dbc8.f9b424","6a13635f.d7e39c"]]},{"id":"1a59dbc8.f9b424","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":1620,"wires":[]},{"id":"6a13635f.d7e39c","type":"switch","z":"c791cbc0.84f648","name":"","property":"socketip","propertyType":"msg","rules":[{"t":"eq","v":"192.168.1.10","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":1660,"wires":[["3e3e6b9a.b5b024"]]},{"id":"3e3e6b9a.b5b024","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\":{\"hide\":[\"Home_test1\"],\"show\":[\"Home_test2\"]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1700,"wires":[["c2ef87a2.1a2908"]]},{"id":"f513a3ed.176318","type":"ui_switch","z":"c791cbc0.84f648","name":"","label":"switch","tooltip":"","group":"f811fd2e.819418","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":510,"y":1500,"wires":[[]]},{"id":"3a4cb48.0488b4c","type":"ui_switch","z":"c791cbc0.84f648","name":"","label":"switch","tooltip":"","group":"d1c84c65.50dd68","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":510,"y":1540,"wires":[[]]},{"id":"f811fd2e.819418","type":"ui_group","name":"test1","tab":"8f03e639.85956","order":2,"disp":true,"width":"6","collapse":false},{"id":"d1c84c65.50dd68","type":"ui_group","name":"test2","tab":"8f03e639.85956","order":3,"disp":true,"width":"6","collapse":false},{"id":"8f03e639.85956","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

That's not working for me: my browser IP matches the one specified in the switch node, change node sends message to ui-control but both groups are visible.

Edit - updating and restarting node-red seems to have sorted it.

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