Tag Archives: currentcost

Home Camp mark 2

The second Home Camp event takes place in London tomorrow. I won’t repeat all of the details here, as they are covered over on the Home Camp blog.

We have some wonderful sponsors – CurrentCost, Greenmonk, Onzo, Pachube, and ReactionGrid, with support from theattick who are going to be streaming the event for us as well.

There are some nice pre-event writeups on the Greenmonk and Redmonk blogs.

It’s a shame that due to unforeseen circumstances I’m no longer able to attend, but I’m looking forward to following remotely if I can, and otherwise catching all the content tagged ‘homecamp’ on Flickr, blogs, and Twitter.

The event is open to anyone, so if you are interested in home hacking automation and energy efficiency, you will definitely want to get involved.

Advertisements

Experiments with PHP and MQTT

Over the past few days I’ve been playing around with combining lightweight messaging and PHP. There are a couple of reasons for this, but the primary one is that I’d like to extend my prototype iPhone CurrentCost monitoring web application to display more up-to-date information about the state of my home energy usage. I’d planned to do this for a while, but recently Mark Taylor created his own version of the iPhone interface (PDF link) and he has got current readings on the front page. Clearly, I have to compete 🙂

Actually, in my system, I’d like to do things a different way. The heart of my setup is a Really Small Message Broker. At the moment, data from the CurrentCost meter comes in over the USB connection and is then published in pieces, or on topics, to the RSMB (temperature and energy readings are separate). These published messages are then read by a script which is subscribing to the topics and squirrelling the historical data into an rrdtool database; and also being pushed up to our IBM broker “in the interweb cloud” via an MQTT broker bridge connection.

So in theory, having the up-to-date information in the web UI should be a simple case of grabbing the MQTT publications on each topic and displaying them. The way I’ve coded things (and would prefer to do things), this involves having the ability to subscribe to MQTT publications from PHP.

I’m not at the end of the road yet, but I do have a starting point.

howitworks.png

I’ve got a front-end test page which currently uses Prototype to send an Ajax request to a server-side PHP script (yes, I have had jQuery recommended to me, and I may well look into that instead of Prototype, but this works).

The server-side script uses the Simple Asynchronous Messaging PHP library. SAM is a wrapper which enables a variety of messaging transports to be supported in PHP, such as MQTT, WebSphere MQ or WebSphere Platform Messaging. Just one thing: I found that in order to get the most recent SAM release to work on Ubuntu on my MPC-L, I had to install IBM’s XMS client SupportPac (for some reason, it won’t build without it, even though it is “optional”) and I also had to delete a spurious empty line from the end of /usr/share/php/SAM/php_sam.php to prevent header issues. Other than that, it was all good.

The script is really simple and basically uses all of the defaults to create a connection to my local RSMB over MQTT. The advantage of this being server-side is that I don’t have to open my RSMB to the Internet, the PHP code can connect via localhost. Once that’s done, it creates a subscription on the topic I’ve asked for, and receives the first data that comes along, then echoes it back to the front-end. I could make it auto-updating with Ajax.PeriodicalUpdater too, but there’s no need to put a load on my server.

Wanna see a quick demo? 😉

I’m quite pleased with the way this is working. There’s some more plumbing to do, and I’ll almost certainly extend the server-side piece to allow two-way communications (publish as well as subscribe) as well as finer-grained control over the options. As a proof-of-concept though, I think this is looking good.

The inaugural HomeCamp

As I previously mentioned, on Saturday I went along to HomeCamp 08 in London, organised by Chris Dalby and Dale Lane, and sponsored by Current Cost and Redmonk.

Low power gadgets

I was pretty actively commenting from the event and taking part in the live uStream channel… others have written up some of their experiences and thoughts, so I don’t propose to say much here. My main contribution was to make a (shaky!) video of Andy Stanford-Clark’s talk towards the start of the morning – a half hour overview of his home automation projects. I’ve posted it on Viddler, and if you are interested you are very welcome to comment on it, embed it in your own sites, or add annotations on the video timeline.

The nice part about Viddler over, say, YouTube is that it let me post the whole thing as a single video rather than having to chop it up into 10 minute chunks. I’ll try to post some notes on how I went about producing the video at some stage soon.

Some very general comments on the day:

  • Well-organised, well-run, great venue, nice to have wireless access – thanks to everyone involved in the logistics!
  • A brilliant, exciting array of skills, talents and interests. It was kind of funny to realise just how many of the folks I knew of as we were doing introductions at the start, and great to find that it wasn’t only a bunch of IBM hackers – this movement is really building momentum.
  • A lot of fun… I only wish my hacking skills were greater – but I’m looking forward to contributing and generating ideas in this community.

That’s it from me. Really looking forward to HomeCamp 09!

At Homecamp

I’m at Homecamp at Imperial College in London today – learning about home automation and energy monitoring. There’s an amazing group of people here. Follow the Twitter stream or watch it on uStream.

Share photos on twitter with Twitpic

Today, I (hope I) helped people

Today, I…

This is what I do. Most days, it is good fun. Some days, it is a little full on.