Verisure default lock code not working

Hi,

I am struggling to get the Verisure (alarm) settings to accept my default lock code.

If I manually input the code on the lock-pad and arm the alarm, everything works great. But if I leave out the code (or if I try to arm it from HomeKit or similar) I get the bellow error.

Anyone who knows what is wrong and how to fix it?

My settings as below:

verisure:
  username: “my username”
  password: “my password”
  default_lock_code: 1234
  code_digits: 4

I have tried with the code both in and out of quotation marks (1234 and “1234”). Fails on both.

This is my error log:

## Log Details (ERROR)

Logger: homeassistant.components.websocket_api.http.connection.140703042025936
Source: components/verisure/alarm_control_panel.py:32 
Integration: Home Assistant WebSocket API([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22)) 
First occurred: June 21, 2020, 11:55:49 PM (1occurrences) 
Last logged: June 21, 2020, 11:55:49 PM

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 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service self._platforms.values(), func, call, required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, 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.7/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 105, in alarm_arm_home set_arm_state("ARMED_HOME", code) File "/usr/src/homeassistant/homeassistant/components/verisure/alarm_control_panel.py", line 32, in set_arm_state transaction_id = hub.session.set_arm_state(code, state)[ File "/usr/local/lib/python3.7/site-packages/verisure/session.py", line 215, in set_arm_state _validate_response(response) File "/usr/local/lib/python3.7/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"}

I have the same issue, it worked fine for a while than suddenly I also get the same error message…

I have the same problem, have you been able to get it to work, if so how?

No unfortunately not, could only get it to work with the standard password; so not as useful as I hoped it could have been.

What I did was downloading the source from GitHub, then I dropped the Verisure component into custom_components and edited the lock.py. and set my code there. restarted home assistant and now it works from both home assistant and home app in iOS.

Changed line 38: self._default_lock_code = “000000”

What would be the easiest way to create a custom component on a Raspberry Pi?
Seems odd this would be overlooked for 6-months…

Yes that’s why I started trying to find an easy dirty hack for it, I’m not a developer just trying to get things to work when i couldnt find any other fix for it. Its a little strange as you describe but there might not be that many using this component I don’t know.

I tried to read the code to figure out what’s changed. But seems login information is used in the same way. Will give it another go tomorrow.

Perhaps one can create a PR to fix this issue :man_shrugging:t3:

So this is not a fix, but it makes thing work in a none hackish way for now.
Then you’ll simply switch this panel for your normal.

      
alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        value_template: '{{ states(''alarm_control_panel.a_alarm'') }}'
        arm_away:
          service: alarm_control_panel.alarm_arm_away
          data:
            entity_id: alarm_control_panel.a_alarm
            code: 123456
        arm_home:
          service: alarm_control_panel.alarm_arm_home
          data:
            entity_id: alarm_control_panel.a_alarm
            code: 123456
        disarm:
          service: alarm_control_panel.alarm_disarm
          data:
            entity_id: alarm_control_panel.a_alarm
            code: 123456

Nice thanks I tried with a similar template as switch because I don’t have an alarm panel you need Verisure right? The switch template didn’t work though it wouldn’t take my code.

I’m running the above successfully for the entire day :joy: and yes I have Verisure

I mean you have a Verisure alarm panel as well as the door lock?

Enter it like this, and it will work. (for me anyway. I don’t have an alarm)

verisure:
  username: [email protected]
  password: password
  default_lock_code: ”123456”
  alarm: false

This looks awesome, but can you give a little guidance in how to set this template up correctly? I am very new to HA and have Verisure setup and working, but would like to use the default code.

I would assume that this is a sort of “template override” you add to configuration.yaml which then changes the way a given panel looks/works?

However, simply adding it to configuration.yaml does not make it work for me. I also tried switching my card to using the “safe_alarm_panel” as the entity rather than (verisure) entity that I use for the panel today, but that does not seem to do the trick either.

Any help would be appreciated. Thanks.

You need to change the “a_alarm” to whatever your alarm is called within you HA. Eg if you alarm is called “mystreet_alarm”, that is the name you need to use.

1 Like

Thank you Steffen! Now it works :slight_smile: