guerrerotook / securitas-direct-new-api

This repository contains the new securitas direct API that can be integrated in Home Assistant
Apache License 2.0
79 stars 30 forks source link

Integration Broken. Fail to setup after home assistant restart. #99

Closed fulviomeomartini closed 1 year ago

fulviomeomartini commented 1 year ago

Hi, I'm having constant problems with this integration. First the minor problem, that i can't disarm the custombypass zone (perimeters). I have tried many solutions, and in order not to be left without the possibility of disarming each state, the best solution I have found is this: [https://github.com/guerrerotook/securitas-direct-new-api/issues/90#issuecomment-1310146296](url) Second thing: every time i restart home assistant the integration fails to reload. Here are the logs:

Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: homeassistant.config_entries Source: custom_components/securitas/securitas_direct_new_api/apimanager.py:120 Integration: Securitas Direct (documentation, issues) First occurred: 14:40:46 (1 occurrences) Last logged: 14:40:46

Error setting up entry fulviomeomartini for securitas Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1154, in _create_direct_connection hosts = await asyncio.shield(host_resolved) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 880, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) File "/usr/local/lib/python3.10/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( File "/usr/local/lib/python3.10/asyncio/base_events.py", line 860, in getaddrinfo return await self.run_in_executor( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/securitas/init.py", line 161, in async_setup_entry result = await client.login() File "/config/custom_components/securitas/init.py", line 330, in login succeed: tuple[bool, str] = await self.session.login() File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 279, in login response: ClientResponse = await self._execute_request(content, "mkLoginToken") File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 120, in _execute_request async with self.http_client.post( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in aenter self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host customers.verisure.it:443 ssl:default [Try again]

I hope someone can help me. ps my installation is in Italy

thanks in advance

fulviomeomartini commented 1 year ago

other logs:

2022-12-12 15:25:59.683 INFO (MainThread) [homeassistant.setup] Setting up securitas 2022-12-12 15:25:59.683 INFO (MainThread) [homeassistant.setup] Setup of domain securitas took 0.0 seconds 2022-12-12 15:26:05.422 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry fulviomeomartini for securitas File "/config/custom_components/securitas/init.py", line 161, in async_setup_entry File "/config/custom_components/securitas/init.py", line 330, in login File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 279, in login File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 120, in _execute_request

guerrerotook commented 1 year ago

In this error, the exception is this:

Cannot connect to host customers.verisure.it:443 ssl:default

So, can you check that you can access this url in your pc?

fulviomeomartini commented 1 year ago
Screenshot 2022-12-29 alle 21 19 34

yes, it works via browser

guerrerotook commented 1 year ago

Then I don't know what else to look at. The original message is that the Home Assistant can't connect to the API. Closing for now this issue. If in the future appears we can take a look again!