Testers for Verisure openHAB 2 binding

Hi.
I had to have a look what I did, since it was a couple of years ago - and I’ve never touched it since.
:slight_smile:
I used the AutoNotification addon to tasker (if I dont remember wrongly, it did cost a few dollars).
So - in the tasker Profile I use AutoNotification to Intercept any notifications from Verisure.
The Task (called from the Profile) toggles a Virtual Switch “VerisureRefresh_Switch” using “http post”.

From there it is just a simple openhab rule that asks for a refresh from the binding whenever the virtual switch changes state.

1 Like

I am by no means a “power user” of Tasker… I can barely use it myself.
However, If you google for AutoNotification you will find several HOWTO:s

Seeing the following NPE with (I assume) the latest posted jar-file (2.5.0.201906232019):

2019-08-05 23:01:04.064 [WARN ] [ternal.handler.VerisureBridgeHandler] - Failed to initialize! 
Exception caught: null
java.lang.NullPointerException: null
	at org.openhab.binding.verisure.internal.VerisureSession.getInstallations(VerisureSession.java:377) ~[259:org.openhab.binding.verisure:2.5.0.201906192010]
at org.openhab.binding.verisure.internal.VerisureSession.initialize(VerisureSession.java:132) ~[259:org.openhab.binding.verisure:2.5.0.201906192010]

at org.openhab.binding.verisure.internal.handler.VerisureBridgeHandler.initialize(VerisureBridgeHandler.java:127) [259:org.openhab.binding.verisure:2.5.0.201906192010]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.10.0.oh240]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run(Thread.java:748) [?:?]

Is there a requirement for the Verisure user to be e.g. administrator to set up the connection?
(I can log in with the user.)

Have you tried with an user with administrator rights? Just to rule out it is not the user?

Tried it and got the same issue. Then I tried a random mail account and password and got the same issue again…
My things-file:

Bridge verisure:bridge:home "Versiure Bridge" [ username="mymail@gmail.com", password="mypassword", refresh=300 ]  {
     Thing smartLock     SmartLock     "Verisure Entrance Yale Doorman"  [ deviceId="ABCDE" ]
}

Ok, I don’t have a smartLock but have you tried with other Things?

Here are a bit of my .things file:

Bridge verisure:bridge:myverisure "Verisure Bridge" [
        username="mymail@gmail.com",
        password="mypassword",
        refresh="600",
        pin="1234"
] {
        Things:
                alarm verisure_alarm "Verisure Alarm" [
                        deviceId="alarmXXXXXXXXXX"
                ]
}

I’m sure you have tried clear your cache? Else that could also make openhab act a bit wired. I made a small script to make it easy here: My point of view of Openhab2, stability and a few good to know stuff

Hi @Daniel_Linder Finally I got the time to play around with tasker and autoNotification and now it works. That is a good workaround. Thank you :slight_smile:

I did find out that not all devices/tables are able to do this. Some older devices is does not allow different functions/rights to be able to do this.

I tried with:

  • Denver tablet TAQ-90082 with Android 8.1 go and it does not support all necessary functions/rights
  • Lenovo tablet A7600-F with Android 7.1.2 and it works great :slight_smile:

I also tried to install android in a VM. But the Verisure app does not work in a virtual Android. I think it has something to do with the screen rotation or something.

Nice,
I use a 5 year old Chinese “Pipo” tablet for this. And it’s been perfectly adequate. The main reason why I had to implement this was due to any of my children triggering the “Stay” alarm, since they had no idea whether the alarm was active or not. So, the fix was to have a lamp in the hallway turn red - when the alarm is active/armed.

Other “things” doesn’t seem to be the problem as I see the issue when only adding the Bridge to the config.
Tried to completely remove the binding and clear the cache, but I ended up with the same issue.

Checked the code however, and it turns out to be my own fault: I didn’t have the “pin” added to the settings. For some reason I figured that that would be an optional since a Verisure user may not even have one.

So it works now for me, thanks @thorsen for checking on this.

1 Like

Hi @RobinS

You are welcome :slight_smile: Happy to help

@jannegpriv Maybe the documentation could be more clear?
From

You can also configure your pin-code(s) to be able to lock/unlock the SmartLock(s) and arm/unarm the Alarm(s).

To

You must configure your pin-code(s) to be able to lock/unlock the SmartLock(s) and arm/unarm the Alarm(s). 

I gave the binding a try, but unfortunately it doesn’t seem to work for me. The bridge status is “OFFLINE - COMMUNICATION ERROR” and I’m getting an expection on the log when starting openhab.
I’m running openhab on Raspberry Pi 3 B+ with Raspbian 10 (buster). Openhab version 2.4 from the stable branch.
I have only one Verisure installation and it’s located in Finland. I’m able to login to the Verisure web interface with a browser without problems.

I cleared the cache, and I also tested with both the limited and admin user level accounts, the result is the same.
Here is the debug-level log when starting openhab, I have censored few fields which probably should remain private:

2019-08-14 12:47:57.058 [DEBUG] [org.openhab.binding.verisure        ] - BundleEvent STARTING - org.openhab.binding.verisure
2019-08-14 12:47:57.097 [DEBUG] [org.openhab.binding.verisure        ] - BundleEvent STARTED - org.openhab.binding.verisure
2019-08-14 12:47:57.483 [DEBUG] [sure.internal.VerisureHandlerFactory] - setHttpClientFactory this: org.openhab.binding.verisure.internal.VerisureHandlerFactory@117ef34
2019-08-14 12:47:57.779 [DEBUG] [org.openhab.binding.verisure        ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=459, service.bundleid=263, service.scope=bundle, component.name=org.openhab.binding.verisure.internal.VerisureHandlerFactory, component.id=301} - org.openhab.binding.verisure
2019-08-14 12:48:18.047 [DEBUG] [sure.internal.VerisureHandlerFactory] - createHandler this: org.eclipse.smarthome.core.thing.internal.BridgeImpl@8e78fba8
2019-08-14 12:48:18.110 [DEBUG] [sure.internal.VerisureHandlerFactory] - Create VerisureBridgeHandler
2019-08-14 12:48:20.394 [DEBUG] [org.openhab.binding.verisure        ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=462, service.bundleid=263, service.scope=singleton} - org.openhab.binding.verisure
2019-08-14 12:48:20.451 [DEBUG] [ternal.handler.VerisureBridgeHandler] - Initializing Verisure Binding
2019-08-14 12:48:20.462 [DEBUG] [ng.verisure.internal.VerisureSession] - VerisureSession:initialize
2019-08-14 12:48:20.467 [DEBUG] [ng.verisure.internal.VerisureSession] - Attempting to log in to mypages.verisure.com
2019-08-14 12:48:20.472 [DEBUG] [ng.verisure.internal.VerisureSession] - Login URL: https://mypages.verisure.com/j_spring_security_check?locale=en_GB
2019-08-14 12:48:20.476 [DEBUG] [ng.verisure.internal.VerisureSession] - sendHTTPpost URL: https://mypages.verisure.com/j_spring_security_check?locale=en_GB Data:j_username=xxx&j_password=yyy&spring-security-redirect=/uk/start.html
2019-08-14 12:48:20.490 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /j_spring_security_check HTTP/1.1]@b0d34.
2019-08-14 12:48:25.550 [WARN ] [core.thing.internal.ThingManagerImpl] - Initializing handler for thing 'verisure:bridge:886cad8a' takes more than 5000ms.
2019-08-14 12:48:26.625 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (200)
2019-08-14 12:48:26.639 [DEBUG] [ng.verisure.internal.VerisureSession] - Attempting to get all installations
2019-08-14 12:48:27.029 [DEBUG] [ng.verisure.internal.VerisureSession] - Response Cookie: name: username, value: xxx
2019-08-14 12:48:27.043 [DEBUG] [ng.verisure.internal.VerisureSession] - Response Cookie: name: vid, value: zzz
2019-08-14 12:48:27.065 [DEBUG] [ng.verisure.internal.VerisureSession] - Fetching vid zzz from cookie
2019-08-14 12:48:27.073 [DEBUG] [ng.verisure.internal.VerisureSession] - sendHTTPpost URL: https://m-api01.verisure.com/auth/login Data:empty
2019-08-14 12:48:27.096 [DEBUG] [ng.verisure.internal.VerisureSession] - Setting cookie with username xxx and vid zzz
2019-08-14 12:48:27.117 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /auth/login HTTP/1.1]@23c13.
2019-08-14 12:48:29.982 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (200)
2019-08-14 12:48:30.013 [DEBUG] [ng.verisure.internal.VerisureSession] - sendHTTPpost URL: https://m-api01.verisure.com/graphql Data:[{"operationName":"AccountInstallations","variables":{"email":"xxx"},"query":"query AccountInstallations($email: String!) {\n  account(email: $email) {\n    owainstallations {\n      giid\n      alias\n      type\n      subsidiary\n      dealerId\n      __typename\n    }\n    __typename\n  }\n}\n"}]
2019-08-14 12:48:30.038 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /graphql HTTP/1.1]@1f78925.
2019-08-14 12:48:30.208 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (200)
2019-08-14 12:48:30.610 [DEBUG] [ng.verisure.internal.VerisureSession] - Installation: {}org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON@458878[data=org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Data@168b23c[account=org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Account@af746e[owainstallations=[org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Owainstallation@469870[giid=somedatawashere,alias=MyAlias,type=GW,subsidiary=<null>,dealerId=FI  ,typename=OWAInstallation]],typename=Account]]]
2019-08-14 12:48:30.623 [DEBUG] [ng.verisure.internal.VerisureSession] - Installation: {}org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON@458878[data=org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Data@168b23c[account=org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Account@af746e[owainstallations=[org.openhab.binding.verisure.internal.model.VerisureInstallationsJSON$Owainstallation@469870[giid=somedatawashere,alias=MyAlias,type=GW,subsidiary=<null>,dealerId=FI  ,typename=OWAInstallation]],typename=Account]]]
2019-08-14 12:48:30.635 [WARN ] [ternal.handler.VerisureBridgeHandler] - Failed to initialize! Exception caught: null
java.lang.NullPointerException: null
        at org.openhab.binding.verisure.internal.VerisureSession.getInstallations(VerisureSession.java:544) ~[263:org.openhab.binding.verisure:2.5.0.201906232019]
        at org.openhab.binding.verisure.internal.VerisureSession.initialize(VerisureSession.java:136) ~[263:org.openhab.binding.verisure:2.5.0.201906232019]
        at org.openhab.binding.verisure.internal.handler.VerisureBridgeHandler.initialize(VerisureBridgeHandler.java:127) [263:org.openhab.binding.verisure:2.5.0.201906232019]
        at jdk.internal.reflect.GeneratedMethodAccessor71.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [103:org.eclipse.smarthome.core:0.10.0.oh240]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [103:org.eclipse.smarthome.core:0.10.0.oh240]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

Edit: I checked the binding source code and noticed that the crash is caused by not having pin code configured on the bridge settings. Verisure account can exist without having a pin code, but the binding seems to require it.

Hi!

I am using this binding but at some point after 07:00 2019-08-14 I receive a COMMUNICATION_ERROR when looking at the binding in Openhab, and after reviewing the logs I get the following error:

2019-08-19 16:39:30.268 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (200) Body:{"errors":[{"message":"Request Failed. Code 503 from http://gql-api02.verisure.com/xbn/2/webaccount/{my_email_address}/installation","locations":[{"line":3,"column":5}],"path":["account","owainstallations"],"data":{"status":503,"url":"http://gql-api02.verisure.com/xbn/2/webaccount/{my_email_address}/installation","logTraceId":"{logging_uuid}","errorGroup":"SERVICE_UNAVAILABLE","errorCode":"SYS_00004","errorMessage":"XBN Database is not activated"}}],"data":{"account":{"owainstallations":null,"__typename":"Account"}}}

Is anyone else also experiencing this? I found a fix to this error in a Python script, commited in februari 2017 where the API URL seem to have changed: https://github.com/persandstrom/python-verisure/commit/34f5b6eef4252ea0806b2d94830249b62ddde668

I get the same error since a few days back.

Fredrik

Which binding version are you using?

Using the latest one I could find, verisure-2.5.0-SNAPSHOT.jar.

2.5.0.201906192010

Anyone else experiencing this problem? Any idea of reason?

Hmm, I’m using the same version and have no issues.
Error 503 could indicate that the service is ‘overloaded’, e.g. too many requests have been made?
What timings/polling do you use?

Maybe the documentation could be more clear?

Yes, I’ll change that.

The binding should also work not having a PIN configured, I must fix that.

Hi, I made a PR some time ago. Maybe you can use that? :slight_smile: