Tuesday, February 2, 2016

Home Automation

Some questions from a colleague about home automation got me thinking. Maybe I should document what I use and why. Well, this entry is an attempt to do so. First some background.

When Smarthome first introduced the Insteon line of devices and protocol they made it fairly easy for developers by providing full documentation and development kit. The price point was less than the equivalent Z-Wave and UPB products but more than similar X10 products. However, it also would work with X10 products. I had some X10 products (dimmer switches, lamp/appliance modules). Since I preferred to have a Linux based control system, getting started with the Insteon SDK seemed like the way to go. I jumped in with the development kit (PLC & lamp module) plus a few additional switches and lamp modules. Using the documentation, I started writing Insteon tools for Linux. I developed a fairly robust set of tools to control devices, dump link tables, save and compare topology. Then Smarthome changed the protocol. The differences were substantial and you had to support both.

It was about this time that a company called Universal Devices Inc. came out with the ISY26. The ISY26 was an embedded controller for Insteon. Since they were dealing with all the special cases needed to interact with all the different devices and both protocols and provided a nice network based API to interact with the ISY26, it seemed like a good way to go. I jumped on-board. About this time I was also looking into ways to get touch screen controllers in the house. I started playing with Cinemar’s MainLobby home automation software. This software is Windows based, but allowed for custom plug-in’s to support various HA type devices using Visual Basic or C#. I wrote a couple of simple things to get familiar with it and then developed a plug-in to interact with the ISY26. Because of this, UDI approached me about developing something similar for HomeSeer, another home automation software company. A lot of what I created for MainLobby was applicable for HomeSeer so I decided to go for it. It took about a year to fully develop a plug-in for HomeSeer, but I was able to create a core library that interacts with the ISY and front-end code for both MainLobby and HomeSeer that made use of it. The HomeSeer plug-in is available in the HomeSeer store. Attempts to get Cinemar to officially recognize my MainLobby plug-in failed. When a new player in the home automation software field emerged, Code Core Technologies Elve, I switched over to that for my home control system. Developing touch screen interfaces was easy and they fully supported third party developers creating additional drivers. Using the same base code that was used for the MainLobby and HomeSeer plug-ins, I quickly created an ISY driver for Elve. I’ve also created and modified a number of other drivers for Elve. Being able to customize it for my environment was a huge selling point. Unfortunately, Code Core Technologies was unable to survive and has mostly shutdown. The good news is that the latest version of Elve is still available as a free download. I’m currently working on a driver for the RainMachine irrigation controllers.

My current system is:

A UDI ISY 994i controller with Z-Wave module
Elve 2.2 running on a Windows XP virtual machine
Insteon light switches throughout the house
Insteon keypad switches
Insteon lamp modules for various stand alone lamps
Insteon LED light bulbs for a couple lamps
Insteon motion sensors for garage, side door light, and den light
Insteon garage door sensor/control module
Insteon Venstar thermostat
One Z-wave dimmer switch
Two Z-wave lamp modules with beaming support
Kwikset Z-Wave deadbolt
DSC alarm panel
Russound CAV whole house audio controller
Roku 2 media streamer
ASUS All-in-one PC touchscreen computer for monitoring & contol

Thursday, October 15, 2015

Home Data Collection

I’ve been thinking about the data collection I do. Specifically about what machines are doing the collection and what type of system load and stability my current system has.

Today, I have two primary data collection functions running.

1) Home electricity production/usage data.
2) Outside weather data.

For the electricity data I have a daemon running on my main machine that pulls the raw data from a monitor attached to the mains. The raw data is processed and stored in a MySQL database. The monitor is attached to the machine via a USB port.

For the weather data I have a program running on a Raspberry PI that intercepts raw data from an Acurite 5-n-1 sensor bridge, processes it and stores it in a MySQL database.

The MySQL database resides on a dedicated disk partition and the server is running on my main machine. The database is also used for a few other things like a bug tracking database. The clients of the database are my web server (also running on the main machine) and the home automation software package (currently running in a vmware Windows instance on the main machine).

What if this was all consolidated on to a dedicated home data collection server? That’s the question I’m asking myself right now. That leads to a few more questions.

- What exactly should be consolidated? Data collection daemons, MySQL database, webserver?
- Can a Raspberry PI handle all of this?
- Would it improve stability?
- What hardware is needed in addition to the Raspberry PI?
- Can an SSD drive be used with the database?
- How easy will be to back this all up?

After a bit more thought and some research, I think I have answers for most of the questions. All three major components should be consolidated. Given how much interaction there is between the data collection daemons and the database it just makes sense to have them on the same machine if possible. Same for the web server and database. The disk space needed to support both database and web server is not excessive and easily handled by a low cost SSD. Currently it’s less than 50GB and it’s not growing that fast. A 120GB drive should suffice for a number of years. The Raspberry PI should handle the data collection daemons easily. It should also be able to handle the database. The web server handles mostly private needs so I think that’s fine, but will need to do some testing to be sure.

For hardware I think just the Raspberry PI with OS on an SD card. Probably a USB hub to handle the addition network interface, electricity monitor and SSD disk. And of course the SSD disk 120GB or 240GB.

The SSD drive can be shared via NFS and/or SMB and that provides both a way to back it up and add web content easily.

So time to start prototyping. I have an extra PI and spare hard drives so I should be able to install most of the software and make sure the services are running. Then it’s just a matter of switching over.

Now what other data could I collect using this setup?