Home Monitoring Inaugural Foray

I have for some time been obsessive about instrumenting the software systems I build professionally.  I figure I might as well bring that level of rigor to my home’s function.  A colleague suggested that I look into sensors created by AeoTec and automation orchestrated by Home Assistant.  To that end I purchased a Raspberry Pi 3 to run HA, a Z-Stick to bridge the various devices to it, a Multi Sensor 6, and a Door/Window Sensor 6.  Those devices arrived last week and I spent a little time this weekend contriving to reach a “Hello, World” level of sophistication.

The following is essentially a collection of notes on the steps required and my reactions along the way, not a meaningful synthesis which will probably require several more weekends of tinkering to reach.

After booting up Raspbian, the following got me to a basic level of function (can’t promise there aren’t some ordering or redundancy issues):

 

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install python3-pip python3-dev
  4. sudo pip3 install –upgrade virtualenv
  5. sudo apt-get install python-virtualenv
  6. virtualenv –python=/usr/bin/python3.4 $HOME/homeassistant
  7. source $HOME/homeassistant/bin/activate
  8. pip3 install –upgrade homeassistant
  9. $HOME/homeassistant/bin/hass
  10. sudo apt-get install libudev-dev
  11. reboot
  12. [unplug/replug Z-Stick]
  13. ls -ltr /dev/tty* | tail -n 1
    • crw-rw—- 1 root dialout 166, 0 Nov 25 18:16 /dev/ttyACM0
  14. vi .homeassistant/configuration.yaml
    • zwave:
      • usb_path: /dev/ttyACM0

Ultimately I was able to access the web GUI at http://localhost:8123 with USB keyboard/mouse and HDMI direct access to the Pi.

The main fiddly bit was in 12-14 where you’re figuring out the device ID of the Z-Stick and then persisting that to your HA config.  You’ll also get burned along these lines if you follow the printed instructions with the AeoTec devices which counsel you to unplug the Z-Stick as step one of putting it into “Inclusion Mode” to add devices to the network.  You actually want to be engaging “Inclusion Mode” via the HA GUI, firstly to ensure that HA acquires all information possible from the pairing process, and secondly so that the device does not pop back up under the /dev file system with a different name that does not match your config.

The Multi Sensor mostly worked out of the box with HA.  The Door/Window Sensor, however, created a fair deal of frustration.

Specifically, the latter would stay stuck in the “On” state.  The .homeassistant/OZW_Log.txt log file was somewhat elucidating of the problem in conjunction with some Googling.  Out of the box, the sensor sends a “Basic Set” event when the sensor’s state changes, but you need it to send a “Binary Sensor Report” for HA to behave as you’d expect.  Not only was figuring out the source of the trouble painful, but so was figuring out the resolution.

HomeAssistant wrote a zwcfg_0xf7a9395f.xml file that contained all of my detected devices.  Between that and a spec I found online I deduced the set_config_parameter invocation I needed to do.  Sort of.  I also had to read stack traces out of .homeassistant/home-assistant.log and do some more Googling to realize that where the docs indicated it wanted a numerical value the API actually expected what you would find in the “label” field of the ZWCFG XML.  What ultimately worked follows:

2017-11-26-174602_1824x984_scrot

The last gotcha stems from the Door/Window Sensor being a battery operated sensor as opposed to hard-wired.  This means that it spends most of its time sleeping to conserve power, waking up only when either the magnetic field changes or a scheduled time arrives.  To sync a new config immediately you’ll need to press the button on the sensor which causes it to wake immediately and perform tasks that otherwise would have waited until the next scheduled time.

The effort required to figure this out was frustrating but I was sufficiently successful this weekend that I will carry on.  I imagine acquiring a few more of each of the two sensor types and maybe some of the power flow control devices.  The next most obvious steps are to establish some triggering rules and to figure out exporting data to an off-prem cloud environment for back-up and analysis.  Oh, and I guess also playing around with the FOSCAM wireless IP camera I got, whose configuration I never reached due to bogging down on other things.

To Be Continued…

2 thoughts on “Home Monitoring Inaugural Foray

    1. Hadn’t been on my radar lately, but would be worth another look since last I perused it years ago. On some level, I suspect I’d be pleased to just get a reasonable quality event stream from all my devices and then mash it up whatever way I pleased. I’d like to do local processing for latency sensitive operations but also get all the data out to the public cloud for long-term archival and bulk analysis.

Leave a Reply