guerrerotook / securitas-direct-new-api

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

Support for new alarm "SDVECUW" #19

Open fjaraujo opened 2 years ago

fjaraujo commented 2 years ago

Hi,

my installation has been migrated to a new model of alarm, identified with panel code "SDVECUW" instead of "SDVFAST". This new model is being proposed by the moment to customers with old installations (SD2000) and it seems that in the future all the customers will be moved to this.

Login is failing in this case. I have another installation with SDVFAST and works ok. Both installations are owned by different user accounts, because according with customer support is not possible to have together both types of alarms. HomeAssistant records says:

"Hemos tenido problemas para identificarle, por favor, cierre la sesión y vuelva a iniciarla. status 500 reading RemoteServicesFeignClient#getMain(Map,MultiValueMap)"

Anyway, I am capable to manage the new model from the website.

I will investigate a little bit on the code...

Thanks!

fjaraujo commented 2 years ago

More info about the errors:

{'errors': [{'message': 'Hemos tenido problemas para identificarle, por favor, cierre la sesión y vuelva a iniciarla.', 'name': 'ApiError', 'time_thrown': '2022-01-10T20:24:50.140Z', 'data': {'res': 'ERROR', 'err': '60067'}, 'path': ['xSCheckAlarm']}], 'data': {'xSCheckAlarm': None}} {'errors': [{'message': 'status 500 reading RemoteServicesFeignClient#getMain(Map,MultiValueMap)', 'name': 'ApiError', 'time_thrown': '2022-01-10T20:24:51.230Z', 'data': {'res': 'ERROR', 'err': '60067'}, 'path': ['xSCheckAlarmStatus']}], 'data': {'xSCheckAlarmStatus': None}}

Do you know how to force both calls in the website?

guerrerotook commented 2 years ago

I think this information is returned by the API itself, when I'm listing the installations, so maybe I can get the type of alarm from there instead of having that as a constant in the API. Thanks for the heads up.

fjaraujo commented 2 years ago

I think there is something else. With this alarm, the website hasn't the option "Actualizar estado". The status is received using only xsStatus function. I am afraid that xsCheckAlarm is not available for this alarm, or it is different, and not possible to catch it using the web. Could be avoided in your code?

guerrerotook commented 2 years ago

I see, I can create a type of alarm to change the code flow logic in case that we can support this new type of alarm.

fjaraujo commented 2 years ago

that would be great! Thanks.

guerrerotook commented 2 years ago

I just check the code and in the check_alarm_status I already sending whatever panel property I get from the installations. So that's mean that the new value SDVECUW is being sent to the API instead of the SDVFAST in my case.

So right now, I don't know what to do. Do you mind capturing the API interaction in the web application by following these guides?

https://github.com/guerrerotook/securitas-direct-new-api/tree/main/docs

Before posting them here make sure that you remove personal information like username, password, installation id, etc.

If you need help let me know. You need to know how to use the Developer Extension in your browser.

guerrerotook commented 2 years ago

I just check the code and in the check_alarm_status I already sending whatever panel property I get from the installations. So that's mean that the new value SDVECUW is being sent to the API instead of the SDVFAST in my case.

So right now, I don't know what to do. Do you mind capturing the API interaction in the web application by following these guides?

https://github.com/guerrerotook/securitas-direct-new-api/tree/main/docs

Before posting them here make sure that you remove personal information like username, password, installation id, etc.

If you need help let me know. You ned to know how to use the Developer Extension in your browser.

fjaraujo commented 2 years ago

Hi Luis, I think the problem is that for this alarm, the xSCheckAlarmStatus method is not available. The link "actualizar estado" is not visible on the frontend, the only method used to update the status is xSStatus. I checked this with the developer extension in the browser.

I have uncommented the following lines on _init__py to bypass the call during the setup, and with this I have the alarm panel running: status: SStatus = self.session.check_general_status(installation) return CheckAlarmStatus( "OK", "OK", "Ok", installation.number, status.status, status.timestampUpdate )

Arm and Disarm operations are now runnning ok, but after call them the status is not updated inmediately, the update comes after a while.

One solution I think could be to use only checkGeneralStauts function, but I don't know if this has other impact on the other alarm model.

ZZJHONS commented 1 year ago

I got this new panel too and tried to catch some loads following the docs, let me know what you need.

I also saw that in the payload I get a base64 image of the new photodetector, we could capture the request API call to add this to the Home Assistant dashboard.

sesardelaisla commented 1 year ago

Just FYI, today I got the same error for the first time ever upon arming my alarm. I still have the same device as always. Just saying in case this error is not exactly related with the device migration that @fjaraujo is stating. However, my alarm was armed correctly despite the error notification.

98C51E14-320C-46A0-A389-DC1258115C3F