Some successful CurrentCost hacking
Posted by james on August 22nd, 2008After a bit of work, I've finally got my CurrentCost meter working in Ruby, and I now have a power monitor sitting in my system tray! There were a few stages involved...
Serial comms: The ruby-serialport library that already existed for Ruby was no good to me. Firstly, it didn't seem to be in a working state, but more importantly, the license it is under (GPL) is no good to me. So, I had to write my own. I've created a nice simple serial library (including a gem) for Ruby called RB232, which is available on GitHub. It only supports reading at the moment, and only works on Linux systems, but it's a start. Next!
Reading CurrentCost data: Once RB232 was in place, this was pretty easy. Just create a couple of classes to wrap up the process of getting data from the meter, and away you go. Easy. Also released as a Ruby gem on Github.
User interface: Last step was to make a simple user interface for the meter, which you can see in the picture above. It's a simple tray icon that changes colour based on power usage. It's based heavily on another very useful tool called cctrayrb, so many thanks to Daniel Parnell for doing the heavy GUI lifting there. The app is included as part of the currentcost-ruby gem mentioned above.
Anyway, it's all freely available, so if you have a CurrentCost meter and a serial cable for it, you can grab the code and get going. Enjoy :)
Hacking your energy usage with the CurrentCost
Posted by james on August 6th, 2008The other day, I managed to get hold of a CurrentCost energy monitor (available to buy from here, or maybe from your electricity supplier). Now, the nice thing about this particular monitor (apart from the ton of information on-screen) is the fact that it has a serial output on the bottom, which you can (with a bit of hacking) plug into your PC, and - bingo - lovely XML data!
However, once you have it connected and spewing XML at you, you really need something to do with all that data. I don't have anything big written yet, but my first step towards making something useful is a Ruby gem, which is available from GitHub. So far it can only parse the XML data from the meter - direct access to the serial port is hopefully coming soon.
In other news, the AMEE gem I started a while ago is still coming on. It can now use the XML and JSON interfaces, parse the whole Data API, and retrieve a list of Profiles. Not a bad start.
AMEE for Ruby
Posted by james on July 10th, 2008In a fit of why-the-hell-not, I've just started writing my first gem for Ruby, which is going to be a wrapper around the AMEE carbon calculation engine. It's still in a very early incarnation, but more will be forthcoming soon. At the moment it can authenticate, and parse DataCategory nodes. DataItems and DataItemValues will be following after a short (UK-based) holiday. Source code and installation instructions are available from GitHub.