This project is actually the documentation of an XMPP interface that we implemented to extend our natural language interface. It has been running for a while and has proved to be one of the most useful and flexible interfaces to our Home Control System (HCS). We therefore though it would be useful to document it in a bit more detail and use this as an excuse to update and improve it.
The basic premise of our natural language interface is that you send it some text and it responds. These could be control commands, requests for information or general queries. In this respect the XMPP protocol is ideal to provide an authenticated and secure interface that works on a wide range of clients and devices.
There are plenty of XMPP servers available and it is also very easy to host your own. We decided to use the Google Talk server though, simply because all of our family members already have Google accounts and there official clients on many devices and many 3rd party clients available too. Google are also very rigorous on security and authentication.
Clients & Accounts
The good thing about XMPP is that it is a very well supported protocol and Android devices come with a Google Talk client pre-installed. We have used it on Google Nexus S Smartphones and our Google Nexus 7 tablet. On our iPhones we are using the Vtok app which is a very good free app that works with Google Talk. It also supports voice and video calling between Android and iOS devices.
Security to our home XMPP interface is enforced by the need to be a friend of our home account.
Like all of our Home Control System (HCS), we decided to implement this a separate Java process. This makes it easier to develop and test. At some point in the future, we may migrate this to being just another thread started by our core HCS process.
XMPP is a widely adopted protocol for IM services. We initially looked at using the XMPP Java API but, after a bit more research decided to use the Smack API. It provides a full framework that supports presence and also has good documentation.
Because you have to be a friend of the XMPP client account to connect and chat with our home, it is possible to identify who (which family member) is having the text chat. Our Java client can see this information and thus provide personalised responses.
Our XMPP home automation client can thus see when contacts are connected and on-line. This would enables our Home Control System (HCS) to make a decision on whether to send notifications via XMPP, instead of SMS. In many respects this makes it behave like Apple iMessage (which is also XMPP based).
This interface has been in use for a while now and proved to be very reliable and a very handy way to communicate with our home, whether we are at home or at some other remote location.
We are planning some more advanced based upon XMPP and would like to add both voice and video interaction in the future. Before we do this though, we plan to add file transfer capability.
We are also currently working on a related project, which uses the WebSocket protocol to provide a similar interface.
We are now seeing errors though, of the form:
Failed to parse extension packet in Presence packet.
This is a Google issue and is explained in this thread.
Now that Google+ has replaced GTalk, it is possible to have a discussion with out house via the Google+ web interface.
We have now included XMPP as a native capability (and separate Java thread) within our Home Control System (HCS). Our smart home also now has its own identity. We have taken this approach because we found the XMPP natural language interface incredible useful for access by all family members, from any location. This means that all elements of our Home Control System (HCS) are accesible via this interface. We can query all aspects of it and control everything. The response time is also significantly better.