1 January 2015

HomeControl

I started the project out of necessity to manage the UVR1611 from an iPhone. The UVR1611 is widely used for heating space management here in Austria. A lot of private household use it to manage their heating unit and solar panels. The device is mounted in the basement and is wired to the heating units. It has a built-in LCD screen to visualize the data. Currently the best way to access the data remotely is to use a C.M.I and connect it to the CAN bus. The C.M.I. runs a local webserver, which is best viewed from a computer, to manage the UVR1611. But the website is not optimized for smartphones with small screen real estate.

I thought there is a better way to get the data on the iPhone. Turns out that there is nothing like that. Neither TA, the company behind the UVR1611, nor any other company offers a device to easily access the UVR1611 remotely from your smartphone. Bummer!

Fortunately the UVR1611 provides 2 ways to access the raw data; through the CAN bus and the data bus. Because I could not find any documentation about the CAN bus, I decided to use the data bus.

It was clear from the beginning that the whole project is based on a lot of subsystems. Before I could start coding, I had decide on which technologies to use in the different subsystems. The goal to manage the UVR1611 from an iPhone requires that an iOS app communicates with another computer, which decodes the UVR1611 data bus. Because I believe in simpliciy, I strived for a simple system architecture.

My first approach was to store the decoded data in a local database and provide a REST API, which is then used by the iOS app. This works great on a local network but how do I get access from the internet? Most ISPs let you pay extra for an external IP address. Also if you open up your local network to the internet, you have to do sufficient encryption. All doable things but extra work.

HomeKit

I still remembered the WWDC 2014 where Federighi presented HomeKit. After watching the WWDC session 701 and 213, it was clear to me that HomeKit is the right tool. It’s not only a defined standard and secure, but also solves the problem of remote access.

When I’m able to make the UVR1611 HomeKit compatible, I can write an iOS app which uses the HomeKit framework to access the data. That’s the way to go.

With the ideas and solutions in mind I started researching HomeKit. Publicly available documentation about the HomeKit protocol is rare. The protocol is only available to MFi members. To become a member you have to be a developer with plans to manufacture HomeKit hardware; bad luck software developers.

After weeks trying to reverse-engineering the protocol by myself, I found this tweet. Somebody has done the work already of reverse-engineering the HAP protocol. He shared his research online (unfortunately that document was taken down already). This was one of the biggest turning point of the project. It took me 2 weeks to implement the foundation of HomeControl and another 2 months for the first prototype running on a Raspberry Pi B+ connected to a UVR1611.