Why buy energy monitor devices -- Use data from Smartmeter!

Strange. My large, US electrical provider does let me pull data directly from my smart meter.

4 Likes

As far as I know, Dominion Energy does not.

3 Likes

Did a quick google search and came up with this, not sure if this is the Dominion Energy you are referring to but it appears you’re able to download your usage. It is most likely a xml or other database file.

"…also help customers manage their energy use by providing daily energy information through Manage Account.

1 Like

It is, thanks. I was not aware of that.

All I see in my account is total for the statement & average daily usage. It appears they just do periodic readings wirelessly here. We are rural.

EDIT: I found a map and we are not even in their future plans.

1 Like

I live in CO, USA. Our energy profider, xcel energy says they do support the “green button”. So add me to another US customer that could use this info.

I just got me smart meter about a week ago, and I am still trying to find the best way to read it. This would be a useful solution. Anyone interested in spelunking it with me? My expertise is not in web, but in C++/Python/Linux. So things like Oath2 take me a long time to get through. And I don’t know HA integrations/Add-ons.

My first question is, how far has anyone taken this already? Has anyone stumbled upon someone who has tried something like this?

My second question is, there is language on the green button site that says, "These APIs allow application developers full access, in Green Button Format, to Energy Usage Information for the purpose of developing new Green Button Applications. ". Um. What about open source, DIY nerds?

2 Likes

There is a user post here GreenButton Smartmeter integration
with a link to this github repository. https://github.com/PhracturedBlue/smartmeter_greenbutton
but it looks like the user/repository is no longer active.

There are a few others on git (https://github.com/search?l=Python&q=greenbutton&type=Repositories)

This one looked like it might be worth quick skim https://github.com/asciiphil/greenbutton-python/tree/master/doc

Hope this helps-

3 Likes

I had never seen the GreenButton API documentation, that is interesting. The big problem I had with GreenButton was that my provider made it difficult to get access to without screen-scraping which was very unreliable. If OAuth2 can be used to bypass the provider’s website, it would greatly improve the robustness of my project.

I guess it is time for a revisit.

3 Likes

:tada: An ally! Not only that, you’ve already done a lot already.

I want to help. I don’t want to step on your toes. I will have time in the next few days to take a closer look. I have been trying to get the SDR/rtlasm thing working and I am running out of threads to pull on that front.

I’ll take a look at the repo you have that scrapes the data. And some of the other ones in github look like they have useful bits too. If you want me to do something specific, let me know.

Will each of us have to get our own “third party developer” key/approval? Or is there some way to make a single “third party developer” for everyone that uses HA?

I poked about a bit on my provider. At 1st glance, it appears that they do use OAuth2 for login, and an API of sorts to retrieve green-button data. At least for my provider, the API itself seems to be a mess, but assuming the OAuth process can be navigated, I am able to retrieve the GreenButton data from the API using only a Bearer token.

Our provider seems to use <subdomain>.opower.com to access account/usage info. I found this: https://github.com/bvlaicu/coned for ConEdison (not my provider) that also seems to use similar looking APIs at opower.com, so it may also be possible to generalize fetching the data to some extent. However, looking over that project, they weren’t able to manage the login without selenium (or in their case pyppeteer).

As for the Authentication, I didn’t play with it too much yet, but it looks like it uses:
https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword followed by a couple of direct queries to generate the bearer token. I have limited history with OAuth2, but past experience has been that once you have the base and refresh tokens, you can request updated tokens at will. I’ll need to do some experimentation to see how that goes. My experience with OAuth has been that it is often easiest to snoop these tokens from a browser-based login the 1st time, since there is often MFA or Javascript shenanigans going on with the initial login.

The summary is that login still seems to be the the challenging bit, and it is likely to be provider specific (even if your provider uses the opower.com api), meaning a general-purpose solution doesn’t look reasonable coming at it this way, but at least for my power company, I have hope I can do away with the screen-scraping stuff.

I don’t think providing GreenButton data means that providers necessarily have a standard API for access, though I’d love to be proven wrong.

I should also note that the API that my browser uses to download GreenButton data looks nothing like the API shown at http://greenbuttonalliance.github.io/. I did find this link though (Green Button - Connect My Data (CMD)) that shows that there is a ‘GreenButton Download My Data’ and ‘GreenButton Connect My Data’. The GB API seems to be for the latter, and my provider only provides the former. I’d be curious if other users with GreenButton access have ‘Download My Data’ or ‘Connect My Data’ access

@jeffeb3 - I just moved to northern CO and I’ve got Xcel as well. I was able to find the green button connect but the activation flow appears to be horribly broken for me. I’m hoping to go digging into the API in the next couple weeks and see if I can find anything interesting out.

Many utilities use “smart” meters that send out radio frequncy usage data constantly.
I used this (and this) to read mine…
READING HOUSEHOLD WIRELESS UTILITY METERS WITH AN RTL-SDR

HA Addon Receive wireless sensor data via an SDR dongle and rtl_433

Hi,
I support the initiative to use the data directly from the electricity provider instead of buying additional devices.
My electricity provider in New York, Consolidated Edison (ConEd), offers to share the data with 3rd parties. To do so, I have to log in to the customer portal and authorize the 3rd party.

ConEd published the following guide to becoming a 3rd party provider to receive data.
https://www.coned.com/en/accounts-billing/share-energy-usage-data/become-a-third-party

Does this help to get the data into Home Assistant?

4 Likes

I am also a ConEd customer. Looking to itegrate it to my HA. If you find one pls let me know.

8 Likes

I rewrote the greenbutton fetch code to use Oauth/bearer-tokens here: GitHub - PhracturedBlue/smartmeter_greenbutton: Python code to read smart-meter data from utility company. It requires a one-time manual configuration to retrieve the account-id and refresh-token, but is then much simpler and more reliable once those have been obtained.
I looked into using rtl-amr, but my meter uses the FlexNet protocol which (a) apparently transmits infrequently making it hard to decode, (b) is encrypted, and (c) likely only has 1kW/hr resolution regardless. I’ve been using a homemade sensor to read instantateous usage using the IR LED (something like this: GitHub - foxharp/irmetermon: AVR-based monitoring of home electricity consumption). It works pretty well, but it was very finicky to get it to work in all lighting conditions.

Maybe someone will find the above useful.

3 Likes

Looks like PECO in Pennsylvania uses the same green button approach. It uses the <domain>.opower.com and Google identity API. I will do some digging to see how similar the access is. Is there a way to run your Python code in isolation outside of Home Assistant for testing?

The code in my repo actually has nothing to do with homeassistant. I use it to download the greenbutton data and import it directly into influx, but the downloader runs independently of the importer, so you can just run the download part and it’ll dump out the raw data.

Would love to use this too

1 Like

+999 from the massive pool of those in NYC

6 Likes

Looks like PECO in Pennsylvania uses the same green button approach.

Did you have any luck getting their data?

This has been an as time permits project. I have the data downloading from PECO, I am at the stage of playing around with long-term statistics to get the information presented correctly in the energy dashboard for both electricity and gas.

4 Likes