PG&E Energy Monitoring Integration

Integration with Pacific Gas and Electric energy monitoring. They deploy “smart meters” to homes and provide an API to access the data realtime. Here is a link to the API information. While looking for more information, I found this GitHub repo which appears to provide a python frontend for the API. Thanks in advance!

Upvoting and commenting for more visibility. I’d prefer to use an API instead of some of the hardware solutions to stream the data from the Smart Meters

3 Likes

+1. Interested in this one too

2 Likes

+1 interested in this

2 Likes

+1 for this, hands down would prefer using the official API over a HW solution that requires modifying the power box any day. There should be plenty of californians here to want this (especially with the new energy intergraton that HA provides and the high amount of sloar/powerwall usage here)

6 Likes

+1 for thiis.

Being less technical than the average Home assistant user (translation, I am not a developer), I would love for an easy way to plug into my PG&E energy usage as well as tap into my solar edge data and lastly the MCE (the green electricity that we get through PG&E).

Right now PGE, and MCE offer monthly data through each of their sites and Solar edge i can see through my iPad app. I believe this refreshes every 4 hours though I was told there is a way to get it in almost real-time. It would be so awesome to be able to get and visualize our power consumption (especially by appliance/device) and see where the power is coming from (solar, MCE green energy, or straight up PG&E power and gas).

2 Likes

@JPHutchins I was googling for some python libraries and came across your work on GitHub. (Also just realized that the pgesmd_self_access repo was posted in the first post from @weldawadyathink)

It looks like your work with these two projects would translate well to a home assistant integration.

Is this something you’re interested in working on?

1 Like

Yes! It was always my goal to integrate with Home Assistant. Here are the steps that need to be completed for it to work:

  1. I get the Open Energy View server up and running again EDIT: done
  2. Users from this thread register at Open Energy View to make sure they are getting daily data feeds EDIT: in progress
  3. Open Energy View implements a “token system” whereby a user can generate a token stored in the OEV database
  4. Home Assistant integration is implemented: the integration will require the token mentioned above to make a secure-ish request to the OEV server

Just so people don’t get their hopes up, the PGE servers provides one batch update per day and the resolution of data is hourly though I think they are switching to 15-minute intervals sometimes (OEV does not support this right now… though the data does go to the DB, just not the frontend). Best case scenario is your usage history goes up at about 36-hour latency.

Why OEV? PG&E’s “API” is asynchronous - you make a request for data to be sent at some point (thirty seconds) in the future. Technically it would be possible for every HA instance to be hosting an endpoint that listens for the “API” data dump but it would be insanely complicated, insecure, unlikely to be approved by HA, and PGE would shut it down once they figured out what was happening.

PS: not to get ahead of myself, but since HA tracks on/off events for devices it should be possible to create a machine learning model that can quite accurately learn how much energy each smart device in the home uses and therefore give real-time power consumption without any hall effect sensors or, truly, any hardware at all!

2 Likes

were you able to get it working yourself?

do you get gas as well or only electrical?

www.openenergyview.com is up BUT the only thing that will work right now is “Try the demo account”. I will update this thread to invite new registrations to make sure that the historical and daily updates are working.

@JPHutchins wow that was quick! I appreciate your effort on this.
I kinda put you on the spot but as you can tell, there are a lot of PG&E users that are eager for a Home Assistant integration haha

1 Like

The bones of this is parsing the ESPI protocol, a national standard, so HA should be able to integrate with dozens of utilities throughout the US - with enough individual contributors.

1 Like

Hey there! I’m relatively new to Homeassistant AND PGE, noticed the smart meter and their website and started looking for an already built integration (as there are for countless features on HA).

If you’re still accepting beta testers, I’d love to try plugging in.

Thanks!

1 Like

Thank you! I was a bit over optimistic about how much I could do before the holidays but I am back on it now and will keep this thread updated when I can confirm that PGE registrations are working again.

1 Like

I have tested OAuth registration this morning and it seemed “OK”.

Tagging potential testers below; here is the test procedure:

  1. Have your PGE account (username/password) available
  2. Note the time that you attempt registration
  3. Navigate to: https://www.openenergyview.com
  4. Click “Sign in with Google” (recommended) or “Register now!”
  5. Select PGE as your utility and click “Authorize”
  6. Leave all 3 boxes ticked and “indefinite”
  7. Report issues at the OEV GitHub or here noting the time of day that you tried (so I can correlate with my log entries)

Tagging potential testers:
@joshgraff @david1 @LUNZ @christian.baptiste @wtangofoxtrot @priyanku @badfocus @weldawadyathink

My new apartment supports 900 second readings from PGE (yay!) but OEV only supports 3600 second readings (boo…) so I opened an issue for that. If everything seems to work but your energy history is blank this is a very likely culprit and is my top priority to fix (after I confirm that accounts that report every 3600 are working).

3 Likes

can you import gas?

I created an issue on the repo where you can track the progress of parsing the gas records. My priority is to support the 900 second electrical interval and then try gas. Support gas · Issue #32 · JPHutchins/open-energy-view · GitHub

1 Like

Awesome thanks for tagging me! I’ve linked my PG&E account and am going to play around with it more

1 Like

Little status update: I setup a development environment from scratch and documented it in the README. If you’d like to take a stab at parsing ESPI data, editing the UI, charts, analytics, etc. this is the place to start: GitHub - JPHutchins/open-energy-view: View resource consumption trends, history, analysis, and insights.

3 Likes