jobvk / Home-Assistant-Windcentrale

Provides Home Assistant sensors for multiple wind turbines from the Windcentrale
https://jobvankoeveringe.com/projects/windcentrale/
Apache License 2.0
14 stars 3 forks source link

Error retrieving data #61

Closed abko closed 1 year ago

abko commented 1 year ago

Checklist

The problem

Since Nov 14 16:00 ish these errors appeared, while data is available through the mijn Windcentrale pages.

What is version of Home Assistant Core did you recieve the bug?

2022.11.1

What is version of Home Assistant Supervisor did you recieve the bug?

Frontend 20221102.1 - latest

What is version of Home Assistant Supervisor?

Frontend 20221102.1 - latest

What is version of the Windcentrale integration?

Latest

Example Code snippet

No response

Anything in the logs that might be useful for us?

This error originated from a custom integration.

Logger: homeassistant.helpers.entity Source: custom_components/windcentrale/sensor.py:158 Integration: Windcentrale (documentation, issues) First occurred: 14 November 2022 at 15:57:20 (2927 occurrences) Last logged: 16:20:23

Update for sensor.de_jonge_held fails Traceback (most recent call last): File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 527, in async_update_ha_state await self.async_device_update() File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 722, in async_device_update raise exc File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, *self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/windcentrale/sensor.py", line 158, in update self._state = self._windturbine.live_data[self._sensor] self._windturbine.shares KeyError: 'power_per_share'

Additional information

No response

sebastianberm commented 1 year ago

This is not restricted to 1 windturbine, but it seems like it's all of them. At the moment, I have 5 different turbines giving back these errors, so I think it's something that was changed on the API?

QNimbus commented 1 year ago

This is not restricted to 1 windturbine, but it seems like it's all of them. At the moment, I have 5 different turbines giving back these errors, so I think it's something that was changed on the API?

I have the same issue but haven't had time to investigate yet - it might be related to the JWT session expiring prematurely?

jobvk commented 1 year ago

I also had this problem. But after restarting home assistant once, the problem did not reappear. I will leave this issue open for a while in case it occurs more often.

abko commented 1 year ago

Thanks Job. I did not try restarting HA earlier. Indeed the problem seems to have recovered. If I will encounter it again I will report it here.

krispijnb commented 1 year ago

I've had the same issue from November 11th till November 13th. Yesterday it occured again around 16:00hrs. Restarting HA as described above seems to have solved the issue time.

sebastianberm commented 1 year ago

The restart indeed seems to fix the issue. I don't know where this plugin stores the JWT session data, so the idea of a session expiring prematurely does seem to make sense.

Xorfor commented 1 year ago

I also had this problem. On 14th november @ 16:00 the last data for both windmills. After restarting HA it works again. I also had problems to get data on the windcentrale.nl website.

Xorfor commented 1 year ago

Today since 5:55 no data received. After restart of the HA, data is displayed gain.

sebastianberm commented 1 year ago

It seems like the JWT expires ahead of time or responds in a strange way. I am not 100% sure how the tokens are stored in HA, so I can't be sure.

In my case, it seems like a restart of HA fixes it in 100% of the cases, but turning something off and on again isn't a fix ;-). So I would suggest a mechanism to check the JWT and reauthenticate if it does expire ahead of time (or at least a way to deal with it).

jobvk commented 1 year ago

I am not quite sure myself where the problem lies. I got several errors in a short time:

abko commented 1 year ago

@jobvk Could it be that the problem occurs when there is a period with 0 production? Looking at the data in HA seems to suggest that, but I might be wrong.

johan-de-jong commented 1 year ago

From 2022-11-28 22:21:27h until about 2022-11-30 15:05h /config/home-assistant.log is filled with errors.

Maybe a exponential backoff is desirable when the plugin does not receive the expected result from the mijn.windcentrale.nl server?

   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_wind_speed fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_wind_direction fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_run_percentage fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_revolutions_per_minute fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_power_total fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_power_percentage fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_power_per_share fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_last_update fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_hours_run_total fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_hours_run_this_year fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_energy_shares fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_energy_prognoses_this_year fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer_energy fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_witte_juffer fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_wind_speed fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_wind_direction fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_run_percentage fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_revolutions_per_minute fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_power_total fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_power_percentage fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_power_per_share fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_last_update fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_hours_run_total fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_hours_run_this_year fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_energy_shares fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_energy_prognoses_this_year fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert_energy fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.de_grote_geert fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.de_witte_juffer_pulsating fails
   4907 x ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.de_grote_geert_pulsating fails
     16 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection live data of windturbine De Grote Geert the response data 
     15 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection live data of windturbine De Witte Juffer the response data 
     11 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection live data of windturbine De Witte Juffer the response data  and code 401
     10 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection live data of windturbine De Grote Geert the response data  and code 401
      4 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection news data
      1 x WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration windcentrale which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
      1 x ERROR (MainThread) [custom_components.windcentrale.wind] Invalid response from server for collection live data of windturbine De Witte Juffer the response data 
      1 x ERROR (MainThread) [custom_components.windcentrale.wind] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='mijn.windcentrale.nl', port=443): Max retries exceeded with url: /api/v0/sustainable/notices (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Try again'))"))
      1 x ERROR (MainThread) [custom_components.windcentrale.wind] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='mijn.windcentrale.nl', port=443): Max retries exceeded with url: /api/v0/sustainable/notices (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Try again'))"))
      1 x ERROR (MainThread) [custom_components.windcentrale.wind] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='mijn.windcentrale.nl', port=443): Max retries exceeded with url: /api/v0/sustainable/notices (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Try again'))"))
      1 x ERROR (MainThread) [custom_components.windcentrale.wind] Error occurred while fetching data: ConnectionError(MaxRetryError("HTTPSConnectionPool(host='mijn.windcentrale.nl', port=443): Max retries exceeded with url: /api/v0/sustainable/notices (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Try again'))"))
   
jobvk commented 1 year ago

For everyone who had this problem, please check if you still have this problem after updating to version 0.2.6

jobvk commented 1 year ago

Is this problem still relevant or can it be closed?

sebastianberm commented 1 year ago

I've had issues, but they were related to Windcentrale providing incorrect data. So I think this can be closed 👍 .

Thanks!

abko commented 1 year ago

@jobvk Since the update it has also not surfaced for me anymore. I believe it can be closed.