One Year Of Smart Home
By Romain Picard on Monday 4 January 2016, 10:00 - Permalink
One year ago, I announced the start of new smart home project project, and detailed the motivations and aims of it. This year was a busy one and a lot of parts of this project have evolved. It also now has a name.
After twelve months of development, it is the good time for a status. If you followed the previous articles, you know that there are 4 components in the project : The devices, the concentrator, the cloud platform, and the mobile application. Here is a diagram of the current state for each one:
Three kind of devices are currently supported : Temperature sensors, power plugs, and openable devices like shutters and gates.
Temperature sensors are supported since the beginning of the project because the original aim was to control heaters automatically. This is not the aim anymore, for several reasons :
- Some solutions already exist for all types of heat systems
- My use-case with electric heaters is very specific to France
- It seems difficult to make the system aware of "non connected" heaters such as wood heaters.
Power plugs are usually used to control decorative lamps or things that are used once in a while. This is why I do not plan any automation use-case with these devices. It is however fun to switch on the christmas tree with the smart phone !
Openable devices are supported with the Somfy RTS protocol, via the rfxcom transceiver. These are the type of devices that I focus on : shutters and gates are devices that people already have at home, that are controlled several times per day, and that could be automatically controlled most of the time.
The only feature that was added to the concentrator is the support for the Somfy RTS protocol. Following an Agile development, I re-designed several parts to solve issues and add features. Many improvements were done in Flock:
- A CLI client allows to monitor and control the devices.
- A database of the known and paired devices is now maintained.
- The RPC protocol was changed from AMP to an evolution of MsgpackRPC.
The last point is still not satisfying : Many RPC protocol exist, but finding one that supports RPC, publish/subscribe, and peer to peer communication is not that easy. I will probably switch to ZeroMQ in the future.
Mastiff also evolved. It is now split in two components : An XMPP client, and the smart home model. The XMPP client is now in a dedicated daemon. It is also written in python but uses SleekXmpp instead of twisted. I had reconnection issues with the twisted XMPP client (that could be solved however), and then I had to use the ping xep to ensure that the very long connection of the concentrator is not silently closed. Doing this with SleekXmpp is very easy, but much more difficult with the twisted client.
The smart home model is still in the mastiff daemon. It stores the devices metadata and allows to monitor and control them.
This is the last part that I worked on. I already talked about this in the last post. In addition to the XMPP server, a Mongodb server and a logger XMPP component logs all actions. This is temporary, and for study purpose only : The final product will not log user information on the cloud.
As you can see, the diagram contains no details on the mobile application. The current application is written in HTML/JS thanks to EnyoJS and Cordova. This choice was driven by the fact that I expected to be able to write the same application for Android and iOS. Unfortunately it is now obvious that this is not possible : A dedicated application will be necessary for each platform so that we can benefit from their specific features instead of using the lower common set of features of all supported platforms. This also means that I focus on the Android application in a first step because Android allows to do much more things than iOS.
igGnz Serving You
I am currently working on using the location and accelerometer sensors to extract a relevant context information. Last year, I read a lot of publications on machine learning and mobile sensor analysis. I also read some books on the subject. Even better, I had the opportunity to attend some of the excellent meetups on this subject to talk about this with other people. I have a first design that should allow to automatically control the gates and shutter. I hope that the implementation will prove the design to be correct !