Giter Site home page Giter Site logo

Comments (20)

bvis avatar bvis commented on August 11, 2024 1

Hi, now I have had some time for doing this. It was so easy because all the calls are as you said between the browser and the backend:

First request:

{
   "operationName":"xSArmPanel",
   "variables":{
      "request":"PERI1",
      "numinst":"XXXX",
      "panel":"SDVFAST",
      "currentStatus":"D"
   },
   "query":"mutation xSArmPanel($numinst: String!, $request: ArmCodeRequest!, $panel: String!, $pin: String, $currentStatus: String) {\n  xSArmPanel(numinst: $numinst, request: $request, panel: $panel, pin: $pin, currentStatus: $currentStatus) {\n    res\n    msg\n    referenceId\n  }\n}\n"
}

First response:

{
   "data":{
      "xSArmPanel":{
         "res":"OK",
         "msg":"Su solicitud ha sido enviada",
         "referenceId":"XXXX"
      }
   }
}

Polling request:

{
   "operationName":"ArmStatus",
   "variables":{
      "request":"PERI1",
      "numinst":"XXXX",
      "panel":"SDVFAST",
      "currentStatus":"D",
      "referenceId":"YYYY",
      "counter":1
   },
   "query":"query ArmStatus($numinst: String!, $request: ArmCodeRequest, $panel: String!, $referenceId: String!, $counter: Int!) {\n  xSArmStatus(numinst: $numinst, panel: $panel, referenceId: $referenceId, counter: $counter, request: $request) {\n    res\n    msg\n    status\n    protomResponse\n    protomResponseDate\n    numinst\n    requestId\n    error {\n      code\n      type\n      allowForcing\n      exceptionsNumber\n      referenceId\n    }\n  }\n}\n"
}

Polling first response:

{
   "data":{
      "xSArmStatus":{
         "res":"WAIT",
         "msg":"Petición en proceso",
         "status":null,
         "protomResponse":null,
         "protomResponseDate":null,
         "numinst":null,
         "requestId":"_pollingStatus_56613",
         "error":null
      }
   }
}

Final response:

{
   "data":{
      "xSArmStatus":{
         "res":"OK",
         "msg":"La zona exterior ha sido conectada",
         "status":"3",
         "protomResponse":"E",
         "protomResponseDate":"2022-01-07 22:38:22.306",
         "numinst":"XXXX",
         "requestId":"_pollingStatus_57119",
         "error":null
      }
   }
}

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024 1

Awesome! Let me work on that tomorrow!

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024 1

I added the support for the PERI1 type of alarm in this commit, can you download and test it and tell me if it works?

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024 1

Related to this I've created this PR: #16

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024 1

Yeah, I'm looking forward in how to add custom attributes to an entity so I can add more information. I'm going to investigate this.

from securitas-direct-new-api.

sion-roberts avatar sion-roberts commented on August 11, 2024

Thanks for this. I am a total noob to HA, Python etc. so I have a lot to learn. I DID get it working, so am really thrilled. +1 for any feature requests - Annex (secondary) alarm would be great, and I can't see how to set Partial Day/Night... I will keep exploring.

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024

Thanks @bvis for the feature request. How I write the api was by opening the https://customers.securitasdirect.es/owa-static/login web application and logging calls to the /owa-api/graphql with the json payload.

If you need help let me know and we can work on getting those logs.

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

When only the perimetral alarm is activated the request/answer is like this:

{
   "operationName":"CheckAlarmStatus",
   "variables":{
      "numinst":"XXXXX",
      "panel":"SDVFAST",
      "referenceId":"XXXX",
      "idService":"11",
      "counter":3
   },
   "query":"query CheckAlarmStatus($numinst: String!, $idService: String!, $panel: String!, $referenceId: String!) {\n  xSCheckAlarmStatus(numinst: $numinst, idService: $idService, panel: $panel, referenceId: $referenceId) {\n    res\n    msg\n    status\n    numinst\n    protomResponse\n    protomResponseDate\n  }\n}\n"
}

After some WAITS, the final answer:

{
   "data":{
      "xSCheckAlarmStatus":{
         "res":"OK",
         "msg":"Tu Alarma está conectada en el exterior",
         "status":"3",
         "numinst":"XXXX",
         "protomResponse":"E",
         "protomResponseDate":"2022-01-07 22:56:47.126"
      }
   }
}

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

Other statuses are:

{
   "operationName":"CheckAlarmStatus",
   "variables":{
      "numinst":"XXXXX",
      "panel":"SDVFAST",
      "referenceId":"YYYYY",
      "idService":"11",
      "counter":3
   },
   "query":"query CheckAlarmStatus($numinst: String!, $idService: String!, $panel: String!, $referenceId: String!) {\n  xSCheckAlarmStatus(numinst: $numinst, idService: $idService, panel: $panel, referenceId: $referenceId) {\n    res\n    msg\n    status\n    numinst\n    protomResponse\n    protomResponseDate\n  }\n}\n"
}

{
   "data":{
      "xSCheckAlarmStatus":{
         "res":"OK",
         "msg":"Tu Alarma está conectada en modo Parcial Día y en el exterior",
         "status":"B",
         "numinst":"XXXXX",
         "protomResponse":"B",
         "protomResponseDate":"2022-01-07 23:01:45.716"
      }
   }
}

{
   "data":{
      "xSArmStatus":{
         "res":"OK",
         "msg":"Tu Alarma está conectada en modo Parcial Noche y en el exterior",
         "status":"C",
         "protomResponse":"C",
         "protomResponseDate":"2022-01-07 23:05:29.380",
         "numinst":"XXXXX",
         "requestId":"_pollingStatus_238933",
         "error":null
      }
   }
}

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

I’ll do it asap, tonight when I’m at home

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

When I pressed the CUSTOM BYPASS it has activated the "PERI" alarm! Nice!

But it's incorrectly seen in the panel:
image

In fact the current status is this one:
image
It seems it's displaying the different statuses wrongly.

When I press the ARMAR EN CASA button the status shown in the panel is this one:
image

And the real status is:
image

And when I press the button of ARMAR AUSENTE the other is activated, why seem to be switched by mistake, could it be?

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

On other hand it would be very useful, I don't know if it's possible, to have a "button" or activator to do a call to the remote system and update the status of the sensor. This way I could check the current status of the alarm in case I want to program an scenario or script, as it's very usual to change the status via the control panel we have in home.

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024

Thanks for the update on the perimeter alarm. I see what you mean when you said that is reporting the incorrect status.

Home Assistant define a set of possible status for the alarm, defined here.

The original code for the integration of the alarm used that custom state STATE_ALARM_ARMED_CUSTOM_BYPASS for the perimeter alarm. I don't know how to set a custom state for the panel.

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024

On other hand it would be very useful, I don't know if it's possible, to have a "button" or activator to do a call to the remote system and update the status of the sensor. This way I could check the current status of the alarm in case I want to program an scenario or script, as it's very usual to change the status via the control panel we have in home.

This is happening in the background automatically. I push a new changed in the alarm_control_panel.py file, please update and tell me if it fix the issue.

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

After this update now it's reported like this:
image

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

This is how it's seen:

image

AFAIK it should be in the state armed_custom_bypass, as I see in the possible status list:
https://developers.home-assistant.io/docs/core/entity/alarm-control-panel/#states

from securitas-direct-new-api.

guerrerotook avatar guerrerotook commented on August 11, 2024

Now I realized that there are three new states for when the perimeter is active,
"protomResponse":"C", Tu Alarma está conectada en modo Parcial Noche y en el exterior
"protomResponse":"B", Tu Alarma está conectada en modo Parcial Día y en el exterior
"protomResponse":"E", Tu Alarma está conectada en el exterior

So I pushed new changes to group all those changes into the CUSOM_BYPASS.

image

Here is the commit

Tell me how it looks like right now.

from securitas-direct-new-api.

bvis avatar bvis commented on August 11, 2024

Hi and thanks again for this, you are so responsive!

image

As you may see it right now show the "correct", based in the current limitations the alarm control panel card has. Thanks a lot for this!

One improvement which I think shouldn't be hard to do is to add an attribute to the current sensor with the obtained message, it contains the exact sentence like in my example: `"msg":"Tu Alarma está conectada en modo Parcial Noche y en el exterior".

It could be something like this, it would be very helpful because I could show the message below the alarm card to give me more information.

state: armed_custom_bypass
code_format: number
changed_by: null # I always see this as null, maybe it's a bug, IDK
code_arm_required: false
friendly_name: CASA
supported_features: 23
message: Tu Alarma está conectada en modo Parcial Noche y en el exterior

On other hand I suspect there's another protomResponse to add that I didn't add in my examples, when it's completely activated (AWAY+PERI).

This is answer I obtain when it's in this status:

{
   "data":{
      "xSArmStatus":{
         "res":"OK",
         "msg":"Tu Alarma está conectada en modo Total y en el exterior",
         "status":"4",
         "protomResponse":"A",
         "protomResponseDate":"2022-01-09 01:40:23.536",
         "numinst":"XXXXXXXX",
         "requestId":"_pollingStatus_244486",
         "error":null
      }
   }
}

from securitas-direct-new-api.

quentinreytinas avatar quentinreytinas commented on August 11, 2024

Hi,
Thanks for this work!
I can activate the exterior perimeter with arm_custombypass but I cannot disarm it... Even when I set with node red, alarm_arm_home and then alarm_arm_custombypass and after when I disarm with alarm_disarm, only the mode Home (or away) is disarmed and not the exterior perimeter. It stays armed.
What do I need to do to disarm the custombypass and not only the arm_away or arm_home ?
Thanks a lot!

from securitas-direct-new-api.

Javvaz avatar Javvaz commented on August 11, 2024

#71 It is the same that this issue.

from securitas-direct-new-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.