home-assistant/core

Opower PG&E Invalid Authentication

16-9 opened this issue ยท 14 comments

16-9 commented

The problem

I used Opower to connect to my PG&E account for months without issues. This morning I was prompted to reconfigure my integration. I keep on receiving "Invalid Authentication" when entering my account and password.
I double-checked that my account and password were correct by connecting to the PG&E site.
There are no errors posted in the logs.
I perused past issues and ran the following test in my terminal for further clarification:

pip install opower
python -m opower

I got the following error message:

...
Traceback (most recent call last):
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/opower.py", line 199, in async_login
self.access_token = await self.utility.async_login(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.session, self.username, self.password, self.optional_mfa_secret
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/utilities/pge.py", line 61, in async_login
await async_auth_saml(session, url)
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/utilities/helpers.py", line 54, in async_auth_saml
async with session.post(
~~~~~~~~~~~~^
action_url,
^^^^^^^^^^^
...<2 lines>...
raise_for_status=True,
^^^^^^^^^^^^^^^^^^^^^^
) as resp:
^
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/aiohttp/client.py", line 1359, in aenter
self._resp: _RetType = await self._coro
^^^^^^^^^^^^^^^^
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/aiohttp/client.py", line 793, in _request
resp.raise_for_status()
~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1157, in raise_for_status
raise ClientResponseError(
...<5 lines>...
)
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url='https://pge.opower.com/ei/app/403.html'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/main.py", line 214, in
asyncio.run(_main())
~~~~~~~~~~~^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/main.py", line 93, in _main
await opower.async_login()
File "/Users/christophe/bin/opower/lib/python3.13/site-packages/opower/opower.py", line 205, in async_login
raise InvalidAuth(err)
opower.exceptions.InvalidAuth: 403, message='Forbidden', url='https://pge.opower.com/ei/app/403.html'
...

What version of Home Assistant Core has the issue?

core-2024.10.3

What was the last working version of Home Assistant Core?

core-2024.10.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Opower

Link to integration documentation on our website

https://www.home-assistant.io/integrations/opower/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Hey there @tronikos, mind taking a look at this issue as it has been labeled with an integration (opower) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of opower can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign opower Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


opower documentation
opower source
(message by IssueLinks)

Same issue here.

Yep have it today as of 5 hours ago

guice commented

Happening for me as well.

Same just as another data point :)

Same issue here.
When I logged into my PGE account on a web browser it mentioned something about changing authentication and it requiring a phone number. It didn't need it today when I logged in, but there may be some underlying change in the authentication as part of the transition.

Just adding on here: this integration no longer works with my consumer PG&E account. Logging into the PG&E website directly, they say they are "upgrading" the accounts to force both phone number and email validation in addition to the username and password. So, could it be that PG&E authentication changes have broken this plugin and integration?

One thing I noticed is that I can't look at my usage pages on the PG&E website. I get their 403 page. Definitely seems like we need to wait to see what happens on their end before looking into changing the integration.

I'm the owner of this integration and I'm also on PG&E. It's broken for me too. It's broken on the PG&E website as well for everyone. Please resist from commenting here to avoid spamming everyone. Once it's resolved on the PG&E website I can look into if any changes are needed in the upstream library.

You should have received an email (got mine yesterday) from PG&E "Action Needed" there is a link to confirm your phone/email prior to Nov, 21. There is a new pge.com account a 2fa deal...

https://www.pge.com/en/featured/new-pge-account.html?vnt=newaccount&cid=em_all_sfmc_eng_20241004-custcomms-myaccountpreview-c4664-newaccount-body_20241022

mkanet commented

I am not sure if I am having the same issue. Today, I noticed that no matter what I do, I am prompted Invalid authentication after entering the correct username and password. In fact, my password is still stored in my browser's cache. I have tried removing the integration and adding it back. That didnt help. I dont have any issues logging into my PGE account using any web browser.

I've seen this issue before. I had to wait at least a day and try it again for it to start working again.

Seems to have been fixed (for me, at least)

16-9 commented

While I am now able to connect again, I only have 1 service (electricity) and 8 entities, whereas I used to have a 2nd service (for gas).

While I am now able to connect again, I only have 1 service (electricity) and 8 entities, whereas I used to have a 2nd service (for gas).

I'm seeing both Electricity and Gas again. Yesterday I experienced the authentication error, this morning I entered my PG&E password and the connection was restored. Both services and all entities are populated as expected.

Try reloading the service.