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

Alarm & Disarm doesnt't work #125

Closed gtapps closed 8 months ago

gtapps commented 1 year ago

Hey guys, I've been using this package and seems like lately there has been a issue with arming & disarming.

Status update still works fine.

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/securitas/alarm_control_panel.py:209 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 11:34:32 AM (2 occurrences) Last logged: 11:37:20 AM

[1540755024] 'str' object has no attribute 'operation_status'
[1535844040] 'str' object has no attribute 'operation_status'

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 961, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 726, in _handle_entity_call await result File "/config/custom_components/securitas/alarm_control_panel.py", line 330, in async_alarm_arm_away await self.set_arm_state("ARM1") File "/config/custom_components/securitas/alarm_control_panel.py", line 209, in set_arm_state while arm_status.operation_status == "WAIT": AttributeError: 'str' object has no attribute 'operation_status'

guerrerotook commented 1 year ago

Those kind of exceptions are related with the API. Something happen when arming and disarming and the json returned by the API is not something that the integration expected, that is why we had the exception. You can enable the DEBUG log for the integration to see the json output so we can determine what is the issue.

montoyra commented 1 year ago

My behaviour is the same:

2023-09-05 16:54:34.244 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140525396645440] 'str' object has no attribute 'operation_status' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/securitas/alarm_control_panel.py", line 325, in async_alarm_arm_home await self.set_arm_state("ARMDAY1") File "/config/custom_components/securitas/alarm_control_panel.py", line 209, in set_arm_state while arm_status.operation_status == "WAIT": ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'operation_status'

montoyra commented 1 year ago

Hola,

For Arming the integration solve after somo physical maintenance from part of securitas. But I continue with Disarm not working: the log is the following:

2023-09-06 20:34:19.649 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140512996428352] invalid literal for int() with base 10: '' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/securitas/alarm_control_panel.py", line 313, in async_alarm_disarm code = int(code) ^^^^^^^^^

nrovlq commented 11 months ago

same here : cannot arm/disarm

(new installation) version securitas-direct-new-api : v2.4.0.1 HACS version Version de l'intégration: | 1.33.0 Version de l'interface: | 20220906112053 HA OS : Home Assistant 2023.10.5 Supervisor 2023.10.1 Operating System 11.1 Interface utilisateur : 20231005.0 - latest

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:226 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 16:28:28 (1 occurrences) Last logged: 16:28:28

[139819355425600] 'str' object has no attribute 'operation_status' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2049, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/securitas/alarm_control_panel.py", line 344, in async_alarm_arm_home await self.set_arm_state("ARMDAY1") File "/config/custom_components/securitas/alarm_control_panel.py", line 211, in set_arm_state if arm_status.operation_status == "ERROR": ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'operation_status'

and also could be related , looks faily unstable with token auth ?

Cette erreur provient d'une intégration personnalisée

Logger: custom_components.securitas.securitas_direct_new_api.apimanager Source: custom_components/securitas/securitas_direct_new_api/apimanager.py:159 Integration: Securitas Direct (documentation, issues) First occurred: 16:36:36 (6 occurrences) Last logged: 16:39:50

Merci de vous déconnecter et de vous connecter à nouveau à l'application Internal Server Error

cantupaz commented 8 months ago

There was a recent rewrite of the code that should have addressed this. Closing. Please reopen if there's still a problem.