Turn off/on screen

I am running a windows 10 desktop in (sort of) a kiosk mode. The desktop is connected to a Elro touchscreen on the wall of my living room and fully focused home automation.

I am looking at replacing the current touch screen by a NodeRED dashboard.

To be able to do that I need to be able to control monitor ON/OFF from the dashboard and prevent it from being on all the time.

I want to accomplish the following:

  • Screen is off, first touch switches on the monitor without accidentally triggering a button
  • Controlling screen on/off by sending a MQTT message. (enables me to show a camera image if there is motion)

I am not bound to WIN10 and open to replacing the PC by a RPI if that will make things easier.

Wondering if someone has seen this ask before and has a brilliant solution. :slight_smile:

If you work out how to turn it on/off from the command line then you should be able to do it using an exec node to execute that command.

Thanks Colin.

I considered using the exec node but as far as I know this node will execute the command on the PI running Node-RED instead of the windows desktop that has the touch screen connected and is running a browser to connect to the dashboard..

Are you aware of a node that can execute locally?

There are several command line utilities that can switch off the screen, in the past I have been using : https://www.nirsoft.net/utils/nircmd.html and that used to work pretty reliable.

I don't believe that you mentioned that node red is running in a different machine.
You could run node red on the windows machine too, and use mqtt to allow the main node red to tell the one on the pc when to switch the screen on/off.

You are right, wasn't really clear on that. I currently have a dedicated RPI running node red (for performance reasons and locally connected devices) and the idea is to have a separate device in kiosk mode with just a browser connected to the NodeRED dashboard. That device could be the (existing) WIN 10 desktop/minipc or a RPI.

Having a second instance on the touchscreen device seems an interesting option, I'll give that a try this weekend. Off course I still prefer to have the option to execute a command through the browser on the local toucscreen machine without having to setup a secondary instance of NodeRed.

Tested the solution and it works as expected. For future reference, here's the setup and relevant configuration:
Raspberry PI

  • MQTT
  • Nodered with main dashboard

Win10 Desktop

  • Touchscreen
  • NodeRed for windows installed
  • Simple dashboard: MQTT subscribe node,topic "Touchscreen/LivingRoom" and a EXEC node pointing to c:\NIR\nircmd-x64\nircmd.exe
  • Internet explorer in full screen pointing to main dashboard of Rasberry PI server

To turn screen off:
Topic: Touchscreen/LivingRoom
Payload: monitor async_off

To turn screen on:
Topic: Touchscreen/LivingRoom
Payload: sendkey shift down

nircmd.exe can be downloaded from https://www.nirsoft.net/utils/nircmd.html

Hi,

I'm working on a similar solution, but unfortunately the exec node is not working. It points on the nircmd command, but not does anything. The debug node gives me back, that the command was exectuted properly.

I'm using a windows 10 PC and node-red runs in iobroker(Smarthome).

Thanks for your help.

You have to realize the EXEC node, executes the command on the machine NodeRed is running on. Since my NodeRed is running on a PI and I am using a touchscreen that connects through a browser I had to take an alternative route as suggested by Colin.

I installed NodeRed for Windows on the touchscreen and configured a dashboard that responds to a MQTT message by triggering a EXEC node on the local machine. This works, using it every day :slight_smile:

1 Like

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