guerrerotook / securitas-direct-new-api

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

Cannot configure #219

Closed finamix closed 4 months ago

finamix commented 4 months ago

Hi all!

i cannot configure the integration. It working quite well until this last update. would be glad to receive your help on this one. I got the following log:

Logger: aiohttp.server Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421 First occurred: 9:14:22 PM (1 occurrences) Last logged: 9:14:22 PM

Error handling request Traceback (most recent call last): File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 323, in login response = await self._execute_request(content, "mkLoginToken") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 170, in _execute_request raise SecuritasDirectError( custom_components.securitas.securitas_direct_new_api.exceptions.SecuritasDirectError: ('The username or password that you have entered is incorrect', {'errors': [{'message': 'The username or password that you have entered is incorrect', 'name': 'ApiError', 'time_thrown': '2024-03-19T21:14:22.267Z', 'data': {'res': 'KO', 'err': '60091'}, 'path': ['xSLoginToken']}], 'data': {'xSLoginToken': None}}, {'app': '{"appVersion": "10.102.0", "origin": "native"}', 'User-Agent': 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.41', 'X-APOLLO-OPERATION-ID': '55b5967d4a605bf08f94f4797a00e86f18705c71f3b3a36e8703a37a7fc311ba226f0aaa83eea543e7bd08363173b5861168e7bcd0a277051625f3ad8b03781e', 'X-APOLLO-OPERATION-NAME': 'mkLoginToken', 'extension': '{"mode":"full"}', 'auth': '{"loginTimestamp": 0, "user": "xxxxxxxxx", "id": "OWAxxxxxxxxx2024319211427491", "country": "PT", "lang": "en", "callby": "OWA_10", "hash": null}'}, {'operationName': 'mkLoginToken', 'variables': {'user': 'xxxxxxxxx', 'password': 'xxxxxx!', 'id': 'OWAxxxxxxxxxx2024319211427339', 'country': 'PT', 'callby': 'OWA_10', 'lang': 'en', 'idDevice': '39c122a3434349f9', 'idDeviceIndigitall': '', 'deviceType': '', 'deviceVersion': '10.102.0', 'deviceResolution': '', 'deviceName': 'SM-S901U', 'deviceBrand': 'samsung', 'deviceOsVersion': '12', 'uuid': '39c122a3434349f9'}, 'query': 'mutation mkLoginToken($user: String!, $password: String!, $id: String!, $country: String!, $lang: String!, $callby: String!, $idDevice: String!, $idDeviceIndigitall: String!, $deviceType: String!, $deviceVersion: String!, $deviceResolution: String!, $deviceName: String!, $deviceBrand: String!, $deviceOsVersion: String!, $uuid: String!) { xSLoginToken(user: $user, password: $password, country: $country, lang: $lang, callby: $callby, id: $id, idDevice: $idDevice, idDeviceIndigitall: $idDeviceIndigitall, deviceType: $deviceType, deviceVersion: $deviceVersion, deviceResolution: $deviceResolution, deviceName: $deviceName, deviceBrand: $deviceBrand, deviceOsVersion: $deviceOsVersion, uuid: $uuid) { __typename res msg hash refreshToken legals changePassword needDeviceAuthorization mainUser } }'})

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

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 25, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 68, in handle result = await handler(request, request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 197, in post return await super().post(request, flow_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post result = await self._flow_mgr.async_configure(flow_id, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in async_configure result = await self._async_configure(flow_id, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 405, in _async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 502, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/securitas/config_flow.py", line 103, in async_step_otp_challenge return await self.finish_setup() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/securitas/config_flow.py", line 107, in finish_setup await self.securitas.login() File "/config/custom_components/securitas/init.py", line 353, in login await self.session.login() File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 332, in login raise LoginError(err.args) from err custom_components.securitas.securitas_direct_new_api.exceptions.LoginError: ('The username or password that you have entered is incorrect', {'errors': [{'message': 'The username or password that you have entered is incorrect', 'name': 'ApiError', 'time_thrown': '2024-03-19T21:14:22.267Z', 'data': {'res': 'KO', 'err': '60091'}, 'path': ['xSLoginToken']}], 'data': {'xSLoginToken': None}}, {'app': '{"appVersion": "10.102.0", "origin": "native"}', 'User-Agent': 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.41', 'X-APOLLO-OPERATION-ID': '55b5967d4a605bf08f94f4797a00e86f18705c71f3b3a36e8703a37a7fc311ba226f0aaa83eea543e7bd08363173b5861168e7bcd0a277051625f3ad8b03781e', 'X-APOLLO-OPERATION-NAME': 'mkLoginToken', 'extension': '{"mode":"full"}', 'auth': '{"loginTimestamp": 0, "user": "xxxxxxxxxx", "id": "OWAxxxxxxx2024319211427491", "country": "PT", "lang": "en", "callby": "OWA_10", "hash": null}'}, {'operationName': 'mkLoginToken', 'variables': {'user': 'xxxxxxxx', 'password': 'xxxxxxxxx!', 'id': 'OWAxxxxxxxx2024319211427339', 'country': 'PT', 'callby': 'OWA_10', 'lang': 'en', 'idDevice': '39c122a3434349f9', 'idDeviceIndigitall': '', 'deviceType': '', 'deviceVersion': '10.102.0', 'deviceResolution': '', 'deviceName': 'SM-S901U', 'deviceBrand': 'samsung', 'deviceOsVersion': '12', 'uuid': '39c122a3434349f9'}, 'query': 'mutation mkLoginToken($user: String!, $password: String!, $id: String!, $country: String!, $lang: String!, $callby: String!, $idDevice: String!, $idDeviceIndigitall: String!, $deviceType: String!, $deviceVersion: String!, $deviceResolution: String!, $deviceName: String!, $deviceBrand: String!, $deviceOsVersion: String!, $uuid: String!) { xSLoginToken(user: $user, password: $password, country: $country, lang: $lang, callby: $callby, id: $id, idDevice: $idDevice, idDeviceIndigitall: $idDeviceIndigitall, deviceType: $deviceType, deviceVersion: $deviceVersion, deviceResolution: $deviceResolution, deviceName: $deviceName, deviceBrand: $deviceBrand, deviceOsVersion: $deviceOsVersion, uuid: $uuid) { __typename res msg hash refreshToken legals changePassword needDeviceAuthorization mainUser } }'})

cantupaz commented 4 months ago

This is the problem: "The username or password that you have entered is incorrect"

finamix commented 4 months ago

I know the log is retrieving that comment, but in fact the username and password used are the same as i used before. The system was logged on, configured and connected, and as soon as I upgraded the app, it just lost connection. I will try again and upload the log again

thanks for your help.

cantupaz commented 4 months ago

Try the username and password in the official app first, just to make sure. I've been able to use old passwords for many days before Securitas picks up that I actually changed my password.

Apollon16 commented 4 months ago

Try the username and password in the official app first, just to make sure. I've been able to use old passwords for many days before Securitas picks up that I actually changed my password.

Hello, I confirm the problem comes from the password which had to be reset at Verisure. For over a week I had the same problem, unable to connect. Using Face ID on the phone app, I didn't notice my Verisure password was deactivated. Now everything is back to normal.

cantupaz commented 4 months ago

Thanks for the update. Closing.