Closed cerebrate closed 1 year ago
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!
(message by CodeOwnersMention)
opower documentation opower source (message by IssueLinks)
Exact same issue here with evergy. Have tried both the HACS version and the official, both having the same error.
Same issue here but running the demo from the python library via command line works fine.
Edit: Spoke too soon. 0.15 demo works but 0.18 demo gives 401 error.
It seems Evergy doesn't like this change: https://github.com/tronikos/opower/commit/28a4efd3c1d336777b6a9916e5e88aa69c6a5988
2023-08-03 02:29:36.812 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Evergy (USER)' for opower integration not ready yet: 401, message='Unauthorized', url=URL('https://kcpl.opower.com/ei/edge/apis/multi-account-v1/cws/kcpl/customers?offset=0&batchSize=100&addressFilter='); Retrying in background 2023-08-03 02:29:46.633 DEBUG (MainThread) [homeassistant.components.opower.coordinator] Finished fetching Opower data in 4.663 seconds (success: False) 2023-08-03 02:30:01.405 DEBUG (MainThread) [homeassistant.components.opower.coordinator] Finished fetching Opower data in 4.269 seconds (success: False) 2023-08-03 02:30:26.061 DEBUG (MainThread) [homeassistant.components.opower.coordinator] Finished fetching Opower data in 4.471 seconds (success: False)
I asked the 2 Evergy contributors to take a look since it looks like my https://github.com/tronikos/opower/commit/28a4efd3c1d336777b6a9916e5e88aa69c6a5988 broke Evergy.
I asked the 2 Evergy contributors to take a look since it looks like my tronikos/opower@28a4efd broke Evergy.
Let us know if there is something you'd like us to test.
Looking at the headers, it looks like the 'authorization' has an extra 'Bearer' in it that wasn't there in 0.0.16:
'authorization': 'Bearer Bearer XXXX'
Indeed, removing 'Bearer' from this line fixes it: https://github.com/tronikos/opower/commit/28a4efd3c1d336777b6a9916e5e88aa69c6a5988#diff-7dce08179b97e85eeacb89007dc7c1052d06fbc7fa5d3108541a1f5d9a927925R390
Thanks for catching it. I missed that. I'll modify line: opower_access_token = resp.headers["jwt"]
to remote the Bearer prefix.
The problem
On attempting to set up the Opower integration to use Evergy, while the setup completes, the integration reports "Failed setup, will retry". Retries are unsuccessful. On the surface, it looks like an authentication failure, with the following error reported in the logs:
But repeated tests have confirmed that the username and password supplied are correct and function to access the Evergy web site.
What version of Home Assistant Core has the issue?
core-2023.8.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
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?
Additional information
No response