segalion / securitasdirect Goto Github PK
View Code? Open in Web Editor NEWHome Assistant integration with Securitas Direct (AKA Verisure EU) and command line tool to interact with.
Home Assistant integration with Securitas Direct (AKA Verisure EU) and command line tool to interact with.
The logs say the integration failed to initialise. I live in the UK. I also added a version number in the manifest.json which made no difference.
Hello.
First, thank you for providing an interface with the spanish Securitas Direct user area and the integration with HA, this has brought some usability improvements to my alarm system and avoid me from scrapping it completely due to the lack of integrations available.
I'm currently using it with node-red instead HA automations, had to tweak some bits to make it work, but it finally works ok, and even reports the arming, disarming, armed statuses, sometimes the actions to the web site (via the script) fail, but since there is a sensor status update it doesn't matter (unless you want a real-time status update and it's not possible, the Securitas Web is very "flawed" (to say the least).
The problem is with the Alarm panel integration with HA, I know your example doesn't include a "code" section, but when I try to configure this alarm panel with that option, the update from the script to this component seems to delete all attributes, taking the code with it and thus, making the panel unusable for future actions.
Most probably you are aware of this issue (since the example avoid setting a code) but I wanted to point this out since it should be a great improvement to be able to use this with an access code.
Best regards.
Hi, can do you adapt this component as Homebridge Plugin?
Thanks in advance!!!
in the "alarm_control_panel.py" file
SECURITAS_STATUS = {
'0': STATE_ALARM_DISARMED,
'P': STATE_ALARM_ARMED_HOME,
'Q': STATE_ALARM_ARMED_NIGHT,
'1': STATE_ALARM_ARMED_AWAY
}
at least for Italy it appears to me:
SECURITAS_STATUS = {
'0': STATE_ALARM_DISARMED,
'Q': STATE_ALARM_ARMED_HOME,
'C': STATE_ALARM_ARMED_NIGHT,
'A': STATE_ALARM_ARMED_AWAY
}
Hi !
I was tryng to activate the "perimetral" mode of my alarm by Alarm panel but i couldnt
If I try that by command line like : $securitas.py user pass PERI it works perfectly.
Any ideas of integration in a alarm panel of HA? or any other solution to do in HA?
Thanks in advance
Please make your package HACS compatible. Makes updates so much more easier for N00bs like me.
Cheers.
In order to make a full integration with HA I believe the component api should be part of a third party library. Therefore, is it possible to start using https://github.com/Cebeerre/VerisureAPIClient?
I already asked for a repo name change (Cebeerre/pysecuritas#7)
Regards
Hi
I amt not really as ease for coding ..
As have an alarm system with an extra external sensors
that are independent on/off from House or Away Mode
So the number of status for my alarm should be for me :
states:
Do you have some tricks to add that options ?
Hi!
First, thanks for the great component, and the recent HACS support.
There's probably a new version of the app that is mandatory and has most probably changed some of the webservice calls used by the custom component.
When trying to arm or disarm the alarm via the control panel, I get this on the logs:
Securitas: disarming (res=OrderedDict([('PET', OrderedDict([('RES', 'ERROR'), ('ERR', '60060'), ('MSG', 'No hemos podido atender tu solicitud. Asegúrate de tener la última actualización de la app My Verisure. Si la incidencia persiste, por favor, contacta con nuestro servicio de Atención al cliente.'), ('NUMINST', 'xxxxxxx'), ('BLOQ', OrderedDict([('@remotereqactive', '1'), ('#text', 'Estamos mejorando nuestros servicios. Por favor intentelo de nuevo mas tarde. Gracias por confiar en Securitas Direct')]))]))]))
This is the ES region, which translates basically as "Please, get the latest version of the app My Verisure.
I just added the component and after rebooting Home assistant I got an error in the log saying I am already using the new Verisure App and it seems HA is trying to log in using the old App. It says I should click accept to use the new version:
**Logger: custom_components.securitas_direct.securitas
Source: custom_components/securitas_direct/securitas.py:126
Integration: securitas_direct (documentation, issues)
First occurred: 4:15:30 PM (1 occurrences)
Last logged: 4:15:30 PM
Ahora mismo solo tienes acceso a la nueva versión de My Verisure, haz clic en aceptar para acceder a la nueva versión.**
It is not as new as I have been using the new App for months
I'm running Home Assistant in Docker and since last update I'm getting this error message :
ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.securitas_617046 fails
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
cnx.do_handshake()
File "/usr/local/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1934, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/local/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1646, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 360, in connect
ssl_context=context,
File "/usr/local/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 488, in wrap_socket
raise timeout("select timed out")
socket.timeout: select timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 400, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 379, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 331, in _raise_timeout
self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='mob2217.securitasdirect.es', port=12010): Read timed out. (read timeout=5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/securitas_direct/alarm_control_panel.py", line 124, in update
hub.update_overview()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/securitas_direct/__init__.py", line 107, in update_overview
self.overview = self.session.last_state()
File "/config/custom_components/securitas_direct/securitas.py", line 109, in last_state
res = self._api_requests('ACT_V2',timefilter=2,activityfilter=0)
File "/config/custom_components/securitas_direct/securitas.py", line 61, in _api_requests
, timeout=5)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='mob2217.securitasdirect.es', port=12010): Read timed out. (read timeout=5)
I'm reading something about mob2217.securitasdirect.es but I'm not in Spain, I'm using the french service in my configuration.yaml file
country: FR
running
Supervisor 209
Home Assistant 0.106.5
Not sure if it's the Home Assistant update that raised the problem or Python 3.7.6 (which is the one running inside the Home Assistant container.
Outside the container
$ python -V
Python 2.7.17
$ python3 -V
Python 3.7.5
But I don't think that is relevant
Hi everyone,
Here you can find my first attempt of having a functional component for using securitas direct in Home Assistant.
https://github.com/guerrerotook/securitas-direct-new-api
This component is using the same configuration as the old one and it's using the new API that Securitas Direct migrated all users.
Please download the component and tell me what do you think. For now it's functional and you can arm and disarm your alarm and also works with multiple installations in case that you have more that one alarm in you account.
If you have feedback please create a new issue in my repository.
Thanks!
Hi @segalion
I just find out about your bash script to use Securitas Direct alarm with Home Assistant since I was planning to develop something similar.
I wanted to ask you if you are still working on this and if you'd feel comfortable if I try to help you on finishing the few TODO's?
Moreover, I have tried it in Mac with no success since the first $CURL does not return any .csv file attachment and then the grep fails. Any clue?
Thank you very much.
Please, use this issue to ONLY report working countrys:
Just copy all list, adding what you considere, following 1-line format...
Gracias por esta integracion.
Desde anoche no funciona
Devuelve este error
Logger: homeassistant.setup
Source: setup.py:178
First occurred: 09:28:38 (1 occurrences)
Last logged: 09:28:38
Setup failed for securitas_direct: Integration failed to initialize.
Logger: custom_components.securitas_direct
Source: custom_components/securitas_direct/init.py:93
Integration: securitas_direct
First occurred: 09:28:38 (1 occurrences)
Last logged: 09:28:38
Could not log in to Securitas: False
Detalles de registro (ERROR)
Este error se originó a partir de una integración personalizada.
Logger: custom_components.securitas_direct.securitas
Source: custom_components/securitas_direct/securitas.py:126
Integration: securitas_direct
First occurred: 09:28:38 (1 occurrences)
Last logged: 09:28:38
Gracias por acceder a My Verisure. Esta aplicación ya no está disponible y te recomendamos desinstalarla. Pulsa aceptar para poder acceder a la nueva aplicación.
No matter how hard I try to follow the instructions after integrating with HACS, it doesn't work for me.
securitas:
username: xxxxxxxxx
password: xxxxxxxxx
code: xxxx
Invalid config for [securitas]: expected str for dictionary value @ data['securitas']['code']. Got 7824. (See /config/configuration.yaml, line 34).
securitas_direct:
username: xxxxxxxxx
password: xxxxxxxxx
code: xxxx
Integration error: securitas_direct - Integration 'securitas_direct' not found.
The component record in the log the following WARNING:
2020-05-20 20:43:26 WARNING (MainThread) [homeassistant.components.alarm_control_panel] AlarmControlPanel is deprecated, modify SecuritasAlarm to extend AlarmControlPanelEntity
#Hi
I saw in the logs that threre are logs about request to base url that is *.es
I put FR in contry parameters but I still have that logs regularelry
username: !secret username
password: !secret password
code: !secret secret_code
country: FR
2021-01-20 23:24:09 WARNING (SyncWorker_29) [urllib3.connectionpool] Retrying (Retry(total=5, connect=0, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='mob2217.securitasdirect.es', port=12010): Read timed out. (read timeout=6)")': /WebService/ws.do?Country=FR......
Why that error ?
Is there another possibility to fix by having an equivalent in *.fr ?
I can arm and disarm de alarm from HA, but when enable the alarm form my verisure app, HA doesn´t recognize the status. I' ve read that I have to do sometihing about enable keys in order sync properly, but I do not know the steps to enable thes keys. Can any one to help me ?
Thanks
Hi,
I tried you script with Verisure Chile.
Viewing Chile's page I change this parts:
HOST="https://customers.verisure.cl"
INSTALL="cl/installations"
tmp=$($CURL $HOST/cl/login/cl -K- <<< "-d \"verisure_rsi_login[nick]=$NICK&verisure_rsi_login[passwd]=$PASSWD&authenticity_token=$token&button=&utf8=\✓\" -e \"$HOST/\"")
tmp=$($CURL $HOST/cl/remote/job_status/$job_id)
Note: in INSTALL and temp I change "es" for "cl" viewing the different pages in Chile.
I also change Nick and Password.
With that changes I could access my verisure installation, but I coudn't found the .csv file anywhere.
Do you know where exactly is that file? or why I couldn't get it?
P.D: Soy de Chile, podemos hablar en español si quieres.
hi,
i do step by step your info. but can you describe the way to integrate in homeassistant?
thanks in advance.
Here is the log :
2020-03-21 14:58:20 ERROR (MainThread) [homeassistant.setup] Error during setup of component securitas_direct
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 300, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 164, in _new_conn
% (self.host, self.timeout),
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.VerifiedHTTPSConnection object at 0xf32e89f0>, 'Connection to mob2217.securitasdirect.es timed out. (connect timeout=5)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='mob2217.securitasdirect.es', port=12010): Max retries exceeded with url: /WebService/ws.do?Country=FR&user=XXXXXXXXXXX&pwd=XXXXXXXX&lang=fr&request=LOGIN&ID=IPH_________________________XXXXXXXXXXXXXXXXXXXXXXXXXX (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0xf32e89f0>, 'Connection to mob2217.securitasdirect.es timed out. (connect timeout=5)'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/securitas_direct/__init__.py", line 61, in setup
if not HUB.login():
File "/config/custom_components/securitas_direct/__init__.py", line 90, in login
ret = self.session.login()
File "/config/custom_components/securitas_direct/securitas.py", line 88, in login
resp = requests.post(self.BASE_URL, params=self._params, timeout=5)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 504, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='mob2217.securitasdirect.es', port=12010): Max retries exceeded with url: /WebService/ws.do?Country=FR&user=XXXXXXXXXXXX&pwd=XXXXXXXXX&lang=fr&request=LOGIN&ID=IPH_________________________XXXXXXXXXXXXXXXXXXXXXXXXXX (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0xf32e89f0>, 'Connection to mob2217.securitasdirect.es timed out. (connect timeout=5)'))
2020-03-21 14:58:24 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 425, in _async_add_entity
raise HomeAssistantError(msg)
Running Home Assistant 107.4 in Docker on Ubuntu 19.10.
Hi,
since I have updated I see this log.
There is any procedure to fix it?
Logger: homeassistant.components.alarm_control_panel
Source: components/alarm_control_panel/init.py:194
Integration: Pannello di Controllo degli Allarmi (documentation, issues)
First occurred: 1 luglio 2020, 22:49:31 (1 occurrences)
Last logged: 1 luglio 2020, 22:49:31
AlarmControlPanel is deprecated, modify SecuritasAlarm to extend AlarmControlPanelEntity
Hi!
After installing the lastest version from HACS, and restarting home assistant, I got the following logs:
2020-11-12 19:17:26 DEBUG (SyncWorker_8) [custom_components.securitas_direct.securitas] OrderedDict([('PET', OrderedDict([('RES', 'ERROR'), ('ERR', '60161'), ('MSG', 'Ahora mismo solo tienes acceso a la nueva versión de My Verisure, haz clic en aceptar para acceder a la nueva versión.'), ('BLOQ', OrderedDict([('@remotereqactive', '1'), ('#text', 'Estamos mejorando nuestros servicios. Por favor intentelo de nuevo mas tarde. Gracias por confiar en Securitas Direct')]))]))])
2020-11-12 19:17:26 ERROR (SyncWorker_8) [custom_components.securitas_direct.securitas] Ahora mismo solo tienes acceso a la nueva versión de My Verisure, haz clic en aceptar para acceder a la nueva versión.
2020-11-12 19:17:26 DEBUG (SyncWorker_8) [custom_components.securitas_direct] Log in Securitas: False
2020-11-12 19:17:26 ERROR (SyncWorker_8) [custom_components.securitas_direct] Could not log in to Securitas: False
So it talks about a newer version of the app (that I've been using on the phone since the nov 4th api change). Until I updated earlier today, I still managed to get the alarm states in home assistant, but I wasn't able to change them. Now it just won't log in.
My configuration is as follows:
securitas_direct: username: username password: password #code: 1234 country: ES
I tried with and without the code commented and had the same errors.
Could this be tied to a user by user migration on verisure's side?
Thank you for your time and your great work! Keep it up!
Hi!
I've been using the integration for months and it works perfectly, but when i connect or disconnect the alarm outside home assistant (phisically or through the official app) home assistant doesn't seem to notice
Is this normal? Maybe if it is a "refresh" button or an automatic refresh every X minutes (or both) could be quote good
Makes sense?
Thanks!
Updated HA from a working config and now get the following error upon restart of HA;
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/securitas_direct/init.py", line 64, in setup
HUB.update_overview()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/securitas_direct/init.py", line 107, in update_overview
self.overview = self.session.last_state()
File "/config/custom_components/securitas_direct/securitas.py", line 111, in last_state
regs= res['PET']['LIST']['REG']
KeyError: 'REG'
Hi @segalion ,
I have 2 different securitas direct users, for 2 different alarms, that I would like to add in the same component.
I have copied and pasted the component changing the name of one but I have problems when creating the securitas direct panel.
Any idea on how I can solve this issue?
Thank you and best regards!
Borja
Verisure is requesting customers in France to move to the new application with a strong deadline.
Following this "forced" migration the integration fails to work with message
L'application MyVerisure a été remplacée par My New Verisure. Veuillez télécharger la nouvelle application
16:04:31 – securitas_direct (ERROR)
-> The application MyVerisure has been replaced by "My new Verisure". Please download the new application.
When using the securitas.py program locally it is still possible to connect to the ~"API".
Hi,
Just updated to core-2021.7.4 from 2021.5.0
I have reinstalled the HACS repository and copied the files over as the directions say to do in the docs but I get this error: Component error: securitas_direct - Integration 'securitas_direct' not found.
Seen this in the logs:
[homeassistant.loader] The custom integration 'securitas_direct' does not have a valid version key (None) in the manifest file and was blocked from loading. See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details
This is a warning shown in Home Assistant 2021.4.6. The integration will not load in future versions of Home Assistant
WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'securitas_direct'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'securitas_direct'
I got the error:
Detalhes do log (ERROR)
Logger: custom_components.securitas_direct.securitas
Source: custom_components/securitas_direct/securitas.py:126
Integration: securitas_direct (documentation, issues)
First occurred: 29 de janeiro de 2021 0:47:00 (1 occurrences)
Last logged: 29 de janeiro de 2021 0:47:00
O aplicativo My Verisure foi substituído para a nova versão. Por favor, clique em aceitar para acessar.
Can anybody help?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.