Home Automation Project Part 1

I thought I’d share a personal project / build log I’m working on and I’d thought I’d post the outline of it here and update it as I go. So here’s the basic idea, I want to build a home automation server and media center. For the base system I have chosen:

  • JetWay JNF9J-Q87 motherboard with 16GB of RAM
  • 5 Western Digital Red 4TB SATA hard drives in a software RAID 5 for the NAS
  • Intel Haswell Core i5 processor
  • Crucial M500 120GB MSATA SSD for the boot partitions
  • and a Fractal Design Node 304 case
  • Aeon DSA02203-ZWUS Z-wave controller
  • Cisco SG300-10 managed gigabit switch
  • ALIX.2D13 DIY Kit pfsense router
  • Digital Ocean VPS droplet
  • Intel Nuc for LinuxMCE thin client

Using this hardware I plan on building quite the home network. My home server will run Xen Server 6.2 at its base, with several virtual machines running as guests. The VMs include a Debian 7 machine running Samba4 for a domain controller and file server, freepbx for my home phone system, Debian 7 for a freeradius, Linux MCE for a media center controller and home automation center, and a Debian 7 machine running nagios and cacti for system monitoring. The VPS will be running a seedbox, cacti and nagios for remote monitoring. The Alix board will be running pfsense as a firewall / router as well as an OpenVPN server for a secure connection to my VPS as well as secure remote access from outside my network. I will also be purchasing a number of Z-wave devices, light switches, outlets, and the like  so I can remotely operate appliances, lights, etc.

That’s the basic outline for the project, more info will be coming as the various parts are purchased and configured.

Update 1 3/27/14: Fun with Cacti

SO I was messing with cacti today and decided to add bandwidth monitoring on my DO VPS. I created the graph added data sources etc. and kept getting no graph. After some poking around I found that rrdtool was throwing an error saying:
ERROR: mmaping file '/var/lib/cacti/rra/localhost_traffic_in_12.rrd': Invalid argument
I checked the file in question and found it blank, not super. I manually ran the rrdtool with the following info per the data sources debugging in nagios:
/usr/bin/rrdtool create \
/var/lib/cacti/rra/1/8.rrd \
--step 300 \
DS:traffic_in:COUNTER:600:0:100000000 \
DS:traffic_out:COUNTER:600:0:100000000 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \

and there was my error. There seems to be a known bug in cacti that it adds the last “\” when it should not. If you manually run the same commands from terminal but leave off that last slash then everything is happy and you get a graph. After some patience it looks like just waiting 5 minutes for this to poll again it does create the file even though it initially creates this error, strange. I had a bit of a tough time with the cacti / pfsense graphs but this link: http://www.spoonapedia.com/2010/03/how-to-setting-up-virtual-cacti-snmp.html
got me through it.
Update 4/16/14:
Case and mother board have arrived, and been assembled. Pictures coming soon.
I am pleasently surprised by the quality of the case. The photos I have seen of the Fractal Design Node 304 made me think the hard drive holders were plastic but they are in fact metal. A nice touch that bodes well for the longevity of this box. One minor issue is the case came one screw short for holding the motherboard down but I was able to scavenge a spare from one of the many dead computers laying around the hackerspace. The RAM and CPU will be ordered shortly, after that its the 120gb MSATA SSD boot disk and I can get cracking on the installation.

On the VPS front I installed the OTRS ticket system and the iphonehandler plugin to allow app access from android / ios devices. I have used RT4 for ticket tracking in the past and found it adiquate, but OTRS has some nice features and I thought I would give it a shot. Installation is a straight forward apt-get install and went off without too many issues. The iphonehandler plugin can be installed through OTRS’s built in packaging system and was a breeze. To access the ticketing system from my Nexus5 I am using an app called DS Helpdesk. DS Helpdesk is available for free on the andoid market and also has a $15 paid for version. The app requires a file at /usr/share/otrs/var/ called RELEASE.iphonehandle be created as it does not create on automatically. Without it the android app will complain and not allow access. After creating the folder I can now open the app on my phone and view / edit / and create tickets.

I have also set up my OpenVPN tunnel from my home pfsense box to the VPS and have nagios monitoring the pfsense box as well as cacti graphing bandwidth, CPU load, and RAM usage. To help me keep an eye on things I acquired an old atom netbook with a dead backlight and set it up as a dashboard to rotate between my nagios hosts list and my cacti graphs to I can quickly spot issues. More coming on that in the next update.

Update 4/28/14:
Anyone interested in LinuxMCE 1004 I am now the second seed of a torrent .iso file if you dont want to wait for an http download. Torrent can be found here: http://www.sumotorrent.com/en/details/8678570/LinuxMCE-1004-final.iso.html

Update 8/13/2014

Despite the lack of updates this is still very much so an active project. A lot has happened in the last week with this project that may be helpful.

VM:

So after some fiddling I found that the Debian Samba4 VM’s DNS would break after rebooting. After some fiddling i found that network manager was breaking things with its auto configure nonsense, so I removed it. to do so i ran the following:

<code>/etc/init.d/network-manager stop</code>

and

<code>update-rc.dnetwork-manager remove</code>

(credit to http://xmodulo.com/2014/02/disable-network-manager-linux.html for the pointers)

after which you will have to configure /etc/network/interfaces and manually setup your network interfaces. After removing network manager I had no further DNS issues.

After getting that straightened out it was on to adding my 3TB HDD’s to the debian Samba4 VM. The version of xenserver I’m running (6.2) didnt want to let me create a VDI with larger than 2TBs of storage, not to mention my plan of RAIDing the disks would be silly to do with VDI’s. I found this guide (http://techblog.conglomer.net/sata-direct-local-disk-access-on-xenserver/) on how to attach a HDD directly to a VM withou VDIs which will allow me to setup a RAID and use the full 3TB disk capacity.

HTPC:

I decided to ditch LINUXMCE as I had some issues installing it on my NUC and go with XMBCbuntu instead. THis gave me my media center but I still needed a frontend for the zwave system. I found homegenie (http://www.homegenie.it/) a free and open source .net based frontend for zwave with linux and mac versions as well as android and iOS apps for controlling it. After installing mono which was slightly painful I had a working frontend for my zwave system. I also ordered my first zwave device and will be posting more soon on getting that up and running.

Remote Server:

I added some things to my remote digital ocean VPS as well. Modifications include installing deluge and couch potato for tracking all my torrents. In addition I will be installing a bit of software called caketop developed by a friend / co-worker Alex Standke. Its a neat little project which basically gives you a netflix like frontend for all your media files, check it out at: https://github.com/XanderStrike/caketop-theater

Yet Another Update

8/28/14

So I’ve managed to build my RAID 5 and get it running and mounted to all the various machines that need access. In the process of testing I learned an important lesson: OpenVPN traffic shaping is good. I would push large files from my Digital Ocean server to my RAID array over a VPN and found that the VPS would become unresponsive while transferring. I though maybe I was macing out the RAM so I upgraded to the next tier up VPS, 1GB RAM and a faster processor, another test resulted in the same. After checking my Cacti logs and router logs I found that the VPS with its mighty 1GBPs pipe to the internet was saturating my poor 50MBPS connection at home via the VPN. I limited the VPN tunnel to 3MBPS and tested again and found that it resolved my issues.