Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opower - Peco :: ClientResponseError: 400 when calling ADI #110979

Open
ichrispod opened this issue Feb 19, 2024 · 8 comments
Open

Opower - Peco :: ClientResponseError: 400 when calling ADI #110979

ichrispod opened this issue Feb 19, 2024 · 8 comments

Comments

@ichrispod
Copy link

The problem

When calling the https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken API, I'm getting an HTTP 400

Logger: homeassistant.components.opower.coordinator
Source: helpers/update_coordinator.py:313
Integration: Opower (documentation, issues)
First occurred: 5:56:32 PM (6 occurrences)
Last logged: 6:00:01 PM

Unexpected error fetching Opower data: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 194, in async_login
self.access_token = await self.utility.async_login(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/opower/utilities/exelon.py", line 209, 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 1060, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/opower/coordinator.py", line 80, in _async_update_data
await self.api.async_login()
File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 202, in async_login
raise CannotConnect(err)
opower.exceptions.CannotConnect: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')

What version of Home Assistant Core has the issue?

core-2024.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Opower

Link to integration documentation on our website

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

Diagnostics information

Logger: homeassistant.components.opower.coordinator
Source: helpers/update_coordinator.py:313
Integration: Opower (documentation, issues)
First occurred: 5:56:32 PM (6 occurrences)
Last logged: 6:00:01 PM

Unexpected error fetching Opower data: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 194, in async_login
self.access_token = await self.utility.async_login(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/opower/utilities/exelon.py", line 209, 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 1060, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 313, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/opower/coordinator.py", line 80, in _async_update_data
await self.api.async_login()
File "/usr/local/lib/python3.12/site-packages/opower/opower.py", line 202, in async_login
raise CannotConnect(err)
opower.exceptions.CannotConnect: 400, message='Bad Request', url=URL('https://secure.peco.com/api/Services/OpowerService.svc/GetOpowerToken')

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

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)

@bens545
Copy link

bens545 commented Feb 20, 2024

I think this is related to transition to a new billing system. It's not currently possible to login to their website either.

image

@ichrispod
Copy link
Author

ichrispod commented Feb 20, 2024 via email

@supermarkert
Copy link

supermarkert commented Apr 23, 2024

Any update to this? PECO did seem to switch to a new billing system (so everyone gets new account numbers). I can login to PECO's website, but the integration doesn't seem to be pulling any data. I deleted my Opower entries and added PECO back in. The GUI says it was setup correctly, but no entities are actually created.
image

@tronikos
Copy link
Member

Entities are only created if your utility provides forecast data. Do you get statistics?

@ichrispod
Copy link
Author

ichrispod commented Apr 24, 2024 via email

@supermarkert
Copy link

Entities are only created if your utility provides forecast data. Do you get statistics?

I get historical data on Peco's website (don't think I've ever had forecast data). This integration worked fine previously and all the numbers brought in lined up with the data on Peco's website for past usage, but then seemingly the connection broke a couple months ago.
I've deleted the integration and tried adding it back in, and got the results above: it says it successfully logged in and connected, but no entities are created.

@supermarkert
Copy link

supermarkert commented Apr 25, 2024

Update: I noticed that it magically started collecting again today, without me changing anything (except I did reboot at some point). So it was either (1) random PECO website nonsense, (2) it was because I deleted the integration a few days ago and needed to then wait 24-48 hours for it to update, or maybe (3) it was the reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants