# Return to home screen - monitor user screen activity

**URL:** https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144
**Category:** Dashboard
**Created:** [5 May 2020 18:14 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144 "2020-05-05T18:14:04Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [5 May 2020 18:14 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/1 "2020-05-05T18:14:04Z")

</div>

I am trying to build a flow to return to the home dashboard (with time and date) after x minutes of inactivity:

- ui\_control signals the change of dashboard.
- function node starts a countdown timer if the dashboard name is not equal to home
- when the countdown timer expires, it triggers a ui control to switch to the home dashboard.

I want to reset the timer in case of user activity so it will not time-out and trigger a dashboard switch if a user is active on a dashboard.

How can I trigger a timer reset if there is user activity without having to modify each and every button? (sort off on\_click or on\_touch event) Is there a node that I can use that will trigger an output if a user clicks any of the buttons on a dashboard? Note, the primary interface is a touchscreen.

Node-red v1.0.6  
Node-red-dashboard v2.21.0  
Running on a Raspberry PI 4+  
Connected to an ELO touchscreen with USB

---

<div class="post-metadata">

### Author: ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)
#### Post date: [5 May 2020 18:59 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/2 "2020-05-05T18:59:19Z")

</div>

This is not completely what you want but it can help you started.  
Designed it for a touchpanel, but never used in production so not sure if it works flawless.

The GetChanges Ui\_control keeps a track on what client is clicking, it identifies the client with the ip number. Handy if you want the touchscreen in the bedroom uses an other default tab then the touchscreen in the living room.  
In NotMydefaultTab the flow will check if the default tab (in this case tab 0) is active. If not then the trigger node will start and after 60 seconds the default tab "Verlichting" will be shown.  
If tab is already the default tab 0 the trigger node will be reset.  
You need to add yourself that the trigger node get trigger by the elements on your dashboard to reset the 60s countdown.

Have fun.

```auto
[{"id":"c6c67e1c.63cb1","type":"ui_ui_control","z":"b3f31bbd.8966b8","name":"GetChanges","x":130,"y":140,"wires":[["3b5784d6.3a6fc4"]]},{"id":"3b5784d6.3a6fc4","type":"switch","z":"b3f31bbd.8966b8","name":"Device 192.168.1.22","property":"socketip","propertyType":"msg","rules":[{"t":"eq","v":"192.168.1.22","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":140,"wires":[["75e63278.81e8bc"]]},{"id":"75e63278.81e8bc","type":"switch","z":"b3f31bbd.8966b8","name":"NotMyDefaultTab","property":"tab","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":140,"wires":[["b26b3f08.05074","c90ba11a.63bb58"],["19f67583.822112","d1c8b53d.5e7f3"]]},{"id":"b26b3f08.05074","type":"trigger","z":"b3f31bbd.8966b8","op1":"","op2":"Verlichting","op1type":"nul","op2type":"str","duration":"60","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":1090,"y":140,"wires":[["215cff6e.0a66b"]]},{"id":"215cff6e.0a66b","type":"ui_ui_control","z":"b3f31bbd.8966b8","name":"","x":1300,"y":140,"wires":[[]]},{"id":"d1c8b53d.5e7f3","type":"change","z":"b3f31bbd.8966b8","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":180,"wires":[["b26b3f08.05074"]]},{"id":"c90ba11a.63bb58","type":"debug","z":"b3f31bbd.8966b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":860,"y":100,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [5 May 2020 20:05 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/3 "2020-05-05T20:05:45Z")

</div>

Thanks for your prompt reply. With respect to: "The GetChanges Ui\_control keeps a track on what client is clicking" :

I understand this is based on a ui\_control node that responds to changes of the dashboard tab, I have taken a closer look t the output but it does not seem to respond to buttons clicked, sliders changed or other controls on the dashboard that have been updated?

I am looking for a node that will respond to these kind of events. Every time a button is clicked or a slider is moved (indicating the user is still active), the node should create an event that resets the timer. If the user is inactive, there will not be a timer reset and after the timer reaches zero, the ui-control triggers a change to the home screen.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [5 May 2020 20:33 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/4 "2020-05-05T20:33:31Z")

</div>

> respond to buttons clicked, sliders changed or other controls on the dashboard that have been updated?  
> I am looking for a node that will respond to these kind of events.

The buttons, sliders, other controls have an output port on the node, which emit these changes.

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [5 May 2020 20:47 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/5 "2020-05-05T20:47:09Z")

</div>

I have it setup like that right now but with many elements its a lot of wiring. I am trying to avoid having to wire up every single button, slider, etc. to the reset of the countdown timer. It would be nice to have a node that triggers an output if any element.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [5 May 2020 21:02 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/6 "2020-05-05T21:02:13Z")

</div>

You can use a status node, that will emit all changes on the flow tab (ie changes per tab only).

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [6 May 2020 06:26 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/7 "2020-05-06T06:26:49Z")

</div>

Bakman2, yes that provides the functionality I am looking for. Definitely less hassle than wiring the output of every UI element.

Thank you all for thinking with me, hope to be able to return the favor in the future 🙂

The setup:

- Home screen with two buttons (Date and Time)
- Clicking either of the buttons will change to the Main screen and start a count down timer
- When the time expires, the UI control changes the screen back to the Home screen
- If a button or slider is touched on the Main screen, the timer is reset.

Background: using this setup because if the screensaver blanks the touchscreen when the Main screen is shown, waking it up by touch the screen will also click a button you cannot see.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9c94b3047a4b090835713b0d36a3410348f06a68.png)

---

<div class="post-metadata">

### Author: ![EmilWesselink](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/emilwesselink/32/65829_2.png) [@EmilWesselink](https://discourse.nodered.org/u/EmilWesselink)
#### Post date: [6 May 2020 08:04 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/8 "2020-05-06T08:04:12Z")

</div>

Nice idea, I had the same challenge with a raspberry pi screen. Pushing a button when trying to wake up the screen. But using the strength of node red and the pi, I connected a movement sensor to a gpio and with an exec node I can wake the screen up.

```auto
xset -display :0 s reset && xset -display :0 dpms force on

```

This command is for the raspberry pi screen, it should be also available for the signal for the ELO

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [6 May 2020 08:21 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/9 "2020-05-06T08:21:34Z")

</div>

I have used **vcgencmd display\_power 0** to turn the screen off and **vcgencmd display\_power 1** to turn it back on remotely if I for example want to show a camera that is triggered by motion. Using an Exe node that responds to a MQTT message. My home automation system gathers wake-up triggers from a wealth of signals and decides to wake up the screen based on time of day, security system status, etc.. Have not yet managed to put a motion sensor in place that is accurate enough to turn on the touchscreen if the user is close, and more important, not trigger if a user just walks by...

---

<div class="post-metadata">

### Author: ![EmilWesselink](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/emilwesselink/32/65829_2.png) [@EmilWesselink](https://discourse.nodered.org/u/EmilWesselink)
#### Post date: [6 May 2020 08:27 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/10 "2020-05-06T08:27:48Z")

</div>

Indeed this! For this you should find a proximity sensor. Except the ultrasonic standard arduino I have no experience with them but a quick google search shows some nice stuff.

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [11 May 2020 19:39 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/11 "2020-05-11T19:39:42Z")

</div>

Emil,

This might be a basic question (caused by my very limited knowledge of Linux) but maybe you can point me in he right direction.

When I open a command prompt in a VNC session using **xset dpms force on** and **xset dpms force off** work as expected, but when I try to use a exec\_node the execution fails with the following error message:  
Code 128  
/bin/sh: 1: xset dpms force on: not found

Any idea how to solve this?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 May 2020 20:16 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/12 "2020-05-11T20:16:10Z")

</div>

Try putting the full path to the xset command. The environment that node-red runs in may not have the path setup. You can find where it is by running `which xset` which will say something like `/usr/bin/xset`, in which case us the command `/usr/bin/xset dpms force on`. Also make sure Append Payload is not set in the exec node config. I am not certain that it will work in an exec node though, it may need to be running in an X session.

**[Edit]** You might need the display: specification in the command.

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [11 May 2020 20:42 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/13 "2020-05-11T20:42:14Z")

</div>

Thx Colin.

I tried the path  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/32056de412edbb8bf1d7b0bb4e057dbeb28815fe.png)

but that does not work either.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4ce4dd873d63080729b1353885111ee27f283cc1.png)

I am confused about the additional path shown:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e40bb180329debc237191befc07f20122447bf96.png)

I guess that is wat is causing the issues.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 May 2020 21:12 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/14 "2020-05-11T21:12:25Z")

</div>

`/bin/sh` is the shell programme trying to run the command. Why have you got quotes round the command? Try taking those off. I think the quotes are telling the shell to look for a script called `/usr/bin/xset dbps force off` which isn't what you want.

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [12 May 2020 06:14 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/15 "2020-05-12T06:14:31Z")

</div>

Well I finally got it sorted out, thanks for all suggestions!

I first tried the suggestion to leave out the quotes (just _/usr/bin/xset dbps force off_ in the exec\_node) but that ended in an error message: _/usr/bin/xset: unable to open display_ Searching for this error I found many posts but no solution until this morning.

Following the guidance in the script, I created a script (DispON)  
_#!/bin/sh_  
_export DISPLAY=:0.0_  
_# Turn off display_  
_xset dpms force off_

And refer to the script in the exec node: _/home/pi/DispON_

That works like a charm 🙂

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [12 May 2020 07:01 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/16 "2020-05-12T07:01:11Z")

</div>

> [@EmilWesselink](#):
>
> xset -display :0 s reset && xset -display :0 dpms force on

Did you try using that technique, suggested by @EmilWesselink a few posts back in this thread? I did say you might need to specify which display you wanted to control.

---

<div class="post-metadata">

### Author: ![fvhemert](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fvhemert/32/20278_2.png) [@fvhemert](https://discourse.nodered.org/u/fvhemert)
#### Post date: [12 May 2020 07:33 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/17 "2020-05-12T07:33:44Z")

</div>

Yes I did but could not get anything to work that did not use a script as an intermediate... Not sure if this was maybe caused by using the quotes, and me mis-understanding the guidance provide by the node: _Commands or parameters with spaces should be enclosed in quotes_

When I have the time later today, I will give it another try and report back.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [12 May 2020 08:00 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/18 "2020-05-12T08:00:41Z")

</div>

> [@fvhemert](#):
>
> Commands or parameters with spaces should be enclosed in quotes

That means if the actual command (xset in this case) or individual parameters (such as dpms or force or on in this case) had spaces then that individual parameter or command should be in quotes. So if, for example, you wanted to use the `mv` command to rename a file called `some filename` to `some other filename` then you would use  
`mv "some filename" "some other filename"`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 May 2020 08:00 UTC](https://discourse.nodered.org/t/return-to-home-screen-monitor-user-screen-activity/26144/19 "2020-05-26T08:00:45Z")

</div>

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