Skip to content

[Bug]: Failed to establish a new connection #39

@marys007

Description

@marys007

Zkontrolujte existující problémy

  • Completed

Verze

0.5.0

Popište chybu / popiště kroky k reprodukci chyby

Chyba

V HA se nezobrazuje info o HDO

Debug

Pokud zadam do prohlizece zadam nize uvedenou url dostanu od serveru odpoved.
https://www.cezdistribuce.cz/webpublic/distHdo/adam/containers/stred?&code=A1B8DP1

Nicmene v logu ctu:
docker-compose logs -f | grep cezdistribuce

hass_core        | 2025-01-05 14:44:52.867 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up cezdistribuce.binary_sensor
hass_core        | 2025-01-05 14:44:52.868 DEBUG (SyncWorker_4) [custom_components.cezdistribuce.binary_sensor] Update data for code A1B8DP1 in region stred
hass_core        | 2025-01-05 14:44:57.879 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up cezdistribuce platform for binary_sensor
hass_core        | urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.cezdistribuce.cz', port=443): Max retries exceeded with url: /webpublic/distHdo/adam/containers/stred?&code=A1B8DP1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5f7e6238c0>: Failed to establish a new connection: [Errno -3] Try again'))
hass_core        |   File "/config/custom_components/cezdistribuce/binary_sensor.py", line 44, in setup_platform
hass_core        |   File "/config/custom_components/cezdistribuce/binary_sensor.py", line 57, in __init__
hass_core        |   File "/config/custom_components/cezdistribuce/binary_sensor.py", line 113, in update
hass_core        | requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.cezdistribuce.cz', port=443): Max retries exceeded with url: /webpublic/distHdo/adam/containers/stred?&code=A1B8DP1 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5f7e6238c0>: Failed to establish a new connection: [Errno -3] Try again'))

Pokud kod spustim lokalne, vse tez funguje

from custom_components.cezdistribuce.binary_sensor import CezDistribuce


cez = CezDistribuce("cezdistribuce", "stred", "A1B8DP1")
print(cez.update())
print(cez.responseJson)
/Users/blaf/projects/HomeAssistant-CEZdistribuce/.venv/bin/python /Users/blaf/projects/HomeAssistant-CEZdistribuce/main.py 
None
{'data': [{'primaryKey': 5892, 'ID': 5892, 'VALID_FROM': '2024-10-28T23:00:00.000+00:00', 'VALID_TO': '2098-12-31T23:00:00.000+00:00', 'DUMP_ID': 48, 'POVEL': 'A1B8DP1', 'KOD': 'P86, P84, P86D, P85, P80, P87, P85D, P84D, P87D, P83,', 'KOD_POVELU': '213', 'SAZBA': 'D45d', 'INFO': 'sazba', 'PLATNOST': 'Po - Pá', 'DOBA': '20', 'CAS_ZAP_1': '0:00', 'CAS_VYP_1': '6:15', 'CAS_ZAP_2': '7:10', 'CAS_VYP_2': '8:35', 'CAS_ZAP_3': '9:35', 'CAS_VYP_3': '15:55', 'CAS_ZAP_4': '16:55', 'CAS_VYP_4': '18:35', 'CAS_ZAP_5': '19:30', 'CAS_VYP_5': '23:59', 'CAS_ZAP_6': None, 'CAS_VYP_6': None, 'CAS_ZAP_7': None, 'CAS_VYP_7': None, 'CAS_ZAP_8': None, 'CAS_VYP_8': None, 'CAS_ZAP_9': None, 'CAS_VYP_9': None, 'CAS_ZAP_10': None, 'CAS_VYP_10': None, 'DATE_OF_ENTRY': '2024-10-16T05:55:33.000+00:00', 'DESCRIPTION': '2024_podzim_stred'}, {'primaryKey': 5893, 'ID': 5893, 'VALID_FROM': '2024-10-28T23:00:00.000+00:00', 'VALID_TO': '2098-12-31T23:00:00.000+00:00', 'DUMP_ID': 48, 'POVEL': 'A1B8DP1', 'KOD': 'P86, P84, P86D, P85, P80, P87, P85D, P84D, P87D, P83,', 'KOD_POVELU': '213', 'SAZBA': 'D45d', 'INFO': 'sazba', 'PLATNOST': 'So - Ne', 'DOBA': '20', 'CAS_ZAP_1': '0:00', 'CAS_VYP_1': '10:35', 'CAS_ZAP_2': '11:35', 'CAS_VYP_2': '15:50', 'CAS_ZAP_3': '16:50', 'CAS_VYP_3': '19:30', 'CAS_ZAP_4': '20:30', 'CAS_VYP_4': '21:30', 'CAS_ZAP_5': '22:15', 'CAS_VYP_5': '23:59', 'CAS_ZAP_6': None, 'CAS_VYP_6': None, 'CAS_ZAP_7': None, 'CAS_VYP_7': None, 'CAS_ZAP_8': None, 'CAS_VYP_8': None, 'CAS_ZAP_9': None, 'CAS_VYP_9': None, 'CAS_ZAP_10': None, 'CAS_VYP_10': None, 'DATE_OF_ENTRY': '2024-10-16T05:55:33.000+00:00', 'DESCRIPTION': '2024_podzim_stred'}], 'pageSize': 20, 'pageNumber': 1, 'pageOffset': 0, 'pageBarItems': 5, 'totalNumberOfRecords': 2, 'pagingModel': {}, 'firstRecordNumberForPage': 0, 'lastPageNumber': 1, 'lastRecordNumber': 2, 'onePage': True, 'pageNumbersNavigation': [1], 'defaultPageNumbersAround': [1], 'fullyInitialized': True, 'last': True, 'first': True}

Process finished with exit code 0

Kdyz zkusim spustit curl request zevnitr kontejneru tez vse funguje. NECHAPU

~/docker/homeassistant$ docker exec -it e922ddbcd427 /bin/bash

# curl
curl: try 'curl --help' or 'curl --manual' for more information
nuc:/config# curl --request GET \
  --url 'https://www.cezdistribuce.cz/webpublic/distHdo/adam/containers/stred?code=A1B8DP1' \
  --header 'Authorization: Bearer undefined' \
  --header 'User-Agent: test/10.2.0' \
  --cookie 'BIGipServerwls_edee_prod_ext_3000_pool=rd1o00000000000000000000ffffac1dceaco3000; TS018aba42=01604099e5744db2d9c35c553af8ba35ff8a8899cd7a1ce4f85ae4bd8b9927de445c9fb6505551f63f0d41fb3dd3cdf69c04d2a1b70a3a83e68baca1d3ec4e9befd273650c'
{
  "data" : [ {
    "primaryKey" : 5892,
    "ID" : 5892,
    "VALID_FROM" : "2024-10-28T23:00:00.000+00:00",
    "VALID_TO" : "2098-12-31T23:00:00.000+00:00",
    "DUMP_ID" : 48,
    "POVEL" : "A1B8DP1",
    ...

Verze pythonu a HA je:

~/docker/homeassistant$ docker exec -it e922ddbcd427 python --version
Python 3.13.1

image

Mate tuseni v cem je problem?

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions