tronikos / opower

A Python library for getting historical and forecasted usage/cost from utilities that use opower.com such as PG&E
Apache License 2.0
53 stars 49 forks source link

City of Austin Utilities Authentication failure #78

Closed pjolivon closed 2 months ago

pjolivon commented 2 months ago

The authentication for City of Austin utilities is failing while using correct credentials.

error: Failed to connect

atx32 commented 2 months ago

I believe I am having the same issue. Was working fine until the last day or two. HA log shows:

Logger: homeassistant.components.opower.coordinator Source: helpers/update_coordinator.py:315 integration: Opower (documentation, issues) First occurred: 12:13:09 PM (22 occurrences) Last logged: 12:37:53 PM

Unexpected error fetching Opower data: 500, message='Internal Server Error', url=URL('https://dss-coa.opower.com/webcenter/edge/apis/identity-management-v1/cws/v1/auth/coa/saml/ott/confirm') Unexpected error fetching Opower data: 500, message='Internal Server Error', url=URL('https://dss-coa.opower.com/webcenter/edge/apis/identity-management-v1/cws/v1/auth/coa/saml/login/callback?successUrl=https://dss-coa.opower.com/dss/login-success?token%3D%25s%26nextPathname%3DL2Rzcy8%3D&failureUrl=https://dss-coa.opower.com/dss/login-error?reason%3D%25s') Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 193, in async_login self.access_token = await self.utility.async_login( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/opower/utilities/coautilities.py", line 136, in async_login async with session.post( File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1194, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 693, in _request resp.raise_for_status() File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://dss-coa.opower.com/webcenter/edge/apis/identity-management-v1/cws/v1/auth/coa/saml/ott/confirm')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/opower/coordinator.py", line 81, in _async_update_data await self.api.async_login() File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 201, in async_login raise CannotConnect(err) opower.exceptions.CannotConnect: 500, message='Internal Server Error', url=URL('https://dss-coa.opower.com/webcenter/edge/apis/identity-management-v1/cws/v1/auth/coa/saml/ott/confirm')

pjolivon commented 2 months ago

@max2697 do you know if the issue is the code or on COA side?

pjolivon commented 2 months ago

@max2697 do you know if the issue is the code or on COA side? Or between the chair and the keyboard. ;D

atx32 commented 2 months ago

I'm guessing COA changed something that broke the integration. Logging in via their portal still works.

enter360 commented 2 months ago

Also experiencing this issue.

max2697 commented 2 months ago

Well, I spent a few hours debugging this auth flow and realized that they added a new cookie and are checking its presence. I still can't figure out which request added it, so I just hardcoded it for now. It's fixing the auth issue: https://github.com/tronikos/opower/pull/79