1 Computer, 2 Monitors, 1 Static Dashboard, 4 Rotating Dashboards

I saw a previous post on how to rotate screens with a control ui, which is great, but I'm looking at doing the following.

I have 1 PC feeding two monitors.

I have one main Node Red tab called Dashboard that is my main dashboard.

I have 4 other Node Red tabs (part of the same project) that I would like to rotate through on the 2nd screen (probably in a 2nd browser).

Anyway to do this in the current dashboard node?

Thanks
Kyle

I don't think you can do this with Dashboard since it is really a single user-system. I'm fairly sure that if you rotate the tabs on one browser window, it will rotate the other as well.

As long as the msg includes the sessionid of the other browser session, the control commands should only go to that session

What would that msg look like to push to the control_ui?

I'm assuming I could bookmark the node red server with the same sessionID's so they would be static for that tab in Chrome?

well no - the session is created every time the browser connects and will change every time you reload the page - but will then stay. So you will need to capture it when it connects the first time (from the ui-control node) and then ensure you add it to every message you send to the ui-control node. If you add a debug node set to show complete message you should be able to see what I mean.

Worth noting that it might not be that stable if using from a mobile device or a device that the extreme of your Wi-Fi connection. The id will change if the connection is lost and reformed as well as on a page load.

A few questions.

I'm seeing this as my debug out of the control node.

image

My session ID in my browser is :

image

It's not the same. Am I missing something?

I'm having trouble figuring out how to grab the socketid automatically from a tab and sticking it into the socketid payload.....but first I need to figure out why these ID's are not the same.

Kyle

Another browser tab :wink:

Every browser tab has a different socketid and every time you reload a tab, the socketid will change.

That's what I thought. Closed down Chrome on every computer I had....no luck. Still a different socketID number.

So check out what device has the ip of .100

Yep, that's the computer with no chrome tabs open.

This doesn't make any sense.

Have you checked the task manager to make sure you don't have a hidden connection? If not, maybe try restarting node-red to get a fresh session.

To dig deeper into what sockets are open, you would probably need to restart node-red in debug mode so that you can dig into the objects.

That's a good idea.

Any idea how I can grab the session ID from the Chrome tab automatically and insert that into the payload? I guess I could put an input and have the end user manually insert it so it rotates.

Open the dashboard page, then open the browser devtools and reload the dashboard. Use the network page and find the line that has a status of 101.

Click on that line and look at the headers. I think that the id you want is in the cookie io=........

It is in the msg sent by the ui-control node whenever a browser connects

Ok, thanks to those who have responded and gave some mentoring. I feel like I've made some progress, but again stumped so I've included all the documentation to help troubleshoot. I still can't get my session to rotate tabs.

Below is the flow (with code)

This flow gets the socketID and IP from the tab and then a user inputs this into dashboard user form to ensure which browser tab the user wants to rotate.

Dashboard group. After the input, a popup text box shows what was entered and it stores the socketid and socketip in a global variable.

rotating display

I've ensured the socketid is the same and correct. This is when the tab connects and changes to the "Configuration & Resets" tab which the above dashboard is on.

GetUIControl

from the developer network debug. Verified the socketid is correct.

at 20 seconds past the min rotate to tab 1, 40 seconds rotate to tab 2, 0 seconds rotate to tab 3. Here is my function code.

debug out of the function which I'm pushing into the control_UI. All the objects look correct to me. I added the seconds to ensure it was firing at the right time interval.

after function

Only issue I see I have is I'm not getting any debug out of the After Rotate UI Control debug node, well that and it's not rotating.

Kyle

[{"id":"5c4dd14a7c2c8a1e","type":"ui_ui_control","z":"204548a488401a1b","name":"Get IU Control","events":"all","x":1260,"y":1200,"wires":[["3e32507cf496c14e","bee1f8812d8d8760","2743e8dfd93fb7c8"]]},{"id":"e21f3e0591833840","type":"function","z":"204548a488401a1b","name":"Rotate tabs based on seconds","func":"let currentTime = new Date();\nlet seconds = currentTime.getSeconds();\nlet socketid = global.get('socketid');\nlet socketip = global.get('socketip');\n\nif (seconds == 20)\n{\n    return {\"payload\":\"change\",\"tab\":1, \"name\":\"Radio Info\", \"socketid\":socketid, \"socketip\":socketip, \"seconds\":seconds};\n}\n\nif (seconds == 40)\n{\n   return {\"payload\":\"change\", \"tab\":2, \"name\":\"OP Competition\", \"socketid\":socketid, \"socketip\":socketip, \"seconds\":seconds};\n}\n\nif (seconds == 0)\n{\n    return {\"payload\":\"change\", \"tab\":3, \"name\":\"Band Stats\", \"socketid\":socketid, \"socketip\":socketip, \"seconds\":seconds};\n}\n\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":1220,"wires":[["57273c6d705dbfce","aa4d1f3abac4a62f"]]},{"id":"57273c6d705dbfce","type":"debug","z":"204548a488401a1b","name":"After Function","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":1180,"wires":[]},{"id":"0979daa9c078c057","type":"ui_form","z":"204548a488401a1b","name":"","label":"Socket ID & IP","group":"0ae735dd5356d1e8","order":3,"width":8,"height":2,"options":[{"label":"Socket ID","value":"socketid","type":"text","required":true,"rows":null},{"label":"Machine IP","value":"socketip","type":"text","required":true,"rows":null}],"formValue":{"socketid":"","socketip":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":620,"y":1060,"wires":[["80b7b6186bcf121d","e0137d1a709aca80"]]},{"id":"80b7b6186bcf121d","type":"function","z":"204548a488401a1b","name":"Set Global Rotating Session ID","func":"let socketip = msg.payload.socketip\nlet socketid = msg.payload.socketid\nglobal.set(\"socketid\",socketid)\nglobal.set(\"socketip\",socketip)\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":890,"y":1060,"wires":[[]]},{"id":"87bbe35110f717a1","type":"ui_toast","z":"204548a488401a1b","position":"dialog","displayTime":"","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"Cancel","raw":false,"className":"","topic":"","name":"Show Socket ID","x":1080,"y":1100,"wires":[[]]},{"id":"e0137d1a709aca80","type":"function","z":"204548a488401a1b","name":"Set payload to printout","func":"socketid = msg.payload.socketid\nsocketip = msg.payload.socketip\n\nmsg.payload = \"socketid=\" + socketid + \"  \" + \"IP=\" + socketip;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":1100,"wires":[["87bbe35110f717a1"]]},{"id":"bee1f8812d8d8760","type":"ui_text","z":"204548a488401a1b","group":"0ae735dd5356d1e8","order":1,"width":8,"height":1,"name":"","label":"This Socket ID : ","format":"{{msg.socketid}}","layout":"row-spread","className":"","x":1480,"y":1200,"wires":[]},{"id":"320d94a84c4edd14","type":"inject","z":"204548a488401a1b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":1220,"wires":[["e21f3e0591833840"]]},{"id":"3e32507cf496c14e","type":"debug","z":"204548a488401a1b","name":"Get UI Control","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1480,"y":1160,"wires":[]},{"id":"2743e8dfd93fb7c8","type":"ui_text","z":"204548a488401a1b","group":"0ae735dd5356d1e8","order":2,"width":8,"height":1,"name":"","label":"This IP :","format":"{{msg.socketip}}","layout":"row-spread","className":"","x":1460,"y":1240,"wires":[]},{"id":"aa4d1f3abac4a62f","type":"ui_ui_control","z":"204548a488401a1b","name":"Rotate UI Control","events":"change","x":650,"y":1220,"wires":[["c473245f3df6387a"]]},{"id":"c473245f3df6387a","type":"debug","z":"204548a488401a1b","name":"After Rotate UI Control","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":1200,"wires":[]},{"id":"0ae735dd5356d1e8","type":"ui_group","name":"Rotating Dispaly","tab":"08eed6c3517c624e","order":5,"disp":true,"width":8,"collapse":false,"className":""},{"id":"08eed6c3517c624e","type":"ui_tab","name":"Configuration & Resets","icon":"mi-storage","order":6,"disabled":false,"hidden":false}]

Bump. Posted this on some other places.

I've been playing around with this for a few days with no progress. I've tried everything.

Kyle

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