Back to Project Index | http://graham.auld.me.uk | E-Mail me |
Example Registration Page |
Proof of Concept Perl Code |
E.ON are offering customers free energy monitors, yesterday I unpacked one and set it up. It's pretty simple, a current clamp on the incoming mains, transmits this information wirelessly to a LCD unit from whence you can see your energy usage. All very nice, it even logs some historic data and accepts input from up to 9 appliance power meters too.
I was more interested by the serial interface... It is presented on an RJ45 socket and the unit comes with a USB-serial cable (Prolific PL2303) to connect up to your PC. According to the instructions, the enclosed CD has some windows software to track energy usage and such.
Looking on the web I find that this meter is otherwise known as the Current Cost Envi or CC128, the software downloads page offers drivers, and a range of applications to deal with the data. The majority of these are windows applications and probably work fine. I was heartened to spot that they supported Google PowerMeter, sadly I found only Windows software for taking data from the unit and posting it to Google power meter.
Fortunately those guys at Current Cost had their thinking hats on and published the XML output description for the CC128 on their website! Google, as you might imagine has the powermeter API online too!
If you are in a hurry then it's 57600 baud 8N1 and the value you're after is <watts> - regular data pops out every 6 seconds :-p
Step 1: Register your device (and you if you have no Google account)
Google PowerMeter is designed to be accessed through your device, rather than complicate my code for grabbing and uploading data I registered my device separately through a web page crafted to allow registration.
Once registration is complete, copy the long string in the text box and paste it in as the variable $authinfo (line 3 of my perl script)
Step 2: Start gathering data!
My proof of concept Perl script (when furnished with your registered authentication info), will simply open the first USB serial port on your linux PC then every 100 updates (about every 10 mins) will average them and upload the value to google power meter. *Note: you need Crypt::SSLeay or IO::Socket::SSL Perl modules installed!
Step 3: Wait a while and then look at your usage!
Head to the Google PowerMeter pages to view your usage, there are even options to download/delete all data
Step 4: Don't bother to E-mail me and tell me how rubbish my code is.
THIS CODE IS STRICTLY PROOF OF CONCEPT!!!!! Feel free to take it as a starting point for doing something better, I'll happily link to your site or even host the results... Don't come crying to me if you start uploading your 'leccy meter numbers to a man from Lagos cause you didn't check SSL...
My intention is to run this from my Netgear WGT634U on OpenWRT - that may explain my approach in keeping things incredibly simple.
Known issues:
Stuff I found useful: The
E.ON monitor
|
Stuff that might help you: |
Updates: