Hackulink, an weewx driver for the AcuRite AcuLink Internet Bridge

# Hackulink Driver


## What is it?

A driver for feeding data from an Acu-Rite Acu-link internet bridge into weewx.

## Um, what’s “weewx”

> weewx is a free, open source, software program, written in Python, which interacts with your weather station to produce graphs, reports, and HTML pages. It can optionally publish to the WeatherUnderground, PWSweather.com, CWOP, WOW, or AWEKAS.

Get it here: http://www.weewx.com

## What else should I know.

  • The code could be better, but it seems to work.
  • It ignores data from tower sensors.
  • I have no idea how it would work with two 5in1 sensors.
  • It won’t log any data if the internet connection or AcuLink’s servers are down.
  • The inside temperature, which is a byproduct of the pressure calculation, isn’t right, possibly because of heat emitted by operation of the bridge.
  • Reported pressure isn’t adjusted for elevation of the sensor.

## What do I need?

  • A computer with a working installation of weewx (v 2.5.0 as of this writing).
  • An AcuLink internet bridge.
  • A 5in1 Sensor.
  • A live internet connection.
  • A router running OpenWRT Attitude Adjustment somewhere between the Acu-Link and the Internet.
  • A static DHCP lease for the AcuLink.
  • The ability to debug your setup if it doesn’t work, because I’m probably not going to have much time to help.

## What’s next?

  • Configure the router:
  • Install the optional ‘ngrep’ and ‘ncat’ packages.
  • Add the following command to the local ‘startup section’ on the Startup page under the System menu. It should be a single line ending in ‘&’, and you’ll need to substitute your AcuLink’s numerical IP address for XX.XX.XX.XX.
  • ncat -l 2999 --send-only --max-conns 2 --keep-open -c "/usr/bin/ngrep -l -q -d br-lan -W none 'id=' 'src host XX.XX.XX.XX && dst port 80'" &
  • Copy the hackulink.py file into the weewx/drivers directory.
  • Adapt the sample weewx.conf file to your environment. At the very least you may need to change the host_ip value.
  • Start weewx.
  • If it doesn’t work for you, figure out why.

## How does it work?

  • Weewx loads the driver, the driver opens a socket connection to port 2999 on the router.
  • On the router, ncat acts like a simple TCP/IP server listening on port 2999. When a client connection comes in, it starts ngrep and sends the output from ngrep to the client.
  • ngrep looks for packets passing through the br-lan interface from the IP address of your AcuLink which contain ‘id=’, when it captures one, it outputs the contents to ngrep. These packets contain HTTP POST requests with the sensor data the AcuLink has received and is submitting to the AcuLink webservice. In most situations, a single packet contains the full contents of the POSTed data.
  • The driver receives the captures POST data, checks it to see if it looks complete, and then further parses it, decodes the values, and yields the readings back to the weewx code that called it.

## Credits

  • Based on the wmr100 driver.
  • Informed from the information shared by the author and commenters on: http://moderntoil.com/?p=794
  • Wind Direction encoding reverse engineered by Jason Anthony
  • Hacked by Erik Speckman

3 thoughts on “Hackulink, an weewx driver for the AcuRite AcuLink Internet Bridge

  1. Pingback: Announcing Hackulink | GeekFun

  2. Pingback: My costly mistakes on the path to a somewhat inexpensive home server | Tech Obsessed

  3. eas Post author

    I haven’t touched this code in a long time, but I wanted to share a comment I received via email from Johnathan G, which includes a diff for getting this working with WeeWx 3.0.

    It did not work on weewx version 3.0. There is a conversion site on: http://www.weewx.com/docs/upgrading.htm. Following the conversion guide I made a two minor changes and your driver worked with version 3. Below is a diff of the changes.

    $ diff ~/Downloads/hackulink/hackulink.py hackulink.py
    < import weewx.abstractstation --- > ## import weewx.abstractstation
    > import weewx.drivers
    < class Hackulink(weewx.abstractstation.AbstractStation): --- > #class Hackulink(weewx.abstractstation.AbstractStation):
    > class Hackulink(weewx.drivers.AbstractDevice):

    Thank you, it works for me. If I have any further improvements I will pass them along.

    Note: I am using the following ngrep string to avoid having to lock down IP addresses by specifying the MAC address instead of IP address:

    ncat -l 2999 --send-only --max-conns 2 --keep-open -c "ngrep -l -q -d br0 -W none 'id=' 'ether src host 00:25:9c:58:02:c6 && dst port 80'"&

Leave a Reply

Your email address will not be published. Required fields are marked *