bajansen / home-assistant-frank_energie

Custom Component voor Home Assistant Frank Energie prijsinformatie
68 stars 19 forks source link

Updates gestopt door ongeldige waarde #63

Closed DCSBL closed 1 year ago

DCSBL commented 1 year ago

Gister was de API gestopt met updaten. Ik gok dat er een probleem was met de API of de verbinding met de API. Het lukt me niet om te pinpointen wat we precies kunnen doen om dit te voorkomen, maar met wat logjes kan iemand anders dit misschien ontdekken.

Na een reload werkte alles weer.

2023-03-09 16:00:00.216 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes
return self.entity_description.attr_fn(self.coordinator.data)
File "/config/custom_components/frank_energie/sensor.py", line 144, in <lambda>
attr_fn=lambda data: {ATTR_TIME: data[DATA_GAS].today_min.date_from},
File "/config/custom_components/frank_energie/price_data.py", line 72, in today_min
return min([hour for hour in self.today], key=lambda hour: hour.total)
ValueError: min() arg is an empty sequence

2023-03-09 16:00:00.219 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes
return self.entity_description.attr_fn(self.coordinator.data)
File "/config/custom_components/frank_energie/sensor.py", line 151, in <lambda>
attr_fn=lambda data: {ATTR_TIME: data[DATA_GAS].today_max.date_from},
File "/config/custom_components/frank_energie/price_data.py", line 76, in today_max
return max([hour for hour in self.today], key=lambda hour: hour.total)
ValueError: max() arg is an empty sequence

2023-03-09 16:00:00.222 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes
return self.entity_description.attr_fn(self.coordinator.data)
File "/config/custom_components/frank_energie/sensor.py", line 158, in <lambda>
attr_fn=lambda data: {ATTR_TIME: data[DATA_ELECTRICITY].today_min.date_from},
File "/config/custom_components/frank_energie/price_data.py", line 72, in today_min
return min([hour for hour in self.today], key=lambda hour: hour.total)
ValueError: min() arg is an empty sequence

2023-03-09 16:00:00.228 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes
return self.entity_description.attr_fn(self.coordinator.data)
File "/config/custom_components/frank_energie/sensor.py", line 165, in <lambda>
attr_fn=lambda data: {ATTR_TIME: data[DATA_ELECTRICITY].today_max.date_from},
File "/config/custom_components/frank_energie/price_data.py", line 76, in today_max
return max([hour for hour in self.today], key=lambda hour: hour.total)
ValueError: max() arg is an empty sequence

2023-03-09 16:00:00.283 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.average_electricity_price_today fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 541, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 739, in async_device_update
raise exc
File "/config/custom_components/frank_energie/sensor.py", line 226, in async_update
self._attr_native_value = self.entity_description.value_fn(
File "/config/custom_components/frank_energie/sensor.py", line 171, in <lambda>
value_fn=lambda data: data[DATA_ELECTRICITY].today_avg,
File "/config/custom_components/frank_energie/price_data.py", line 80, in today_avg
return round(sum(hour.total for hour in self.today) / len(self.today), 5)
ZeroDivisionError: division by zero
HiDiHo01 commented 1 year ago

Ik heb even de history bekeken. Er zit idd een gat om 16uur tot 17uur op 9 maart. Ik denk dat de API een storing had. De app ging normaal door na 17uur en had geen reload nodig.

Op vr 10 mrt. 2023 16:44 schreef Duco Sebel @.***>:

Gister was de API gestopt met updaten. Ik gok dat er een probleem was met de API of de verbinding met de API. Het lukt me niet om te pinpointen wat we precies kunnen doen om dit te voorkomen, maar met wat logjes kan iemand anders dit misschien ontdekken.

Na een reload werkte alles weer.

2023-03-09 16:00:00.216 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes return self.entity_description.attr_fn(self.coordinator.data) File "/config/custom_components/frank_energie/sensor.py", line 144, in attr_fn=lambda data: {ATTR_TIME: data[DATA_GAS].today_min.date_from}, File "/config/custom_components/frank_energie/price_data.py", line 72, in today_min return min([hour for hour in self.today], key=lambda hour: hour.total) ValueError: min() arg is an empty sequence

2023-03-09 16:00:00.219 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes return self.entity_description.attr_fn(self.coordinator.data) File "/config/custom_components/frank_energie/sensor.py", line 151, in attr_fn=lambda data: {ATTR_TIME: data[DATA_GAS].today_max.date_from}, File "/config/custom_components/frank_energie/price_data.py", line 76, in today_max return max([hour for hour in self.today], key=lambda hour: hour.total) ValueError: max() arg is an empty sequence

2023-03-09 16:00:00.222 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes return self.entity_description.attr_fn(self.coordinator.data) File "/config/custom_components/frank_energie/sensor.py", line 158, in attr_fn=lambda data: {ATTR_TIME: data[DATA_ELECTRICITY].today_min.date_from}, File "/config/custom_components/frank_energie/price_data.py", line 72, in today_min return min([hour for hour in self.today], key=lambda hour: hour.total) ValueError: min() arg is an empty sequence

2023-03-09 16:00:00.228 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 603, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/frank_energie/sensor.py", line 257, in extra_state_attributes return self.entity_description.attr_fn(self.coordinator.data) File "/config/custom_components/frank_energie/sensor.py", line 165, in attr_fn=lambda data: {ATTR_TIME: data[DATA_ELECTRICITY].today_max.date_from}, File "/config/custom_components/frank_energie/price_data.py", line 76, in today_max return max([hour for hour in self.today], key=lambda hour: hour.total) ValueError: max() arg is an empty sequence

2023-03-09 16:00:00.283 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.average_electricity_price_today fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 541, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 739, in async_device_update raise exc File "/config/custom_components/frank_energie/sensor.py", line 226, in async_update self._attr_native_value = self.entity_description.value_fn( File "/config/custom_components/frank_energie/sensor.py", line 171, in value_fn=lambda data: data[DATA_ELECTRICITY].today_avg, File "/config/custom_components/frank_energie/price_data.py", line 80, in today_avg return round(sum(hour.total for hour in self.today) / len(self.today), 5) ZeroDivisionError: division by zero

— Reply to this email directly, view it on GitHub https://github.com/bajansen/home-assistant-frank_energie/issues/63, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXDM26YVZP6GJZS7ZWYEW6LW3ND65ANCNFSM6AAAAAAVWTTFWI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DCSBL commented 1 year ago

Klinkt ook aannemelijk! Sluit ik deze! Als het blijkt dat het vaker gebeurd kunnen we misschien wat doen aan de error reporting, maar lijkt me nu niet nodig IMO.