PG&E Energy Monitoring Integration

Any chance of getting this in a HACS repo for the time being?

1 Like

nvm, was able to do it. Turns out my base64 need to remove the line break. For people’s reference:

# the -n is important
echo -n "$CLIENT_ID:$CLIENT_SECRET" | base64 -w 0

How did you complete the API connectivity testing? I was able to upload my wildcard domain certificate from letsencrypt (*.example.com) and get their approval, but during the test (via https://api.pge.com/datacustodian/test/oauth/v2/token), it complains “Cert not present or invalid Cert” when sending the client certificate over (cert.pem and privatekey.pem).

You can manually install in HACS using this repository:

FYI, I plan to delete this repository once my PRs make it in core.

3 Likes

I have installed OPower on the latest HASIO from the repo and get this error.


This error originated from a custom integration.

Logger: custom_components.opower.coordinator
Source: custom_components/opower/coordinator.py:67
Integration: Opower (documentation, issues)
First occurred: May 10, 2023 at 10:50:08 PM (335 occurrences)
Last logged: 11:28:13 AM

Unexpected error fetching Opower data: 'typicalUsage'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/opower/coordinator.py", line 67, in _async_update_data
    forecasts = await self.api.async_get_forecast()
  File "/usr/local/lib/python3.10/site-packages/opower/opower.py", line 226, in async_get_forecast
    typical_usage=float(forecast["typicalUsage"]),
KeyError: 'typicalUsage'


I made an account on “open energy view” and linked it with my PGE account but I’m not sure if that is still necessary. When I installed the integration in HA it asked me for my PGE login and it accepted it with a successful message. I have also tested my login directly on the PGE site.
I do have 3 accounts under my PGE login so I’m not sure if that is causing the issue.

Thanks
Matt

I get the same error fwiw.

On your browser can you:

  • enable developer tools
  • go to the network tab
  • login to pge.com
  • navigate to energy dashboard
  • navigate to projected bill
  • in the network requests you should see a request for combined-forecast
  • can you copy paste the response? Feel free to redact the values of the keys

How old is your PGE account? It’s likely for new accounts the typicalUsage is missing from the response in which case I need to handle it and not add a sensor for it.

I released an updated version. Let me know if that fixes your issue.

That fixed it!

This is cool, it works for me. No Idea what Ill do with the info, but its neat.

We have 2 service addresses, and one account. Only the first registered service address shows up in the integration. FYI.

Sure did! Thank You!

Will someone please post here when this integration is built into HA Core non-beta?

The library now supports multiple accounts. Can you try the latest version of the integration and report whether you see data for both of your 2 service addresses?

Is this integration available yet in the latest Home Assistant release: Home Assistant 2023.6.2? I can’t find it under Settings\Devices\Add integration or via Settings\Add-ons\Add-on Store. I searched for OPower I’m not sure which version to start looking for it.

will try to get this merged in the next few hours

No. It won’t be included in the 2023.7 release either since the PR hasn’t even been merged yet. Until it’s officially released you can install it via HACS from GitHub - tronikos/opower-hacs: HACS integration for PG&E via Opower

Confirmed, yes, this works. I see both Service addresses. Thanks.

My integration is released in Home Assistant 2023.8 see Pacific Gas & Electric (PG&E) - Home Assistant

1 Like

I just installed the OPOWER integration for the first time ever on Home Assistant 2023.8, It all worked right out of the box, I just entered my username/password. AWESOME!

QUESTION:
Can you (or anyone) confirm (in the screenshots below) that I configured Home Assistant’s Energy Dashboard configuration correctly using the 4 OPOWER sensors shown below? Presuming the below is correct, are there any other OPOWER sensors I can plugin to this Dashboard?

Electricity:

sensor.current_bill_electric_usage_to_date
sensor.current_bill_electric_cost_to_date

Gas:

sensor.current_bill_gas_usage_to_date
sensor.current_bill_gas_cost_to_date

EDIT: The reason I ask is because after I added the for respective OPOWER entities in the above screenshots, my Home Assistant Energy Dashboard doesn’t show any values. It still shows everything as 0:

Try setting your dashboard to show more than the current day… Mine looks empty on ‘today’ but is well-populated for the month and year so far.

@Participant (or anyone)…
Can you please confirm that I added the correct OPower Sensors/entities to Home Assistant’s Energy Dashboard (shown in my previous post)?

It doesn’t make any difference if I set the Home Assistant Energy Dashboard to a week, month, or year. Nonthing in the Dashboard is populated. Are you certain it’s all supposed to be populated for a month and year even though I JUST added the 4 sensors below? It hasn’t even been a full day yet since I added these sensors.

Electricity:

sensor.current_bill_electric_usage_to_date
sensor.current_bill_electric_cost_to_date

Gas:

sensor.current_bill_gas_usage_to_date
sensor.current_bill_gas_cost_to_date

Lastly, presuming the above entities are the correct ones to add to the Energy Dashboard, how long does it take for the Energy Dashboard to start getting populated? I’ve already waited several hours. Nothing has changed.