rnovacek / homeassistant_cz_energy_spot_prices

Home Assistant integration that provides current Czech electricity spot prices based on OTE.
Apache License 2.0
75 stars 17 forks source link

DST problem #19

Closed foxzqw closed 1 year ago

foxzqw commented 1 year ago

při změně na DST má podle OTE den jen 23 hodin - https://www.ote-cr.cz/cs/kratkodobe-trhy/elektrina/denni-trh?date=2023-03-26

a integrace jde do chyby:

2023-03-26 19:20:14.383 ERROR (MainThread) [custom_components.cz_energy_spot_prices.coordinator] Unexpected error fetching Czech Energy Spot Prices data: 2
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 168, in _async_update_data
return SpotRateData(rates, zoneinfo)
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 103, in __init__
for i, hour in enumerate(sorted(self.tomorrow_day.hours_by_dt.values(), key=lambda hour: hour._consecutive_sum_prices[consecutive]), 1):
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 103, in <lambda>
for i, hour in enumerate(sorted(self.tomorrow_day.hours_by_dt.values(), key=lambda hour: hour._consecutive_sum_prices[consecutive]), 1):
KeyError: 2
2023-03-26 19:20:14.825 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up cz_energy_spot_prices platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 168, in _async_update_data
return SpotRateData(rates, zoneinfo)
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 103, in __init__
for i, hour in enumerate(sorted(self.tomorrow_day.hours_by_dt.values(), key=lambda hour: hour._consecutive_sum_prices[consecutive]), 1):
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 103, in <lambda>
for i, hour in enumerate(sorted(self.tomorrow_day.hours_by_dt.values(), key=lambda hour: hour._consecutive_sum_prices[consecutive]), 1):
KeyError: 2
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 293, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/cz_energy_spot_prices/sensor.py", line 125, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 211, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: 2

předpokládám, že podobný problém bude na podzim, kdy DST končí a OTE má 25 údajů o cenách https://www.ote-cr.cz/cs/kratkodobe-trhy/elektrina/denni-trh?date=2022-10-30

rnovacek commented 1 year ago

Máte aktuální verzi? V noci na dnešek jsem upravoval jeden problém DST.

rnovacek commented 1 year ago

Koukám, že jsem zapomněl vytvořit release. Pardon, opraveno.

foxzqw commented 1 year ago

Perfektní, už to běží bez problému. Díky!