When I go to sleep at night I like it dark. I also keep my computer on 24/7. In the past when going to sleep I would hit the power switch on my monitor. Or more often than not I would leave it on. Now when I'm in bed I click an icon on my iPhone and the monitor turns off. You can have this up and running in 10 minutes.
For this to work, your phone must be wifi enabled and connected to the same network as your PC. I use an iPhone in this example but any phone able to use wifi will work.
Here's what you need:
- NirCmd: This command line utility is used to put the monitor into sleep. Download - Website
- QuickPHP: You need to run a web server that supports PHP on your computer. Any server will work. I chose this one because it's lightweight and quick and easy to setup. QuickPHP- Website
- PHP Source Code: Download
- After downloading NirCmd, unzip it and place nircmdc.exe in your system32 directory, i.e. C:\Windows\System32\. Note: Placing an executable in system32 directory is great because then you can access the files from any directory within command line, no need to find the directory first.
- Create two new folders. One for the PHP Server and one for your web files. I will use the following directories: C:\PHPServer and C:\PHP
- Download QuickPHP and unzip. This program will not install, you must place the program files somewhere. I moved them to C:\PHPServer for easy access.
- Download the source code and place it in C:\PHP.
- Go to the QuickPHP directory and run QuickPHP.exe - Change the "Root" folder to whatever you choose above as the web file directory (C:\PHP). Note the server port, default 5723. Hit Start.
- For the next step you need to know your local IP address. To get this go to the start menu. Type in "Run" in the search bar and hit enter or simply click the run icon. Where it says "open" type in "cmd" - You now have a command prompt open. You should see something like C:\... type in "ipconfig" - Now look for your the number labeled IPv4 address. It will likely start with 192.168 - This is the number you will use in YOU_IP in the next step.
- Get your iPhone and open up Safari. In the address bar, type in http://YOUR_IP:5723 - i.e. http://192.168.1.2:5723
- Click the + sign and select "Add to Home Screen"
- Want to turn it off? Click:
There are a few ways this could be modified to better suit you: Modify the PHP code to only accept certain IP addresses. The PHP code is very simple and does not protect you from other people on your network turning your monitor off. That is why its useful to use a non-standard port and have a firewall on your network blocking outside traffic. - Alternatively, open a port on your firewall to allow outbound connections. Then use your WAN IP (www.whatismyip.com) to connect to the computer. This removes the need for the phone to be connected to wireless. - Change the filename to blah.php. It would prevent others from turning the monitor off because you then have to access http://YOU_IP:5723/blah.php