TimSoethout / goodwe-sems-home-assistant

Sensor for Home Assistant pulling data from the GoodWe SEMS API for solar panel production metrics.
88 stars 38 forks source link

Error communicating with API, probably token could not be fetched #68

Closed ivo-toby closed 2 years ago

ivo-toby commented 2 years ago

The integration in home-assistant stopped working about 2/3 days ago. I tried to reinstall and another (visitor) account but still no success.

The logs in HA say:

2022-06-11 16:51:27 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform sems is taking over 10 seconds.
2022-06-11 16:51:28 ERROR (MainThread) [frontend.js.latest.202206010] :0:0 ResizeObserver loop completed with undelivered notifications.
2022-06-11 16:51:58 ERROR (SyncWorker_2) [custom_components.sems.sems_api] Unable to fetch data from SEMS. 
2022-06-11 16:51:58 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sems platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/sems/sensor.py", line 60, in async_update_data
    raise UpdateFailed(
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API, probably token could not be fetched, see debug logs

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/sems/sensor.py", line 74, in async_update_data
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Error communicating with API, probably token could not be fetched, see debug logs

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/sems/sensor.py", line 95, in async_setup_entry
    await coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Error communicating with API, probably token could not be fetched, see debug logs

If there are debug-logs I can't find them (I have an unsupported HA install in docker, the Goodwe integration was installed using HACS)

spockz commented 2 years ago

I have the same issue. Debug logging can be enabled using:


logger:
  default: info
  logs:
    custom_components.sems: debug

When I do it says that when doing the query the authentication is expired.

ivo-toby commented 2 years ago

Thanks, enabled debug, but no clue to where the logs are supposed to be.

sunib commented 2 years ago

I see the same symptoms in my system, it has been working flawless for months but suddenly stopped 3 days ago! No time yet allocated to analyse it further.

The sems app does show data so the inverters are running as expected.

ivo-toby commented 2 years ago

last update of the (ios) app was 1 month ago.. They possibly changed the auth-flow and updated the apps in advance. I have created an NodeJs API client a while ago, i'll check if that still works

Tonny56 commented 2 years ago

Same here. Stopped working yesterday evening. Logger: custom_components.sems.sems_api Source: custom_components/sems/sems_api.py:125 Integration: GoodWe SEMS API (documentation, issues) First occurred: 11 juni 2022 21:25:40 (1 occurrences) Last logged: 11 juni 2022 21:25:40

Unable to fetch data from SEMS.

spockz commented 2 years ago

Following an example on the issues which uses eu. I changed the power station url in my local install to eu. instead of www. and for now it seems to work.

spockz commented 2 years ago

And... it seems this was fixed in https://github.com/TimSoethout/goodwe-sems-home-assistant/releases/tag/3.7.0-beta. :)

Tonny56 commented 2 years ago

@spockz Thank you, this has fixed it!

TimSoethout commented 2 years ago

Thanks @spockz and @Tonny56 . Did 3.7.0 beta fix it? If so I'll promote it to a normal release.

micheldejongh commented 2 years ago

@TimSoethout 3.7.0 Beta fixed it for me as well

RamonM77 commented 2 years ago

@TimSoethout 3.7.0 beta fixed the issue for me too

sunib commented 2 years ago

Thanks for the help all, updating to 3.7.0 also solved it for me.