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

Update for sensor.het_rode_hert_production_month_shares fails #57

Closed balk77 closed 1 year ago

balk77 commented 1 year ago

Checklist

The problem

Update for sensor.het_rode_hert_production_month_shares and sensor.het_rode_hert_production_month_total fails. It is reported many times in the HA logs (+1000 times in half a day)

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

Home Assistant 2022.11.1

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

Supervisor 2022.10.2

What is version of Home Assistant Supervisor?

Operating System 9.3

What is version of the Windcentrale integration?

0.2.5

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:253 Integration: Windcentrale (documentation, issues) First occurred: 14:26:56 (1066 occurrences) Last logged: 23:19:39

Update for sensor.het_rode_hert_production_month_shares fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update raise exc File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/windcentrale/sensor.py", line 253, in update self._state = self._windturbine.production_shares_month_data[datetime.now().month] KeyError: 11

Additional information

No response

jobvk commented 1 year ago

If I compare my total month data with that of the rode hert, the rode hert is indeed missing 2 months, see result below.

You should contact the customer service and ask say there are two months missing at month production of the windturbine the rode hert.

Rode Hert Witte Juffer
```json [ { "labels":{ "year":2022, "month":1 }, "rounded_value":384749, "value":384748.945, "record":false }, { "labels":{ "year":2022, "month":2 }, "rounded_value":634201, "value":634201.112, "record":true }, { "labels":{ "year":2022, "month":3 }, "rounded_value":239602, "value":239601.708, "record":false }, { "labels":{ "year":2022, "month":4 }, "rounded_value":322738, "value":322737.977, "record":false }, { "labels":{ "year":2022, "month":5 }, "rounded_value":203381, "value":203381.152, "record":false }, { "labels":{ "year":2022, "month":6 }, "rounded_value":151998, "value":151998.12, "record":false }, { "labels":{ "year":2022, "month":7 }, "rounded_value":116682, "value":116682.215, "record":false }, { "labels":{ "year":2022, "month":8 }, "rounded_value":86698, "value":86697.635, "record":false }, { "labels":{ "year":2022, "month":9 }, "rounded_value":46684, "value":46684.445, "record":false } ] ``` ```json [ { "labels":{ "year":2022, "month":1 }, "rounded_value":350650, "value":350650.224, "record":false }, { "labels":{ "year":2022, "month":2 }, "rounded_value":636434, "value":636434.444, "record":true }, { "labels":{ "year":2022, "month":3 }, "rounded_value":227533, "value":227532.756, "record":false }, { "labels":{ "year":2022, "month":4 }, "rounded_value":266820, "value":266820.437, "record":false }, { "labels":{ "year":2022, "month":5 }, "rounded_value":183255, "value":183255.308, "record":false }, { "labels":{ "year":2022, "month":6 }, "rounded_value":135927, "value":135926.772, "record":false }, { "labels":{ "year":2022, "month":7 }, "rounded_value":103165, "value":103164.82, "record":false }, { "labels":{ "year":2022, "month":8 }, "rounded_value":88169, "value":88168.94, "record":false }, { "labels":{ "year":2022, "month":9 }, "rounded_value":122998, "value":122998.328, "record":false }, { "labels":{ "year":2022, "month":10 }, "rounded_value":217638, "value":217637.948, "record":false }, { "labels":{ "year":2022, "month":11 }, "rounded_value":75124, "value":75123.644, "record":false } ] ```
balk77 commented 1 year ago

I have asked customer service and they confirmed that the data connection was not working properly. I am getting these errors. Is this something we can suppress from the integration side? It causes high server load on my side

2022-11-12 15:52:00.515 INFO (MainThread) [custom_components.windcentrale.wind] Updating live data of windturbine Het Rode Hert using Rest API
2022-11-12 15:52:10.760 INFO (MainThread) [custom_components.windcentrale.wind] Updating live data of windturbine Het Rode Hert using Rest API
2022-11-12 15:52:14.242 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.het_rode_hert_production_month_total fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/windcentrale/sensor.py", line 240, in update
    self._state = self._windturbine.production_windtrubine_month_data[datetime.now().month]
KeyError: 11
2022-11-12 15:52:14.250 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.het_rode_hert_production_month_shares fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/windcentrale/sensor.py", line 253, in update
    self._state = self._windturbine.production_shares_month_data[datetime.now().month]
KeyError: 11
2022-11-12 15:52:20.977 INFO (MainThread) [custom_components.windcentrale.wind] Updating live data of windturbine Het Rode Hert using Rest API
jobvk commented 1 year ago

I don't think you can suppress them. But the easiest solution is in the .const file you can remove the month sensors from the array and restart the integration. And the sensors are removed.

image

jobvk commented 1 year ago

It looks like the problem is solved.