Apr 182012
A while back I set out to find a way I could control my computer through my phone with text messages.
Requirements:
- Speed (less than 2 minute response time)
- Reliability (works for the most part)
- Expandability (features are easy to add)
How it works:
- Phone sends message to Google Voice
- Google Voice forwards a copy over to Gmail
- Gmail filter forwards it to Mercury mail server setup on my home computer
- Mercury mail rule launches a batch file when it receives a new message (based on a subject and from address)
- Batch file copies the mail file from the incoming mail folder over to a processing folder
- Batch file launches a small php app with the message as a parameter
- PHP app (with the help of a library) confirms that the message is from a trusted source
- PHP app then extracts command from body of message
- Body of message contains a command (with a certain symbol to indicate it is a command)
- The first part of the command is a function, the rest is parameters separated by a delimiting character
- PHP app loads “modules” from a folder. Each module contains a function
- PHP app executes function and passes parameters
- Module executes commands and returns data
- Data is prepared and sent out (through PHP mail())
- PHP app moves message to executed folder and adds a log entry
Programs used:
- Google Voice & Gmail
- Mercury mail
- PHP
Results
It’s been working fairly well so far. Right now it’s able to fetch weather data using a module I made that interacts with Weather Undergrounds API. It can also execute certain commands like ipconfig, ping, uptime.