Change Screen After Inactivity

Hi All,

We have a decently intricate dashboard that is now being used in the field for our proof of concept. After observing interactions with the users over the last two weeks, we realized we needed a way to revert back to the Home screen after inactivity. I don't want to just do it after a time in case they were using it or in the middle of an event.

I am running on a Raspberry Pi. I saw a previous post that talked about using a status node to see if there were changes on any UI nodes, but am unsure how to do that.

Thanks,
Paul

All interactive dashboard nodes produce some kind of output. Treat it as user activity event and in parallel with main flow from button or whatever interactive node, feed it also to the trigger node. Trigger node should do nothing when payload arrives but reset the timer. And if timer reached (means no activity) the trigger node fires the flow to uiā€control node which changes the tab to home tab.

This does not involve user just moving the mouse but not pressing any button or fill any form or similar. It does not tell about user presence but just activity.

This sounds like exactly what Im looking for...I forgot to mention our dashboard is displayed on a screen in Kiosk mode so theres no cursor anyway, just a touchscreen.

Treat it as user activity event and in parallel with main flow from button or whatever interactive node,

What exactly do you mean by that?

Picture is more than thousand words

And the trigger node config should be like this

2 Likes

Appreciate your help...Is there a way to do this without having to route all of our UI objects to a trigger node? I am following what you're showing here, but we have a ton of UI objects that would need to be routed - which can obviously be done but just wondering if theres another way without routing it all? Thanks again

Of course there is.
It takes for every handler (function after the interactive node) to set current time as timestamp to some variable stored in global or flow context. And then periodically check that variable. If time difference between current moment and stored variable is bigger than you considered inactivity timeout, send message via ui_control node.

1 Like

Well you "only" have to wire up ones that you want to monitor (ok so it could still be a lot :slight_smile: - but you could use link nodes that are fairly small and group them into bunches.

1 Like

That is what I ended up doing. We do have quite a few buttons but this was doable and allowed us to keep it neat. I am not yet advanced enough to do what @hotNipi had last suggested haha. Thank you both!

If you have a ui template node on your dashboard, you can completely remove all the link nodes & add some generic code to detect inactivity and send a msg back to node-red...

<script>
  (function(scope) {
    const idleTimeMS = 60000; //60000 = 1 minute
    function idleMonitor() {
        var t;
        window.onload = resetTimer;
        window.onmousemove = resetTimer;
        window.onmousedown = resetTimer;  // catches touchscreen presses as well      
        window.ontouchstart = resetTimer; // catches touchscreen swipes as well 
        window.onclick = resetTimer;      // catches touchpad clicks as well
        window.onkeydown = resetTimer;   
        window.addEventListener('scroll', resetTimer, true);

        function action() {
            scope.send({ topic:"change_tab", payload: {"tab":"my_tab_name"} }); 
        }

        function resetTimer() {
            clearTimeout(t);
            t = setTimeout(action, idleTimeMS);  // time is in milliseconds
        }
    }
    idleMonitor();

  })(scope);
</script>

then connect a switch node to the output of the ui-template - if topic == "change_tab" you can send the payload to the ui_control

Thank you!!