core icon indicating copy to clipboard operation
core copied to clipboard

Verisure Integration fails after update to HA 2022.11.5

Open nossaile opened this issue 2 years ago • 22 comments

The problem

After updating to latest version (Home Assistant 2022.11.5) the Verisure integration stopped working and required re-authentication. Entering correct credentials (email and password) in the dialogue and the popup answers “success”, but the Verisure integration still doesn’t work. Trying to reboot, but that doesn’t help either. I repeated the same procedure a couple of times with the same poor result. Last hope reinstalling the Verisure integration… After deleting it HA discovered Verisure and asked to be configured. A login dialogue appear, but despite correct entered credentials the Verisure popup this time answer ” Invalid authentication”. I have double checked my credentials on Verisure’s home page.

What version of Home Assistant Core has the issue?

2022.11.5

What was the last working version of Home Assistant Core?

2022.11.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Verisure

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

nossaile avatar Nov 30 '22 17:11 nossaile

A couple of hours after I filed the Issue I tried again to Configure Verisure integration and this time it worked perfectly. Strange!

nossaile avatar Dec 01 '22 15:12 nossaile

Hey there @frenck, mind taking a look at this issue as it has been labeled with an integration (verisure) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of verisure can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign verisure Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


verisure documentation verisure source (message by IssueLinks)

home-assistant[bot] avatar Dec 01 '22 18:12 home-assistant[bot]

Same fault again today when updating to Home Assistant 2022.12.0. Verisure use two step verification and it's the second part that's not issued (Verisure sends a code that should be entered in a popup dialogue).

nossaile avatar Dec 08 '22 15:12 nossaile

Updating to 2022.12.1 of cause.

To solve the problem I had to delete the Verisure integration and install it again. Then after a couple of hours I could login successfully.

nossaile avatar Dec 09 '22 18:12 nossaile

It’s not the update that is the root cause, because it happened again yesterday after HA being restarted. It looks like the Verisure integration cannot survive a restart of HA.

nossaile avatar Dec 13 '22 13:12 nossaile

Not sure if the same issue but my integration also seems to be failing intermittently.

From the logs I see this:

2022-12-15 08:25:24.298 ERROR (MainThread) [homeassistant.components.verisure] Could not read overview, Invalid response, status code: 401 - Data: {"errorGroup":"UNAUTHORIZED","errorCode":"AUT_00011","errorMessage":"Invalid session cookie"}
2022-12-15 08:25:24.299 ERROR (MainThread) [homeassistant.components.verisure] Unexpected error fetching verisure data: Invalid response, status code: 401 - Data: {"errorGroup":"UNAUTHORIZED","errorCode":"AUT_00011","errorMessage":"Invalid session cookie"}

Did a reload of the integration and then it started working again.

parberge avatar Dec 15 '22 07:12 parberge

I have the same issue, any solution other than reload the integration every reboot?

DanielGoransson1 avatar Dec 25 '22 23:12 DanielGoransson1

I also have the same issue with a few upgrades on HA without Verisure ever being configured. This is on HA 2023.1.4

mherbert84 avatar Jan 15 '23 17:01 mherbert84

I solved it. Just add another accoynd, call it whatever. Link it to the system, then remove the two factor autentification!

DanielGoransson1 avatar Jan 15 '23 17:01 DanielGoransson1

@DanielGoransson1 Can you let me know how to disable 2FA on a separate account? I can't seem to find that option

mherbert84 avatar Jan 15 '23 17:01 mherbert84

Go to my page on the verisure webpage. Users - - click on the user - - Edit account settings - - then you see it!

DanielGoransson1 avatar Jan 15 '23 18:01 DanielGoransson1

To disable 2FA is not a solution, only a temporary fix!

nossaile avatar Jan 16 '23 09:01 nossaile

Hi there, My Verisure integration fails to restart every time I accept an update of HA. Reconfiguring with the correct credentials does not solve the issue. However after trying to log in several times and after waiting for some time it came alive again…. Today I installed the most recent update of HA and again, problems!

Tried a hardware reset (settings > system > hardware etc) and this solved the problem Has anyone a more userfriendly solution?

HenkdeVlaam avatar Jan 25 '23 16:01 HenkdeVlaam

Someone managed to solve this?

Im running 2023.2.0 and gets this error: "Code " for unlocking None doesn't match pattern ^\d(6)S"

Tried reinstalling the integration. Dosnt matter which code or how many digits I configure in settings for integration, same error.

Edit: Found this: https://github.com/home-assistant/core/issues/86963 same problem with both Verisure and Yale integration, seems no one solved it yet.

bubbzy avatar Feb 05 '23 21:02 bubbzy

Someone managed to solve this?

Im running 2023.2.0 and gets this error: "Code " for unlocking None doesn't match pattern ^\d(6)S"

Tried reinstalling the integration. Dosnt matter which code or how many digits I configure in settings for integration, same error.

Edit: Found this: #86963 same problem with both Verisure and Yale integration, seems no one solved it yet.

Same issue her. `Logger: homeassistant.components.websocket_api.http.connection Source: components/lock/init.py:92 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 09:45:31 (12 occurrences) Last logged: 12:23:12

[547778346432] Code '' for locking None doesn't match pattern ^\d{6}$ [547535209664] Code '' for locking None doesn't match pattern ^\d{6}$ [547413885088] Code '' for locking None doesn't match pattern ^\d{6}$ [547446919504] Code '' for locking None doesn't match pattern ^\d{6}$ [547495130448] Code '' for locking None doesn't match pattern ^\d{6}$ Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 720, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/lock/init.py", line 92, in _async_lock raise ValueError( ValueError: Code '' for locking None doesn't match pattern ^\d{6}$`

pjator avatar Feb 10 '23 11:02 pjator

Problem persists in homeassistant-2023.2.3. I worked around it (again) by applying the fix proposed in https://github.com/home-assistant/core/issues/86963 which points to https://github.com/home-assistant/core/pull/87544

It is not ideal that upgrading HA has the side effect that my front door stays unlocked during night...

mgartin avatar Feb 16 '23 19:02 mgartin

With 2FA, my best procedure to get Verisure integration up and running as quick as possible after an HA upgrade looks as follows:

  1. Install the new HA version that always finish with a restart.
  2. Enter Settings -> Devices & Services: Delete the Verisure integration
  3. Restart HA
  4. Wait about 30 minutes (for some unknown reason)
  5. Enter Settings -> Devices & Services: You should find the Verisure integration asking to be configured and the 2FA should work fine.

But, we hope this will soon be unnecessary

nossaile avatar Feb 17 '23 00:02 nossaile

Temporary fix:

switch:

  • platform: template switches: entrance_lock_status: friendly_name: "Entrance Lock Status" value_template: "{{ is_state('lock.entrance_lock', 'locked') }}" turn_on: service: script.turn_on entity_id: script.lock_entrance_lock turn_off: service: script.turn_on entity_id: script.unlock_entrance_lock

And

script: unlock_entrance_lock: alias: Unlock Entrance Lock sequence: - service: lock.unlock entity_id: lock.entrance_lock data: code: '123456'

lock_entrance_lock: alias: Lock Entrance Lock sequence: - service: lock.lock entity_id: lock.entrance_lock

mattisgn avatar Mar 04 '23 09:03 mattisgn

@mattisgn : Interesting, but please elaborate on your fix a bit. Explain what you are doing, why, and where to put the code.

nossaile avatar Mar 04 '23 10:03 nossaile

Emulates a switch but with the pin entered directly in the script, bypassing the bug. Put everything in configuration.yaml

mattisgn avatar Mar 04 '23 10:03 mattisgn

Emulates a switch but with the pin entered directly in the script, bypassing the bug. Put everything in configuration.yaml

Hi, Is it possible that you show with some PrintScrceens what you mean?

BR// Andy,

andreashakanssson avatar Mar 14 '23 22:03 andreashakanssson

Following @mattisgn recommendation for a workaround I finally got this to work again.

But put the code in a more "noob friendly" way below.

Add this part to your configuration.yaml

You need to change lock.entredorr to your lock entity and if you want the switch to light up when it is locked instead of unlocked you just edit the "unlocked" in the value template. And revers the order och the servicescript that turn_on runs the lock script instead of the unlock script.

switch:
  - platform: template
    switches:
      entrance_lock_status:
        unique_id: Entrance_Lock_Status
        value_template: "{{ is_state('lock.entredorr', 'unlocked') }}"
        turn_on:
          service: script.turn_on
          target:
            entity_id: script.unlock_entrance_lock
        turn_off:
          service: script.turn_on
          target:
            entity_id: script.lock_entrance_lock
        icon_template: >-
          {% if is_state('lock.entredorr', 'locked') %}
            mdi:lock
          {% else %}
            mdi:lock-open
          {% endif %}

Then in your scripts.yaml file you add the following code and change to your code.

lock_entrance_lock:
  alias: lock_entrance_lock
  sequence:
  - service: lock.lock
    data:
      code: '000000'
    target:
      entity_id: lock.entredorr
  mode: single
  icon: mdi:lock
unlock_entrance_lock:
  alias: unlock_entrance_lock
  sequence:
  - service: lock.unlock
    data:
      code: '000000'
    target:
      entity_id: lock.entredorr
  mode: single
  icon: mdi:lock

Hope this saves some time for you compared to how difficult it was for me to get this workaround to function as I wanted.

pjator avatar May 01 '23 11:05 pjator

The passcode/lock issue is handled in issue #86963

After reading through the earlier comment, I understand this is to originally be about that the Verisure integration requires reload after restart of HA when 2FA is enabled in Verisure. I have disabled 2FA, and have not had any problems with the Verisure integration after 2023.6.0, so maybe someone with 2FA enabled could verify if the problem still occurs?

Also, maybe someone could update the issue title to be more precise?

(Edit: corrected release the lock issue was fixed in.)

oyvindwe avatar Jul 06 '23 19:07 oyvindwe

@frenck the original post is no longer relevant, should we close this issue?

niro1987 avatar Jul 26 '23 19:07 niro1987

@home-assistant close

niro1987 avatar Aug 07 '23 13:08 niro1987