Computing stuff tied to the physical world

Web hooks and feeds

In Software on May 8, 2011 at 00:01

I’m starting to look into hooking stuff together via TCP/IP on the PC/Mac host side of things.

One approach is to use Web Hooks. The idea is that the sender initiates a simple HTTP GET or POST request to some web browser, with all the information contained in the URL and/or query arguments.

In JeeRev, I decided to try it out by adding a webfeed feature and a webhook feature.

The webfeed mechanism is absolutely trivial: make a web request to a URL with the name of the parameter and the value of the parameter at the end, and add any other info you want as query args:

http://127.0.0.1:8181/webfeed/abc-def/12345?unit=mV&scale=2

This creates a new reading for parameter “abc-def” with value “123.45” (I used the scaling mechanism in this example, but direct input of “123.45” would have worked too).

That means any process with access to the webserver running in JeeRev can feed values into the system.

The reverse is the webhook: each time one of a specific set of parameters changes, a web request is made to a configurable URL, with the parameter name, its value, and such filled in automatically.

Here’s an example feed to the ThingSpeak web service:

Screen Shot 2011 05 07 at 17.03.54

(hmmm, looks like ThingSpeak only presents information on an hourly basis)

There’s no coding involved with either of these features in JeeRev, it’s all defined in a local config file.

Trivial. There really are tons of ways to do this collecting / storing / graphing stuff, and you can find lots of sites doing similar things all over the web these days. The Pachube website has been around for some time and appears to be used a lot.

To be honest, I would think twice before handing over my home monitoring and automation info to a public website. Sure, it might look cool to show everyone what you’re doing at home, and what you’ve automated – but it’s a privacy risk I can do without. I don’t intend to create a public site for JeeLabs sensor access and control. That’s the whole point of JeeRev: low cost hardware, running a local monitoring and control system, with optional outside access via secure channels, i.e. a password-protected SSL connection. The technology is open, but not our data (not even energy info: I’m more interested in optimizing than in making a statement).

The way I see these web hook/feed mechanisms, is not to create a world wide web of things, but as a way to tie different software systems together within the confinements and privacy of the home. Every device, app, and language has web technologies built-in these days, so it’s only natural to use them as exchange mechanism.

But I’ll leave the “look ma, my front door is open” sensor reports to others ;)

Update – the ThingSpeak web site service does support private channels and more fine-grained access, see the comments below.

  1. This is awesome, and looks super-easy. Also, one would think that if you really want to pass your data to the outside world (like the CWOP and/or wunderground, for example), there’s no reason your data-collection PC wouldn’t be able to server double duty, with an additional webserver module or alternate applications. This way it would be possible to keep the private data private (such as perimeter/motion sensor data), and pass your weather station data on to the web.

    But really though, what you’ve outlined here is awesome, thanks for sharing!

  2. Nice. Can I use this to directly write to the JeeNode on the USB port (and GET data from it also?). How do you format the JSON?

  3. My understanding is that ThingSpeak feeds are private by default, although certainly having your own server gives you more control.

  4. I also wonder if there is a configuration difference. My own ThingSpeak graph shows data points every 10 minutes, and if you use the JSON feed (in the format http://api.thingspeak.com/channels/639/feed.json?key=xxxxxx ) you get back the original rate data, at least up to 25 second intervals which I what I tested.

    • Thanks – good to know, I’ll see if I can create a more fine-grained graph with Thingspeak.

  5. For example, here is the ambient light level outside my window right now at 15 minute intervals: http://api.thingspeak.com/channels/627/charts/2?timescale=15&width=600&height=400 and if you substitute “timescale=10” you get 10 minute intervals. Nothing less than 10 is officially supported, but “timescale=1” gives me the raw data rate (right now about 50 seconds apart). This is Jeenode + EtherCard + Sharp GA1A1S201WP sensor.

  6. Interesting writeup and comments. Every channel is private by default, but if you want completely open local access and control, you can install ThingSpeak on a local computer.

    Download the GitHub repo: https://github.com/iobridge/thingspeak – install on Linux with Ruby, Rails 3, and MySQL.

    Now you have complete control of your data with API access, data processing, and charting.

    Let us know if you get to try it.

Comments are closed.