Closed gut1986 closed 9 months ago
Taky se mi to poslední dobou dost často neaktualizuje. Nevím jestli až od 2023.9.2, ale teď mám v logu tyhle chyby:
Tato chyba pochází z vlastní integrace.
Logger: custom_components.cz_energy_spot_prices.coordinator
Source: helpers/update_coordinator.py:269
Integration: Czech Energy Spot Prices (documentation, issues)
First occurred: 9. září 2023 v 11:00:01 (27 occurrences)
Last logged: 00:00:01
Error fetching Czech Energy Spot Prices data: Error communicating with API: Unable to download rates: Server disconnected
Error fetching Czech Energy Spot Prices data: Error communicating with API: Unable to download rates: [Errno 104] Connection reset by peer
Error fetching Czech Energy Spot Prices data: Error communicating with API: Unable to download rates: Cannot connect to host www.ote-cr.cz:443 ssl:default [None]
Error fetching Czech Energy Spot Prices data: Error communicating with API:
Error fetching Czech Energy Spot Prices data: Error communicating with API: Unable to download rates: Cannot write to closing transport
a
Tato chyba pochází z vlastní integrace.
Logger: custom_components.cz_energy_spot_prices.coordinator
Source: custom_components/cz_energy_spot_prices/spot_rate.py:97
Integration: Czech Energy Spot Prices (documentation, issues)
First occurred: 9. září 2023 v 11:00:01 (39 occurrences)
Last logged: 00:00:01
OTE requests failed 1 times, retrying in 2 seconds
OTE requests failed 2 times, retrying in 4 seconds
OTE requests failed 3 times, retrying in 8 seconds
OTE requests failed 4 times, retrying in 16 seconds
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection
transport, protocol = await self._create_connection_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 964, in _read_ready__get_buffer
nbytes = self._sock.recv_into(buf)
^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 94, in _download
async with session.post(self.OTE_PUBLIC_URL, data=query) as response:
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.ote-cr.cz:443 ssl:default [Connection reset by peer]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 206, in _async_update_data
electricity_rates, gas_rates = await asyncio.gather(
^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 106, in get_electricity_rates
return await self._get_rates(query, unit, has_hours=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 133, in _get_rates
text = await self._download(query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 97, in _download
raise OTEFault(f'Unable to download rates: {e}')
custom_components.cz_energy_spot_prices.spot_rate.OTEFault: Unable to download rates: Cannot connect to host www.ote-cr.cz:443 ssl:default [Connection reset by peer]
Možná je spíš problém s tím serverem, že nedává tolik dotazů.
Já s Pythonem zase takový kamarád nejsem. Ale když jsem obnovil zálohu 2023.8.4, tak to funguje opět bez problémů.
Podle těch logů to zní jako problém s OTE servery nebo internetovým připojením obecně. Mohlo by to být tím, že všichni se každou celou hodinu snaží stáhnout data.
Asi by bylo řešení tam dát nějaké náhodné zpoždění, ať se připojení lépe rozprostřou v čase. Jak dlouho myslíte, že je v pohodě čekat než se data stáhnou? Je minuta snesitelná? Co 5 minut?
Vzhledem k tomu, že ta OTE data se publikují jednou denně a už se nemění, tak by čistě teoreticky stačilo aktualizovat jednou denně s nějakou náhodností. To je asi nepraktické, ale jako uživatele nás tedy ani frekvence ani délka aktualizací netrápí. A pokud se to udělá asynchronní, tak by nějaké dlouhé čekání nemělo trápit ani HA.
Dovolím si trochu nabourat teorii i nedostupnosti OTE serverů. Proč by po návratu na verzi HA 2023.8.4 jak uvádí @gut1986 problém zmizel?
Já jedu na verzi 2023.9.0 s v logu jsem našel toto.
Tato chyba pochází z vlastní integrace.
Logger: custom_components.cz_energy_spot_prices.coordinator Source: custom_components/cz_energy_spot_prices/spot_rate.py:97 Integration: Czech Energy Spot Prices (documentation, issues) First occurred: 7. září 2023 v 09:00:01 (108 occurrences) Last logged: 21:00:05
OTE requests failed 1 times, retrying in 2 seconds OTE requests failed 2 times, retrying in 4 seconds OTE requests failed 3 times, retrying in 8 seconds OTE requests failed 4 times, retrying in 16 seconds OTE requests failed 5 times, retrying in 32 seconds Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1112, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1145, in _create_connection_transport await waiter File "/usr/local/lib/python3.11/asyncio/sslproto.py", line 575, in _on_handshake_complete raise handshake_exc ConnectionResetError
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 94, in _download async with session.post(self.OTE_PUBLIC_URL, data=query) as response: File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise last_exc File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1178, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.ote-cr.cz:443 ssl:default [None]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/config/custom_components/cz_energy_spot_prices/coordinator.py", line 206, in _async_update_data electricity_rates, gas_rates = await asyncio.gather( ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 118, in get_gas_rates rates, currency_rates = await asyncio.gather( ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 133, in _get_rates text = await self._download(query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/cz_energy_spot_prices/spot_rate.py", line 97, in _download raise OTEFault(f'Unable to download rates: {e}') custom_components.cz_energy_spot_prices.spot_rate.OTEFault: Unable to download rates: Cannot connect to host www.ote-cr.cz:443 ssl:default [None]
A entita s aktuální cenou se mi normálně aktualizuje.
Zkusil jsem v noci aktualizovat na 2023.9.1 a od té doby se opět aktuální cena nezměnila. Je 5:55, takže by měla být 2,82kč, já mám však stále 2,56 už od pulnoci.
Takže je spíš problém se spuštěním nějakého triggeru, který mění tu entitu. A to načítání z OTEb je něco jiného.
U mě to tak vypadá.
Zkusil jsem v noci aktualizovat na 2023.9.1 a od té doby se opět aktuální cena nezměnila. Je 5:55, takže by měla být 2,82kč, já mám však stále 2,56 už od půlnoci.
@gut1986 Tohle je úplně jiný problém, než ta aktualizace dat z OTE.
Myslím, že jsem odhalil, kde je problém. Každou hodinu se stahují data z OTE a aktualizují senzory. Ale když stažení z OTE selže, senzory už se neaktualizují. Předělám to a dneska to budu testovat.
Opraveno ve verzi 0.6.0. Dejte prosím vědět, jestli to pomohlo.
Ano, zdá se že pomohlo. Díky.
Ahoj po aktualizaci na 2023.9.1 a následně i na 2023.9.2 se nepravidelně aktualizuje aktuální cena. Často zůstane několik hodin beze změny, ačkoliv načtené hodnoty na celý den jsou v pořádku.