Securitas Direct (Verisure EU) Custom Component [TESTERS WANTED]

I do have the system on the left but it does not seemed to work.

Invalid config

The following integrations and platforms could not be set up:

  • securitas_direct

Please check your config.

Control configuration.yaml.

securitas_direct:
username: [email protected]
password: xxxxxxx
code: xxx
country: GB

Hi,

In username I don’t think the “@” character is accepted.
Also in my config file code line comes last (but that shouldn’t have any incidence)

Regards,

M

I have multiple account attached to my ID and i have been trying to get this component to work for me for a few months. I wanted to share what i found and what i got to work.

  1. Where there are mutiple accounts attached to your ID the first suggestion is to create a new user with admin access to the site which you are trying to access
  2. Login to verisure using the new ID created.
  3. Follow the above instructions suggested with custom_components and also with the config yaml.
  4. Restart Home Assistant and it shows no error. Find the alarm_control_panel and off you go

Overall this is better as if there are any problems with the alarm, you can see from the logs which user caused the issue, if any.

I have only had this operational for 24 hours and now i am trying to find out if the below is possible and if so how. Any help with this would be much appreciated

  1. See the state of individual sensors. Such as window/door closed or open
  2. Arm and disarm a secondary alarm only. I see Home Mode and Night Mode.
  3. Request images etc and send them as notifications in case of alarm being triggered.

Thank you

Ross

Hi Ross,

Unfortunately, this cannot be done. The Mobile API just allows to check the panel status, not the sensors. At the end you’re not interacting with the panel itself, just with the Securitas backend.

The Securitas backend just allows 5 kinds of arm/disarm operations:

  1. ARM: This means everything but the outside (perimeter sensors)
  2. PERI: This means just the perimeter.
  3. ARMNIGHT: Just those sensors that were configured as “Night Mode” when the technician was setting up the pannel.
  4. ARMDAY: Just those sensors that were configured as “Day Mode” when the technician was setting up the pannel.
  5. DISARM: This just disarms everything.

ARM, ARMDAY and ARMNIGHT are exclusive modes. You have either one or another.
PERI is optional and stand-alone, so you can arm this mode regardless of the state of ARM, ARMDAY or ARMNIGHT.
DISARM, as said, just disarms the whole thing, regardless of the states above. This means that you cannot actually for example go from PERI+ARMNIGHT to just PERI. You would need to disarm the whole thing and arm PERI again.

This can be done, but the code needs to be extended to fill that gap. I documented how to do it my API notes here:

https://github.com/Cebeerre/VerisureEUAPI

I’m certain that @segalion will be more than happy if you fork his github repository and contribute extending the code to make that happen ! :wink:

Xavi

Thanks @Cebeerre

It’s a shame they don’t send the specific sensors as these could really double up for so many other things. I appreciate you can only show what they allow us.

I actually have a “secondary alarm”. See screenshot.

This is different to the night and day. I also wouldn’t mind being able to see the status. I am happy to do some testing if this hasn’t been looked at before?

Would love to work on the images and will reach @segalion as I start work.

Seek to have time on my hands now and running out of things to do now

Hi @jezzard,

I assume these should be the modes ARMANNEX and DARMANNEX, but I don’t have this “Secondary Alarm”, so I wasn’t able to test it while reverse engineering the App.

Given that they always operate the same way, I guess the same routines that work with ARM1-2, PERI1-2 would work for ARMANNEX.

You could try using @segalion code in the CLI, as he already prepared the code to send any available command. Something like:

$ ./securitas.py username password ARMANNEX GB
$ ./securitas.py username password DARMANNEX GB

And see what the pannel/app does …

If it works and from here on, the custom component will need to be extended to be aware of the new status code and therefore be able to check the alarm status through the logs.

Seems quite straight forward …

BR,
Xavi

I could test, i have a second alarm, but i haven’t understood what to do…
i will try from CLI

I’m trying to execute from CLI, but i’m not able.
In the CLI from the directory securitas_direct I run

$ ./securitas.py username password DARMANNEX IT

but I got

can’t execute python3

Hi Xavi,

I like a lot of people seem to have a lot of time on my hands at the moment so i am determined to get this working.

Is there a reference to @segalion code for this. I have tried a few variations, setting in the app etc but not getting very far at all.
Any advice would be welcomed

Cheers

Ross

Hi @finix77,

Try with:

$ python ./securitas.py username password DARMANNEX IT

Or check first if you have the python interpreter in your path:

$ which python

and

$ python

You should get something like:

Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Hope that helps,
Xavi

Hi @jezzard,

Yes, seems that your prime minister has changed his mind and has finally decided to take some lockdown measures …

As @finix77, I’d try first to run the securitas.py in the component from the command line using the ANNEX stuff and see if the panel arms and disarms as expected.

If this works, some debugging will be needed to capture the status codes. Securitas uses IDs in the log to identify which mode is enabled. So in order to enable this in hass.io, this modes should be added up to the component using the proper status IDs.

Cheers,
Xavi

Hey @Cebeerre,

Still lokced down but a little further along.
Where do i need to look to set ARMANNEX and DARMANNEX from Home Assistant. I have looked in the custom component and can see they are listed under SC_ALARM but no idea from there. Can you or anyone point me in the right direction?

Thank you

Ross

Hi @jezzard,

All the tweaking should be done in the python script:

https://github.com/segalion/securitasdirect/blob/7df9338a8149f316353f40d0615ed10247eb0f6d/custom_components/securitas_direct/alarm_control_panel.py

As the securitas.py is just an API client.

You’ll need to add the new states, actions and status codes. Not sure though, how the integration should be done to make it work with the alarm panel card, as I’m not a hass.io user …

One of the important things you should do is understanding the status codes. As these are used to query the API logs and see the status of the alarm without asking the panel itself.

So, you’ll need to run the API client in the CLI and do something like:

$ ./verisure.py your_username your_password ARMANNEX

And check the output of:

./verisure.py your_username your_password ACT_V2

and look for status number. Then disarm:

./verisure.py your_username your_password DARMANNEX

At the end, you should be able to add a new status to this part of the code, so play arming in night mode, away, … and see the logs in ACT_V2 to identify the codes you need:

SECURITAS_STATUS = {
    STATE_ALARM_DISARMED: ['0',("1","32")],
    STATE_ALARM_ARMED_HOME: ['P',("311","202")],
    STATE_ALARM_ARMED_NIGHT: [('Q','C'),("46",)],
    STATE_ALARM_ARMED_AWAY: [('1','A'),("2","31")],
    STATE_ALARM_ARMED_CUSTOM_BYPASS: ['3',('204',)],
    STATE_ALARM_TRIGGERED: ['???',('13','24')],
}

Hope that helps.
Xavi

Hey Xavi,

I am a lot further along and thank you for your help.
One thing i did struggle with was the manifest needed to be updated to xmltodict rather than xml2dict in case anyone else finds the same. I saw someone else was having issues.

So we have our codes!!! In case anyone else needs them and can help me with the next steps… I know you do not use Home Assistant but i am hoping this gets someone else to pass me to the next step. Although i do have a lot of time to R and D at the moment :joy:

{
          "@alias": "Desarmado Anexo",
          "@type": "44",
          "@myverisureUser": "XX",
          "@device": "",
          "@source": "IPHONE",
          "@cost": "0",
          "@idsignal": "xx",
          "@time": "190409095629",
          "@img": "0",
          "@signaltype": "44"
        },
        {
          "@alias": "Armado Anexo",
          "@type": "43",
          "@myverisureUser": "XX",
          "@device": "",
          "@source": "IPHONE",
          "@cost": "0",
          "@idsignal": "XX",
          "@time": "190408200254",
          "@img": "0",
          "@signaltype": "43"
        },

So i take it we are working with 44 and 43?? As i did get a status response of “6” when i armed it? Just mentioning as i havent checked firing back using the relevant codes.

In theory the last piece should be easy but my only experience with the alarm panel has been this project but i have done quite a bit with HA.

Thank you @Cebeerre for your support with this. If anyone can help fill the gaps i would really appreciate it.

The only things i need to finalise is the 1. images and 2. I did see when in the CLI we could also see which sensor triggered an alarm (i think) as in the act_v2 i saw lots of “devices” which i can only assume are the sensors. The only reason i mention this is becuase earlier it was said the sensors could not be seen? Again any advice would bve really appreciated but i will continue to see what i can find.

Stay safe out there

Ross

Hi @jezzard !

Exactly, those are the status codes. But seems that your “annex” alarm works completely standalone of the rest, as it actually uses a different status code for the disarmed state, which is 0.

Given that the current lovelace alarm panel card just allows 4 states:

and the arm_custom_bypass, is being used for the perimeter, my guess is that you either ask or extend yourself the alarm card to support more states, or …

you add another panel card, and deploy another instance of the custom component (tweaking the status codes) to treat your annex state as if it was just a completely separated alarm panel.

Does that make sense ?

Xavi

Thanks Xavi @Cebeerre

I think I will go with the custom second alarm panel. It seems the simplest option.

To add a second custom component do I need to give it another name or change references anywhere? For example change securitas_direct to securitas_direct_annexe and would I need to update these in any of the files?

Thanks. We will get there!!

Cheers

Ross

Update. I have the second panel in ha
The issue i am having now is getting it to sync with the correct alarm / annexe

Hi all, did you also get invalid config after upgrading to 0.108?

Indeed, I assume you’d need to change all the references from securitas_direct to securitas_direct_annexe in config.yaml, manifest.json and __init__.py, so the secondary alarm is actually a different Domain.