Controlling only one dashboard session from NodeRed

I have a home automation system in NodeRed with several browsers running Dashboard UI. I have some outdoor cameras with motion detection that activates live video when motion occurs. Working very nice but the video appears on ALL screens/browsers and I would like to limit the video to only one or two screens. Found out I could use the sessionid to pick one screen but the sessionid keeps changing...

I manually store the sessionid in a flow variable by pressing a button in the selected browser and use it like this:

[{"id":"65c3fad08f3dc9d3","type":"ui_ui_control","z":"4d395651357ab1b1","name":"ui control","events":"connect","x":1260,"y":920,"wires":[]},{"id":"36f82dc7dd8f6f5f","type":"change","z":"4d395651357ab1b1","name":"GarCam","rules":[{"t":"set","p":"url","pt":"msg","to":"http://172.16.0.101:10101/mjpg/GarCam/video.mjpg?q=40&s=100","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Innkjørsel","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":950,"wires":[["199728487f30702d"]]},{"id":"199728487f30702d","type":"change","z":"4d395651357ab1b1","name":"Show Videopage","rules":[{"t":"set","p":"payload","pt":"msg","to":"Kamera","tot":"str"},{"t":"set","p":"socketid","pt":"msg","to":"sock1","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":950,"wires":[["65c3fad08f3dc9d3","f8858d5ec8804d75","92bb7069eb9483a6","809b154c6b6ea105"]]},{"id":"809b154c6b6ea105","type":"ui_iframe","z":"4d395651357ab1b1","group":"0cf69380855e1696","name":"","order":2,"width":"28","height":"22","url":"","origin":"*","scale":"80","x":1280,"y":950,"wires":[]},{"id":"0cf69380855e1696","type":"ui_group","name":"Video","tab":"8f4c3716a72a96a8","order":1,"disp":false,"width":"32","collapse":false,"className":""},{"id":"8f4c3716a72a96a8","type":"ui_tab","name":"Kamera","icon":"videocam","order":11,"disabled":false,"hidden":false}]

Any way to at least check whether the sessionid still is alive or any other ways to get this functionality?

To complicate the matter a bit, I run 2 Chromium browsers on one RPi 400 and only want one to display the video when motion occurs and some other dashboard tab othervice.

The ui_control node can report new connections - so you can hopefully use that to grab the session ids - and hopefully then work out which came from where - maybe you have to fix ip address of one of them - and then set you flow variable.

1 Like

Thanks @dceejay , that did the trick.

The ui_control node reports both socketip and socketid on every refresh so when I receive a socketid from one specific socketip, I store it in flow-variable and use it to display video on one screen. On the RPi 400 with 2 browsers, it probably will be fairly random which one browser that displays the video but that is a minor problem at present.

1 Like

as I said - you may be able to fix the ip of at least one of the devices running a browser in which case it should then stick ok. But yes - if dhcp on both then yes you will need to sort it out at startup and hope they don't change :slight_smile:

1 Like

Which is why uibuilder now sets a client id which will last for the whole browser session. :wink:

1 Like

This is how it looks. These two monitors is connected to one RPi 400 with one Chromium browser on each monitor, both displaying NodeRed Dashboard from the same NodeRed Controller. I simulate motion detected outside and 20 secs later, the video is replaced by the previous tab (just changed the resolution on the monitors so I need to tidy up the design a bit...):

1 Like