fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
902 stars 73 forks source link

Port Conflict with Z-Wave JS Integration - Need to Change Port for Eufy Security #1016

Closed Blacksly closed 10 months ago

Blacksly commented 10 months ago

Hello,

I'm experiencing a port conflict on my Home Assistant installation between the Eufy Security integration and Z-Wave JS integration, with both attempting to use port 3000. This results in a connection error for Z-Wave JS stated as Failed to connect: Cannot connect to host core-zwave-js:3000 ssl:default [Connect call failed ('172.30.33.2', 3000)].

I would prefer not to modify the Z-Wave JS configuration and would like to change the port used by the Eufy Security integration. I attempted to change the port by editing the /config/custom_components/eufy_security/model.py file to set port = 4000, but this does not appear to resolve the issue.

I suspect there might be interference with Z-Wave, although I'm not certain. The issue arises when I try to open the Eufy Security integration with the default information.

Could you please guide me on how to change the port used by Eufy Security integration or confirm if there's a configuration option that I may have missed?

Thank you for your assistance and time.

Additional information

Go to Settings -> System -> Repairs -> Click on 3 dots (...) -> System Information and get Version and Installation Type to below fields;

Blacksly commented 10 months ago

Hello!

I tried again with a VM installation following the Home assistant virtualBox tutorial. So fresh installation, I put back HACS then eufySecurity and there, still the same! So nothing to do with a port conflkit after all, or maybe I'm misunderstanding ... Here's the complete error:

`Logger: custom_components.eufy_security.config_flow Source: custom_components/eufy_security/config_flow.py:130 Integration: Eufy Security (documentation, issues) First occurred: 11:35:06 (1 occurrences) Last logged: 11:35:06

eufy_security Exception in login : Connection to add-on was broken. please reload the integration! - traceback: 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 1085, in create_connection raise exceptions[0] File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect return await fut ^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 3000) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 42, in connect self.socket = await self.session.ws_connect(f"ws://{self.host}:{self.port}", autoclose=False, autoping=True, heartbeat=60) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 779, in _ws_connect resp = await self.request( ^^^^^^^^^^^^^^^^^^^ 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 127.0.0.1:3000 ssl:default [Connect call failed ('127.0.0.1', 3000)] The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/eufy_security/config_flow.py", line 126, in _test_credentials await api_client.ws_connect() File "/config/custom_components/eufy_security/eufy_security_api/api_client.py", line 66, in ws_connect await self._client.connect() File "/config/custom_components/eufy_security/eufy_security_api/web_socket_client.py", line 44, in connect raise WebSocketConnectionException("Connection to add-on was broken. please reload the integration!") from exc custom_components.eufy_security.eufy_security_api.exceptions.WebSocketConnectionException: Connection to add-on was broken. please reload the integration!`

fuatakgun commented 10 months ago

Add-on and integration can work any available port depending on your needs

Just set up a different port and set up the integration accordingly. I have running two instances on 3000 and 3001 at the same time. But you have to either remove/add back the integration to set the port or play with dangerous yaml files.

The logs do not say anything other than no connection, so i cannot help at all.