Jul 032017

Weekend project 3D printer enclosure. Main concern was controlling noise. Total cost was somewhere around $150 USD.


Designed to be cut from a single 4×8 sheet of 3/4 material. I chose Melamine because it already has a durable finish and is easy to clean. Plans and materials list included below. Continue reading »

Jun 192016

Using a node.js module (node-hikvision-api) for accessing a hikvision camera’s built-in motion detection for use in OpenHAB

It’s a little annoying how Hikvision exposes the motion events on their cameras. It’s a multipart http stream containing XML.

See Hikvision manual Page 176
Section 8.11.30 /ISAPI/Event/notification/alertStream

node-hikvision-api abstracts that away a bit so hikmotion.js can focus on what to do with those events, like update motion contacts in OpenHAB.

hikvision camera with motion events configured
(tested with DS-2CD2332-I & XC-2142FWDI)


linedetect vmd

This is just an example of what I’m doing with a couple of my cameras. Modify hikmotion.js to fit your needs.
Continue reading »

Jun 192016

Wouldn’t it be cool if you could monitor your electricity usage with OpenHAB for less than 20 bucks with the same accuracy your power company uses for billing?

Using an inexpensive rtl-sdr dongle, it’s possible to listen for signals from ERT compatible smart meters using rtlamr. This script runs as a daemon, launches rtl_tcp and rtlamr, and parses the output from rtlamr. If this matches your meter, it will push the data into OpenHAB using the REST API.

Turns out these ERT meters (at least in Omaha) are broadcasting 4 hours of usage data with 5 minute resolution. It broadcasts this data every minute, repeating the previous broadcast until the next 5 minute interval has completed. This data is flying around unprotected. Using free software and an inexpensive SDR dongle it’s possible to pull this data into OpenHAB.

rtlamr does all the heavy lifting here. It listens for the data, decodes, and passes along the meter readings.

On my meter, the interesting information is just above the readout. That’s my meter’s type and endpoint ID or serial number. I’ve blurred my details for privacy.

Continue reading »

Jun 182016

Wouldn’t it be cool to control an android device’s wake and sleep from OpenHAB? I’ve strapped a couple tablets to the wall with command strips. I’m using them to control OpenHAB. Gotta get ’em working well enough to gain wife approval before doing anything more permanent.

I was griping about turning my tablet screens on and off in response to sensor triggers in my home automation system. My first attempt using Tasker to poll the OpenHAB Rest API was too laggy to be useful. I wasn’t making much progress when my buddy over at https://opsech.io told me about adb and sending keyevents using adb shell. He ninja’d up tabletcontrol.sh and it works beautifully. Following his example, I munged out gettabstatus.sh and it works well enough.

Rooted Android device
WiFi ADB – Debug Over Air
NOTE: This app works on ROOTED devices only.

OpenHAB Server & exec binding, tested on 1.8
linux/bash, tested on Ubuntu Server 14.04 LTS
android tools ADB

sudo apt-get install android-tools-adb

Continue reading »

Jun 172016

I love Milestone XProtect. I manage a pretty large system at work, so I was excited to run the XProtect Go free software at home. The free version has some limitations, like 5 days of recording, up to 8 cameras, and the annoying part, a nag screen when launching the client.

For simple things like automating my way past the nag screen, I love AutoIT https://www.autoitscript.com/site/autoit/

Here’s a video overview

Continue reading »

Nov 012015

As you can see from previous posts, I’ve started automating my house. There was an ADT alarm system installed. I was given a user code, but that was it. I opted not to pay ADT’s ridiculous monthly fee since reasonable monitoring can be had for $10/month.

Looking at the panel, I have a Safewatch Pro 3000, which the internets tells me is close to a honeywell/ademco vista20p without a couple features like zone doubling.

I have a simple touchpad, not an alpha display, probably similar to the 6150, so it’s terrible to program with.

The wireless receiver is in the 5881 series, still don’t know for sure the specific model, but I suspect its the 5881enh.

Looking at the OpenHAB wiki, there’s only a couple options for alarm integration, and alarmdecoder seems to be the thing to use for honeywell/ademco panels

Looking at the alarmdecoder supported panels FAQ page, the Safewatch Pro 3000 is specifically listed! Score!

So I bought an alarmddecoder AD2USB to interface with the alarm. I have to say their shipping is pretty reasonable. I had it within a week.

The quickstart guide that comes with it is helpful enough to get it connected

The Getting Started wiki page is also really helpful

The installation video really helps to clear up any questions about installing it

Of course life happens and it was almost another week before I had time to try connecting it.

I’m going to pick another service for monitoring later, so the ADT communications programming isn’t useful to me. If you’re still using ADT for monitoring, definitely put your account in test mode before monkeying with anything,

According to the Safewatch Pro 3000 manual, you can get into programming without the installer code by pressing both the * and # keys within 50 seconds of startup.

I pulled the battery connection from my alarm, tripped the GFCI outlet the transformer was plugged into, then powered back up, and pressed both buttons. Instantly in programming mode!

First order of business, setting a new installer code. This will allow me to get back into programming mode without cutting power.

The installer code field is *20. Assuming I want to use the code 1234 as my installer code, the sequence is *201234
If you don’t want to change the installer code, but just read out the installer code, read field is #20.

The whole point of this was to enable another touchpad on address 18. That’s data field *191, I only have one partition configured, and I don’t want it to suppress the beeps. The key sequence is *19110

Done programming, *99 is the command to exit (without locking out programming mode)

Following the quick start guide, I powered down the panel, disconnected the battery, and connected the alarmdecoder

Powering back up, I connected the battery and reconnected the transformer. On my windows laptop, I used the alarmdecoder keypad program. The keypad program is excellent for testing (and further programming if you’re like me and don’t have an alpha keypad)

Before long, I started getting FC error / Comm Error

These links were pretty helpful for disabling the dialer for now

Disable dialer
*41*, *42* and *94* and *92 0 0

A few other bits copied from the manual I found really helpful

Set new master code
[installer code] + 8 + 02 + [new master code]

Add a user code:
[Master Code] + [8] + user # + [New user code]

Delete a user code:
[Master Code] + [8] + user # + [#] [0]

I had some issues with the openhab binding for the alarmdecoder connecting directly to the serial device. It kept setting the baud rate wrong. Instead of correcting the issue and submitting a patch, I set up the ser2sock TCP/IP port proxy for it. It makes configuring the panel from my laptop easier anyway.

One thing to remember if you have all hardwired zones, the keypad can’t see those messages so you’ll have to use the relay emulation feature of the alarmdecoder and tie your hardwired zones to a relay output

The sample config in the alarmdecoder binding page in the openhab wiki is probably enough to get you rolling. For specific configuration of your zones, you’ll want to skim the alarmdecoder protocol to get a handle on the bit masking so you can properly address your zone devices.

One final annoyance, usb serial devices can move around between reboots, so tweaking some udev rules to create symlinks to specific hardware keeps things from breaking
This page really helped me understand the syntax of udev rules

Sep 142015

We (my wife and I) are finally home owners. Now that I have a home to play with, I wanted to get back into home automation.

Before buying anything, I needed to survey the market again so I don’t buy something that’ll lose support over the next 5 years.

In the US market, for easily available in-wall switches, there’s X-10, Insteon, Z-Wave, and Lutron’s Caseta wireless. I’ve already got X-10 equipment and I’m not making that mistake again. Insteon’s main claim to fame was X-10 compatibility. Caseta wireless is only made by lutron and has limited compatibility. Z-wave has some drawbacks, like a technically proprietary protocol, etc. The Open Z-Wave project has done a lot to address those concerns.

I did some reading and arrived at this list of serious contenders.


The first 3 are devices with cloud tie-in. Vera has superb compatibility. Smartthings is pretty awesome, just released their second version, but I’m still salty at Samsung for what they did to Boxee. Wink is super slick, but Quirky is in a bit of trouble so continued support isn’t certain.

The last 3 are software running on a local computer. Homeseer is sort of the grandaddy of the bunch, having been around for the longest. I’m still tempted to buy it when it goes on sale because it’s so well integrated, but it is the most expensive option here. Castle OS is pretty awesome too, with awesome speech recognition.

I’m ultimately deciding on OpenHAB. It’s free, which is nice, but more importantly, it’s open and has a rapidly growing international community.

This link is pretty helpful for getting started with OpenHAB

Interface Hardware
Since I’ve decided on Z-Wave and OpenHAB, the wiki page for the Z-Wave binding is probably a good place to start looking. https://github.com/openhab/openhab/wiki/Z-Wave-Binding

Searching each device on the Supported controllers table, the Aeon Labs seemed to be the easiest to buy, gen2 and gen5 are about the same price… both have compatibility with homeseer if i decide to go that route in the future. This was a pretty easy decision: Aeon Labs USB Z-Stick Gen5


Light Switches
These were easier to pick out than I expected. The most reasonably priced switch capable of controlling LED and CFL bulbs was in stock at the local Lowes for a lower price than Amazon. A small pile of Lowes 10% off moving coupons later, I’d cleaned out inventory at the 3 closest Lowes stores.

Quick note about these switches, the 12722 will do a Z-Wave hail when switched from the switching unit, but not the 12723 add-on. the 12724 doesn’t seem to send a Z-Wave hail. The 12724 buzzes with a lot of LED bulbs, but the Cree flow LED bulbs from Home Depot don’t seem to buzz.

GE 12722
ZW4005 On/Off Relay Switch

GE 12724
ZW3003 In-Wall Dimmer

GE 12723
ZW2004 Add-On Auxiliary Switch

One thing that makes this easier overall, there are only a few manufacturers actually making this equipment. It just takes a bit of googling to find out who actually makes the rebranded stuff. In the case of the door switches and motion sensor I bought, it was labeled GoControls for Wink, but made by Nortek Controls (which is Linear)

I bought this multipack at the local Home Depot to get started


What’s actually in the box?
2x http://www.nortekcontrol.com/pdf/manuals/WADWAZ_install.pdf
1x http://www.nortekcontrol.com/pdf/manuals/WAPIRZ_install.pdf

Other Hardware

Of course this is just a start. I want to expand this as much as my wife and finances will allow!

To pick additional hardware. I’m starting with this site http://www.smarthomedb.com/products

And comparing to the OpenHAB Z-Wave binding database

If it matches, I check the device’s capabilities

And use the Open Z-Wave dev documents as reference for the command classes

If it looks supported, I take a peek at the examples in the Z-Wave binding page

Mar 292015

Like many people, I’ve been trying to find an easier way to archive all of my movies and TV shows to hard disk instead of DVD disc. My previous attempt at semi-automated DVD ripping used an autoloader and some scripts, but it still required a lot of intervention because I couldn’t find a way to correctly name and tag my movies automatically. I wished there was something like CDDB or FreeDB for DVDs that would lookup metadata from the disc in the drive.

Windows Media Player does a lookup of the DVD metadata so I figured it had to be possible.

Thankfully, I’ve stumbled across an awesome utility that will get the DVD’s discid in the format Microsoft uses for their media player and media centers. http://dvdid.cjkey.org.uk/

Time to fire up Wireshark (or Ethereal if you’ve been doing this forever) and see where that request is going. I stuck the disc in my DVD drive and opened Windows Media Player. A couple of HTTP 302 redirects later I’ve got a HTTP 200 and the current request and reply.

Looking at the discid and the URL, it looks like it strips out the vertical bar pipe character | that was used in previous versions.

Opening the request gives me the URL. It looks like it’s using “User-Agent: Windows-Media-Player/12.0.7601.18741”. To avoid being ridiculously obvious while abusing this api, it might be a good idea to spoof your useragent as well.

Response is an XML file. Looks really straight forward to parse.

The request URL is super straight forward too. Just replace everything after the CRC= with the output from dvdid, removing the | character.

There doesn’t appear to be much of anything prevent this from being abused. It opened in a regular browser without issue. I used IE in this screenshot.

Apr 132014

Sometimes I feel a need to automate some meme generation. Luckily I found this incredibly helpful blogpost from jackmeme. http://www.jackmeme.com/blog.php?id=1

I used it as inspiration and did something similar in Perl. Of course the Imagemagick perl-magick reference was invaluable. http://www.imagemagick.org/script/perl-magick.php

The first thing I thought of with automated meme generation? The Weather! See my previous post about getting data from the Weather Underground API using Perl

This naturally lead to the forecast overlaid on the current radar.

Inspired by http://thefuckingweather.com/, I decided I want my daily forecast in meme form. The first weather-related meme I think of is Ollie Williams.


But that doesn’t really fit with the meme. Change fucking to motherfucking and Samuel L Jackson is PERFECT!


Smoosh those memes together and I’ve got my morning weather!


I found another source of amusement while playing with generating image macros. There is a Pyborg bot in one of the IRC channels I frequent. “She” says some pretty funny stuff, so we keep a quote list. Of course this is ripe for meme-ifying.


More Evequotes are available in the Imgur Album

Keep reading to see the secret sauce.
Continue reading »

Apr 132014

Weather data is pretty cool to play with. Especially when playing with home automation or just turning the current weather conditions into a meme.

For example:
Weather for Omaha, Nebraska on 4/13/2014 at 16:00

raging@virtualbox3:~/weather$ perl grabweather.pl
Forecast - Today:
weekday:        Sunday
high:   61
low:    27
precip: 100
cond:   Thunderstorm
month:  4
day:    13
hour:   22

Forecast - Tomorrow:
weekday:        Monday
high:   43
low:    25
precip: 10
cond:   Partly Cloudy
month:  4
day:    14
hour:   22

Forecast - Day After Tomorrow:
weekday:        Tuesday
high:   66
low:    37
precip: 0
cond:   Partly Cloudy
month:  4
day:    15
hour:   22

Current Conditions:
conditions:     Overcast
temp:   34
relative_humidity:      86
wind:   10.9
wind_gust:      0
pressure_trend: -
feelslike:      26
precip_1hr:     0

Radar Static Image:     /tmp/68127-radar.png
Animated Radar Image:   /tmp/68127-amimatedradar.gif

More info about Weather Underground’s API: www.wunderground.com/weather/api

Keep reading for my bit of Perl to grab it and make it usable.

Continue reading »