JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
183 stars 41 forks source link

TimeoutError when starting Home Assistant #41

Closed robinheymans closed 3 years ago

robinheymans commented 3 years ago

Hi!

I'm trying to setup the PyLoxone component, but I'm running into a TimeoutError! I'm able to access the LoxAPP3.json file using the host, port and credentials in a browser, so I guess my configuration is fine. Pinging the miniserver from the Home Assistant Raspberry Pi also succeeds.

I'm running HassOS v4.17 with Home Assistant v0.118.5 on a Raspberry Pi 4.

My configuration in configuration.yaml

loxone:
  port: 50080
  host: 192.168.1.10
  username: HomeAssistant
  password: *********
  generate_scenes: true

I've enabled debug logging, this is the only relevant info I could find:

2020-12-08 23:33:43 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry PyLoxone for loxone
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/http3/concurrency.py", line 204, in connect
    stream_reader, stream_writer = await asyncio.wait_for(  # type: ignore
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 498, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests_async/adapters.py", line 48, in send
    response = await self.pool.request(
  File "/usr/local/lib/python3.8/site-packages/http3/interfaces.py", line 49, in request
    return await self.send(request, verify=verify, cert=cert, timeout=timeout)
  File "/usr/local/lib/python3.8/site-packages/http3/dispatch/connection_pool.py", line 130, in send
    raise exc
  File "/usr/local/lib/python3.8/site-packages/http3/dispatch/connection_pool.py", line 120, in send
    response = await connection.send(
  File "/usr/local/lib/python3.8/site-packages/http3/dispatch/connection.py", line 53, in send
    await self.connect(verify=verify, cert=cert, timeout=timeout)
  File "/usr/local/lib/python3.8/site-packages/http3/dispatch/connection.py", line 81, in connect
    reader, writer, protocol = await self.backend.connect(
  File "/usr/local/lib/python3.8/site-packages/http3/concurrency.py", line 209, in connect
    raise ConnectTimeout()
http3.exceptions.ConnectTimeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/loxone/__init__.py", line 247, in async_setup_entry
    request_code = await lox_config.getJson()
  File "/config/custom_components/loxone/__init__.py", line 109, in getJson
    version_resp = await requests.get(url_version,
  File "/usr/local/lib/python3.8/site-packages/requests_async/api.py", line 11, in get
    return await request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests_async/api.py", line 6, in request
    return await session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests_async/sessions.py", line 79, in request
    resp = await self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests_async/sessions.py", line 136, in send
    r = await adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests_async/adapters.py", line 60, in send
    raise ConnectTimeout(err, request=request)
requests.exceptions.ConnectTimeout
robinheymans commented 3 years ago

It looks like HASS (or the PyLoxone) isn't picking up my updated configuration in configuration.yaml. I've added a debug log statement in api.py -> getJson(..) logging the host, password, lox_user and lox_user. The values logged are the ones I used when first running this component. Are these values perhaps cached somewhere?

robinheymans commented 3 years ago

I've managed to start the component by hardcoding my configuration. After removing the PyLoxone integration from the UI, HASS picked up the correct configuration!