Closed BrianHenryIE closed 4 months ago
Can you fix the mypy warnings?
I fixed them all except:
error: X | Y syntax for unions requires Python 3.10
AIUI, Home Assistant doesn't support < 3.11, so maybe it would be easier to just increase the version used by this library? LMK.
I released v0.4.0. Please bump the version on the home assistant side, update documentation to mention support for this utility and add a virtual integration with icon.
will this be on home assistant 2024.3 ?
No. According to https://github.com/home-assistant/core/blob/dev/homeassistant/components/opower/manifest.json the version isn't bumped yet. Someone needs to do it and, in a separate PR, create a virtual integration.
This integration was working for a while for me, and then stopped working around a week ago. I tried deleting and re-adding the entry, but now it fails to add. Nothing has changed with my SMUD account, and I can log in normally using a browser.
2024-03-28 14:44:39.555 ERROR (MainThread) [homeassistant.components.opower.coordinator] Unexpected error fetching Opower data: 500, message='Internal Server Error', url=URL('https://myaccount.smud.org/')
Traceback (most recent call last):
File "/opt/hass/lib64/python3.12/site-packages/opower/opower.py", line 194, in async_login
self.access_token = await self.utility.async_login(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hass/lib64/python3.12/site-packages/opower/utilities/smud.py", line 130, in async_login
login_response = await session.post(
^^^^^^^^^^^^^^^^^^^
File "/opt/hass/lib64/python3.12/site-packages/aiohttp/client.py", line 693, in _request
resp.raise_for_status()
File "/opt/hass/lib64/python3.12/site-packages/aiohttp/client_reqrep.py", line 1060, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://myaccount.smud.org/')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/hass/lib64/python3.12/site-packages/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hass/lib64/python3.12/site-packages/homeassistant/components/opower/coordinator.py", line 80, in _async_update_data
await self.api.async_login()
File "/opt/hass/lib64/python3.12/site-packages/opower/opower.py", line 202, in async_login
raise CannotConnect(err)
opower.exceptions.CannotConnect: 500, message='Internal Server Error', url=URL('https://myaccount.smud.org/')
It works, and is unit tested.
Reviewed at https://github.com/andylittle/opower-smud/pull/1 by @kitchung, @Swanky-Bubbles, @nebhead, @v-yarotsky, @Borillion.
There is an error during linting:
And you mentioned async_auth_saml() – I tried it briefly and didn't get it to work. The reason I hadn't used it earlier was that I had forked a fork which was out of date so hadn't seen it.
I added a check to confirm any existing cookie is valid as discussed in #66.
Closes #54