JoDehli / PyLoxone

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

Error setting up entry PyLoxone for loxone #65

Closed MarioGl88 closed 3 years ago

MarioGl88 commented 3 years ago

Hello,

I would like to connect my Lox MiniServer Gen2 to the HA, now I have following Problem. I installed the HA OS and HACS, after this I installed the FileEditor and the PyLoxone SW. I have added the Login to configuration.yaml, after a restart I get the error message below. I have already changed the IP from the HA, the last 24h was the HA disconnected, I tried different logins and Ports. The MiniServer Gen2 has the FW version 12.0.2.24, its the latest version.

I added following code to configuration.yaml:

loxone: port: 80 host: http://dns.loxonecloud.com/504F**** username: User password: ***** generate_scenes: false # default is true generate_scenes_delay: 5 generate_lightcontroller_subcontrols: true

in some issues is something written from a file which named ...token and this one should be saved in the config Folder, but on my HA is no File saved with this or a similar name.

i have tried as well the last four versions from PyLoxone including the newest Beta version.

I can connect to the site with the json file without any problem, the connection from outside is working as well.

thanks

BR

Mario

benutzerdefinierte

Logger: homeassistant.config_entries Source: custom_components/loxone/api.py:60 Integration: PyLoxone (documentation, issues) First occurred: 22:32:40 (1 occurrences) Last logged: 22:32:40

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 269, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/loxone/init.py", line 132, in async_setup_entry if not await miniserver.async_setup(): File "/config/custom_components/loxone/miniserver.py", line 101, in async_setup request_code = await self.lox_config.getJson() File "/config/custom_components/loxone/api.py", line 60, in getJson api_resp = await requests.get(url_api, 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 443, in next_event exc._reraise_as_remote_protocol_error() File "/usr/local/lib/python3.8/site-packages/h11/_util.py", line 76, 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

Can you try the newest version from hacs (0.3.5)? Please do not use the yaml anymore. Configure over the integration menu. It seams that your Pyloxone does not reach the loxone at all. In this case no token file can be created.

MarioGl88 commented 3 years ago

Hello, thanks for the answer.

I tried it on this way and it works fine :)