JoDehli / PyLoxone

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

Error setting up entry PyLoxone for loxone #45

Closed shilex147 closed 3 years ago

shilex147 commented 3 years ago

Hey,

When i restart HA i get this error, i already tried to reinstall the plugin but no success. Also tried to make a new account to be sure but same error

Error setting up entry PyLoxone for loxone 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 122, in async_setup_entry res = await lox.async_init() File "/config/custom_components/loxone/api.py", line 320, in asyncinit = await self._ws.recv() File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 509, in recv await self.ensure_open() File "/usr/local/lib/python3.8/site-packages/websockets/protocol.py", line 812, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedOK: code = 1000 (OK), reason = normally closed

JoDehli commented 3 years ago

Please give more info's! Did the error occur after a update? Or did it never connect? Can you connect via Loxone App? Which port do you use?

shilex147 commented 3 years ago

It never connected, yes i can connect with the Loxone app, port 80

JoDehli commented 3 years ago

Try a different port then 80 maybe 8080.

shilex147 commented 3 years ago

i just did that and i get a different error, but it looks like he is still trying to connect to port 80

Error setting up entry PyLoxone for loxone 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 204, in connect stream_reader, stream_writer = await asyncio.wait_for( # type: ignore File "/usr/local/lib/python3.8/asyncio/tasks.py", line 491, in wait_for return fut.result() File "/usr/local/lib/python3.8/asyncio/streams.py", line 52, in openconnection transport, = await loop.create_connection( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection raise exceptions[0] File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection sock = await self._connect_sock( File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect return await fut File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.120', 80)

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 110, in async_setup_entry request_code = await lox_config.getJson() File "/config/custom_components/loxone/api.py", line 54, 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 58, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: [Errno 111] Connect call failed ('192.168.1.120', 80)

shilex147 commented 3 years ago

oh not sure that it matters but i have the new version off mini server with the build in Tree module

JoDehli commented 3 years ago

Have restart HomeAssistant after changing the port?

shilex147 commented 3 years ago

Yes i even tested with a new install of HA. Did you ever had feedback off a user connecting the new MiniServer?

JoDehli commented 3 years ago

No I think the new Version is not supported because it communicates with TLS.

shilex147 commented 3 years ago

is there something we can do about it? I am more then willing to test some stuff if you want

shilex147 commented 3 years ago

I just disabled the SSL certificate and now get a new error btw

2020-12-29 14:32:23 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/h11/_state.py", line 249, in _fire_event_triggered_transitions new_state = EVENT_TRIGGERED_TRANSITIONS[role][state][event_type] KeyError: <class 'h11._events.ConnectionClosed'> 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 110, in async_setup_entry request_code = await lox_config.getJson() File "/config/custom_components/loxone/api.py", line 54, 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 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 59, in send response = await self.h11_connection.send(request, timeout=timeout) File "/usr/local/lib/python3.8/site-packages/http3/dispatch/http11.py", line 58, in send http_version, status_code, headers = await self._receive_response(timeout) File "/usr/local/lib/python3.8/site-packages/http3/dispatch/http11.py", line 130, in _receive_response event = await self._receive_event(timeout) File "/usr/local/lib/python3.8/site-packages/http3/dispatch/http11.py", line 161, in _receive_event event = self.h11_state.next_event() File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 444, in next_event exc._reraise_as_remote_protocol_error() File "/usr/local/lib/python3.8/site-packages/h11/_util.py", line 80, in _reraise_as_remote_protocol_error raise self File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 427, in next_event self._process_event(self.their_role, event) File "/usr/local/lib/python3.8/site-packages/h11/_connection.py", line 242, in _process_event self._cstate.process_event(role, type(event), server_switch_event) File "/usr/local/lib/python3.8/site-packages/h11/_state.py", line 238, in process_event self._fire_event_triggered_transitions(role, event_type) File "/usr/local/lib/python3.8/site-packages/h11/_state.py", line 251, in _fire_event_triggered_transitions raise LocalProtocolError( h11._util.RemoteProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

JoDehli commented 3 years ago

Do you get the json config?

Try this in your browser:

http://192.168.1.225:8080/data/LoxAPP3.json

change the ip adress and port! Do you get the json?

shilex147 commented 3 years ago

Yes i do

JoDehli commented 3 years ago

I think I can not help you with this problem. I can not implement it because I have no Loxone Minserver v2 available. Can you implement it by yourself?

shilex147 commented 3 years ago

No i have no coding expierence, if you want i can make you a virtual machine with access to my miniserver if that would help?

JoDehli commented 3 years ago

But I need access to you miniserver and some developer tools installed (Ide, python, homeassistant).

shilex147 commented 3 years ago

i can setup all that, do you have discord or something to chat?

JoDehli commented 3 years ago

I have discord but I used it 2 or 3 times :-) not much experience what do you need?

shilex147 commented 3 years ago

add me as a friend shilex#5389 If you cant find how to add me you can always join this server :p https://discord.gg/NaYQXN9F

JoDehli commented 3 years ago

I think we can close this issue. The new gen2 is now supported.

thomasbonte commented 3 years ago

I encountered the exact same issue with Home Assistant 2021.3.3/4 and a 1g Miniserver. It had been working well for over a year, and after installing another integration this problem started to occur. When I disabled/deleted the integration, things went back to normal. I just wanted to share this.

xris99 commented 3 years ago

I encountered the exact same issue with Home Assistant 2021.3.3/4 and a 1g Miniserver. It had been working well for over a year, and after installing another integration this problem started to occur. When I disabled/deleted the integration, things went back to normal. I just wanted to share this.

OK, I still get the exact error message as in the first post with version 0.3.4. and current Home Assistant version. No difference if I connect through dns.loxonecloud (Port 80) or directly on public ip (and public port). Which other integration did you install and disabled to get it working?