I have several tablets hanging to the wall for controlling my Living room lights, Office environment or Garden lights. To save energy I would like these tablets to power off at night automatically or even better, have a proximity sensor in front of them or a tap to wake. Continue reading to see how to fix that!
I experimented with the following:
- Almost none of the tablets support Wake-on-LAN (WOL) or Wake on WLAN (WoWLAN). Even with the latest Microsoft Surface Pro 7 I was not able to do this.
- Another problem that the devices have is that there is no Tab-To-Wake functionality. So when the tablet is off or even only the screen is off (settings -> energy saving -> screen off after 1 min. of inactivity), you need to press the power button at the side of the device.
- Proximity sensor can be read using a .Net example, the Microsoft Surface Pro 7 has such a proximity sensor but I didn’t succeeded to script this.
So I came up with a Powershell script that you can run on any Windows Tablet. It listens to port 8080 by default. You can call it like a REST interface from your Domoticz or Gira Homeserver when you leave or enter the house or when you are going to sleep.
Call http://ip-address-of-tablet:8080/day to lighten up the display to a default of 50% brightness
Call http://ip-address-of-tablet:8080/night to set the backlight to almost zero and put a blank screen on it. It actually shows the Windows default blank screensaver, so when you tab the screen, it ‘wakens’. This suggest a sort of tab-to-wake functionality.
Call http://ip-address-of-tablet:8080/day/80 to lighten up the display to a default of 80% brightness (in case there is a lot of sun shining in the room).
Call http://ip-address-of-tablet:8080/kill to stop the script.
Notes:
Even at day mode, the tablet will put a blank screen on after 240minutes, which you can exit by tapping the screen.
You can change all values like the default 240minutes or the default port 8080 since the script is open-source!
Download the script here
Before running the script, run: “Set-ExecutionPolicy Unrestricted” once in a powershell cmd, because the script is not code signed with a certificate.
TIP: Set the script in a Scheduled Task that starts when the user is logged in (with elevated privilidges) and disable “stop tasks after running for 3 days”.