I am already monitoring the Wifi status of my Android phone, so it can inform the house when I am home, but I want to do more.
My system runs the OpenRemote controller and my ORControl socket server on my home automation server machine, and my ORMusicControl socket server on my music server box.
I have already experimented with use of the AutomateIt Android App, so I investigated whether I could use this to inform me when events happen on the phone. I would like to monitor at least switching the phone on, receiving a text and receiving a phone call.
AutomateIt has triggers for all these events, so that is easy, but what to use as the Action?
There is an Open URL action, and the simplest way to use that seemed to be to send an HTTP request to ORControl. As ORControl already listens on a port for socket connections, a URL of http://homeserver:port/request would send a GET request to ORControl. Who needs a web server.
So I tried this and the unmodified ORControl printed out the HTTP GET command as an unknown command. Interpreting GET /request command is easy enough, so this method seems OK. When I receive the “request” I can inform OpenRemote via a sensor, so that I can show that I have a text or whatever on a screen in my OpenRemote panels. I can also get ORControl to give me a spoken alert, or other form of alert.
Currently the Android browser did not like my default reply of “0” (for success), although Chrome on my PC thought it was fine. I might have to return a fuller response to avoid an error message.
The bigger problem is that the Android browser gets opened and left open, which is not very satisfactory. An alternative is to start an Android application that sends the HTTP request and then shuts down.
Another alternative is to use the Tasker Android application rather than ActivateIt as Tasker seems to be able to send HTTP requests without using a browser.
It would be easy to extend this system to control things by sending text messages to my phone at least when my phone is in Wifi range.
UPDATE: Another way I could do this is to use the OpenRemote REST API. I could add a button to press when I receive texts or phone calls etc., and make ActivateIt or Tasker send the http rest request to click the button. The OpenRemote controller would then send a command to ORControl telling it about the event.