Tuesday, March 30, 2010

Setting up Google Powermeter

Google Powermeter is attracting a lot of attention in the home energy monitoring arena. Just the sheer reach and power of the Google brand are going to ensure it will be a major player.

So far, Google's focus has been on tie-ins with major energy utilities, whose customers already have wired-in smart meters in their homes. So far, what it has not dealt with are the millions such as myself who have internet-enabled monitors (either through a home pc, or with their own internet connection).

However, this changed last week with the announcement that their now-legendary Powermeter API will be publically available for all to use.

After a few false starts, and some patient help from the Powermeter team, I managed last night to register as a user. You don't need to be a registered provider (such as a utility), but you are responsible for uploading the data yourself to the web. It's an API, not a specific implementation for a particular monitor. However, a Python client library is supplied, once you've got your data out of your device.


The Getting Started page is pretty clear, once you get the hang of it. The documentation is aimed squarely at developers, who are writing a gateway to the API for their particular device or service, not standard users who just want to upload their data.

Before you do start, you will need a Google account (eg for Google Mail), and be logged in.

The API documents describe how to create a webpage for your website that your users will use to enroll to Powermeter. Once logged in, you have to create a webpage that will create a URL to post to Powermeter. This must take this format:
https://www.google.com/powermeter/device/activate?mfg=GibbonEnergy&model=Gibbonex3000&did=1234&cvars=1

Check the "Parameter details" section for details of what the different parameter values mean. You can customise the process by adding a return URL, otherwise you will stay within the Google pages.

Opening the link (which normally you would build within the page, but you can follow the link above or one like it) takes you to the "Activation" page



Confirm your details (including adding a geographic location), and if you have not specified a return URL, you will be presented with this page:



The "Authorization Information" is the unique key you will need to start uploading your data. If you specified a return URL, this will POSTed back to you in a particular format, so for automatic registrations you will be able to capture and store this. In this situation, take a copy of this manually, so you can use it in your API calls.


What you have to do now is master the upload API, but this doesn't look too complex - it's just wrapping up the standard SI units of time and energy, getting that data from your device in the first place is the hard bit.

Once your device has been activated, you have a set of options for how you want to display the data, including setting energy reduction targets:




Google have built an iGoogle gadget which you can place on your page and share with others:



(this probably looks a lot better once you start adding data ...)


So, there you go, that's how you activate a device on Powermeter, without being a customer of a subscribing utility. Anyone with a Google Account can do it.

I'll post again once I manage to upload data.

5 comments:

Rus said...

Hey, Toby---

Thanks for the detailed instructions! We recommend that you use &dvars=1 instead of &cvars=1 when simulating device activation. That will create a Duration-mode variable (start/end/value) instead of a Cumulative-mode variable (timestamp/value/reset). The Duration mode variables have less problems because there's no weirdness with the isInitial resets. (People seem to have a lot of trouble with the cumulative format.)

Here's an example of a duration-mode measurement upload:



https://www.google.com/powermeter/feeds/12345/12345/variable/GibbonEnergy.Gibbonex3000.1234.d1
2010-03-08T08:08:08Z

2010-03-08T09:09:09Z

3.88



Hope that helps!
- Rus Heywood
Lead engineer, Google PowerMeter

Rus said...

Oh dear, I guess blogger's not so much with the HTML escaping. Let's try that again:

<entry>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/meter/2008#durMeasurement'/>
<meter:subject>https://www.google.com/powermeter/feeds/12345/12345/variable/GibbonEnergy.Gibbonex3000.1234.d1</meter:subject>
<meter:startTime meter:uncertainty='1.0'>2010-03-08T08:08:08Z
</meter:startTime>
<meter:endTime meter:uncertainty='1.0'>2010-03-08T09:09:09Z
</meter:endTime>
<meter:quantity meter:uncertainty='0.1' meter:unit='kW h'>3.88
</meter:quantity>
</entry>

Toby said...

cheers Mr Rheywood,

I hadn't really got into that side of it, eg actually using the API to upload data. I was completely baffled about how to even get started for a couple of weeks, so once I figured out basic device registration, thought I should spread the love ...

but who will be the first to upload their data over this long Easter weekend! :@)

Unknown said...

I managed to get this working with cumulative mode variables (seems like less work) and a current cost cc128.

Rough perl scripts are at http://mosquitto.atchoo.org/files/perl/

Thanks for doing the hard part! :)

sandeen said...

Hey, that's cool. I recently was dreaming of an energy-data-multiplexer which can accept input from multiple devices, and send output to various tracking sites, such as google powermeter. I'll refer back to your post if/when I try to get a powermeter connector written, thanks!