core: Verisure integration slow after update to 2020.1 from 0.118

The problem

The Verisure integration has never been impressively snappy; usually a change within the Verisure system (armed, open/closed door etc.) would take 20-30 seconds or so to show up in HA. However, having recently upgraded from 0.118.* to 2020.1.0 (and then to 2020.1.1), it is considerably more slow. Changes are reflected in HA before late, but it always takes over a minute.

Environment

System Health

version 2021.1.1
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.10.5-arch1-1
arch x86_64
timezone Europe/Stockholm
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4923
Installed Version 1.9.0
Stage running
Available Repositories 718
Installed Repositories 8
Home Assistant Cloud
logged_in true
subscription_expiration 19 januari 2021 1:00
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 1
mode yaml
views 7
resources 1
Spotify
api_endpoint_reachable ok
  • Home Assistant Core release with the issue: 2020.1.*
  • Last working Home Assistant Core release (if known): 0.118.*
  • Operating environment (OS/Container/Supervised/Core): Docker running on Arch
  • Integration causing this issue: Verisure
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/verisure/

Problem-relevant configuration.yaml

verisure:
  username: !secret verisurename
  password: !secret verisurepass
  hygrometers: 1
  door_window: 1
  alarm: 1
  thermometers: 1

Traceback/Error logs

Nothing yet. Just restarted with debug; will update if something shows up.

Additional information

Previously, when arming Verisure from within HA, everything was instantaneous: HA showed alarm_control_panel.furustigen_alarm as being armed immediately and it was indeed armed from Verisure’s end as well. However, having upgraded, when arming from within HA Verisure immediately arms as before but it takes a minute or two before HA catches up.

So, the integration is not broken, but merely more sluggish than before.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 37 (14 by maintainers)

Most upvoted comments

I have the same issue.

First occurred: 18:00:48 (65 occurrences)
Last logged: 23:09:49
...
verisure.session.RequestError: HTTPSConnectionPool(host='e-api02.verisure.com', port=443): Max retries exceeded with url: /xbn/2/installation/[REDACTED]/overview (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f959ac160>: Failed to establish a new connection: [Errno 110] Operation timed out'))

The log sounds really strange to me since my pages from verisure seems to work correctly and even https://e-api02.verisure.com/ is also responding correctly (as well as e-api01).

When I arm (or disarm) through HA (dedicated verisure user for HA), I receive a notification from verisure. The notification come instantly while it takes long time to HA to know status has changed (before 2021-1-x, it was also instantly). ->Exact same behavior as @krissen

The switch/wallplug states have been fixed and is part of Home Assistant 2021.5.0 (beta 2 and newer).

I just tested the 2020.4.1 (new clean docker image), no smartcam error and the status of the alarm seems to update without delay.

I’ll update my “production” HA this week end and let you know

But would want to avoid HA core beta if possible.

That is what beta’s are for… If no-one tests the beta than .0 will become a beta. Simple as that. We have around 300 beta testers, un fortunately, some bugs where not detected.

Nevertheless, 2 bugs, including the Smartcam error have been solved in 2021.4.1

That is a great report!

I just came by to tell you I experienced the same thing for the first time this morning, so definitely something is of…

So this doesn’t give any more information as to why there’s a delay, it is just the log for when Verisure has been armed from HA, but HA doesn’t know it yet, and there is a second (and third) attempt to arm through HA. The latter two attempts fail with an error message that VS has, indeed, already been armed.

2021-01-16 00:12:58 INFO (SyncWorker_22) [homeassistant.components.verisure] verisure set arm state ARMED_HOME
2021-01-16 00:13:07 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140648999605152] Invalid response, status code: 400 - Data: {"errorGroup":"BAD_REQUEST","errorCode":"VAL_00818","errorMessage":"The requested arm state is not possible to apply due to armstate already set"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 136, in async_alarm_arm_home
    await self.hass.async_add_executor_job(self.alarm_arm_home, code)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/verisure/alarm_control_panel.py", line 103, in alarm_arm_home
    set_arm_state("ARMED_HOME", code)
  File "/usr/src/homeassistant/homeassistant/components/verisure/alarm_control_panel.py", line 30, in set_arm_state
    transaction_id = hub.session.set_arm_state(code, state)[
  File "/usr/local/lib/python3.8/site-packages/verisure/session.py", line 215, in set_arm_state
    _validate_response(response)
  File "/usr/local/lib/python3.8/site-packages/verisure/session.py", line 16, in _validate_response
    raise ResponseError(response.status_code, response.text)
verisure.session.ResponseError: Invalid response, status code: 400 - Data: {"errorGroup":"BAD_REQUEST","errorCode":"VAL_00818","errorMessage":"The requested arm state is not possible to apply due to armstate already set"}
2021-01-16 00:13:14 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140648999605152] Invalid response, status code: 400 - Data: {"errorGroup":"BAD_REQUEST","errorCode":"VAL_00008","errorMessage":"Invalid or non-existing value for code"}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 136, in async_alarm_arm_home
    await self.hass.async_add_executor_job(self.alarm_arm_home, code)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/verisure/alarm_control_panel.py", line 103, in alarm_arm_home
    set_arm_state("ARMED_HOME", code)
  File "/usr/src/homeassistant/homeassistant/components/verisure/alarm_control_panel.py", line 30, in set_arm_state
    transaction_id = hub.session.set_arm_state(code, state)[
  File "/usr/local/lib/python3.8/site-packages/verisure/session.py", line 215, in set_arm_state
    _validate_response(response)
  File "/usr/local/lib/python3.8/site-packages/verisure/session.py", line 16, in _validate_response
    raise ResponseError(response.status_code, response.text)
verisure.session.ResponseError: Invalid response, status code: 400 - Data: {"errorGroup":"BAD_REQUEST","errorCode":"VAL_00008","errorMessage":"Invalid or non-existing value for code"}

This time it worked / was reflected instantaneously at both Verisure and HA:

2021-01-16 06:44:56 INFO (SyncWorker_27) [homeassistant.components.verisure] verisure set arm state DISARMED

Tried it out just now a couple more times.

First try at arming from HA: was reflected in VS and HA immediately. When disarming, it was disarmed at VS immediately and took roughly a minute for HA to catch up.

Second try five minutes later: arming from HA was reflected immediately at VS but took 69 seconds for HA. Disarming from HA was reflected immediately at VS but took 80 seconds for HA to notice.

So, this particular post includes reports of six individual alarm actions; three “arm home” and three disarm. All six were taken from within HA. Two (one “arm home” and one disarm) were reflected immediately at both VS and HA. Four was recognized immediately by VS but had delays of about a minute before HA reflected the state change.

In other words, it is not immediate all the time, but nor is there a delay (when arming from HA) at all times. But, restating just to be clear, there never used to be a delay when arming or disarming through HA (@ HA <= 0.118.*). However, there always was, and still is, when arming or disarming from the Verisure end.

… I should add that this is not a big deal, nor am I clamouring for it to be recognized as such. I merely noticed a change that I thought warranted reporting. If it would be a simple fix, I preferred when arming through HA led to HA knowing VS was armed straight away. But it, obviously, is not a big deal to wait 30-120 seconds or so.

I can concur with @krissen that this is indeed the change we see. The Verisure notification pops up right away ( from the Verisure app ) when triggering an arm alarm through HA, but status change in HA will linger.

Previous HA did it instantaneous.

IIRC the polling has always been every few minutes due to Verisure blocking clients polling too often, so I think you are just remembering it wrong 😃