Testers for Verisure openHAB 2 binding

Sure, I’ve been in vacation mode for a while but soon it will be dark, cold and rainy outside and more time to play with OpenHAB :slight_smile:

1 Like

Thanks for your help. Confirmed the use of m-api01in the developer console. I was using a few days older binding. With the latest binding it now works like a charm again. My mistake. Thanks again.

I’ve now fixed so that it is possible to use the binding without having a PIN-code defined in the configuration.
New jar-file up for test.

openhab@openhab2:/usr/share/openhab2/addons $ md5sum org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar 
f0cdcf99efe2e5b17c66f64d153f0350  org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar

README.

I’ve had problems with my local Eclipse environment so I have removed the external libs (gson, jsoup) that were present in my lib folder. This had the effect that I had to add the gson dependency manually in Karaf when installing latest jar and then restart the Verisure bundle to get it working.

openhab@openhab2:~ $ openhab-cli console

Logging in as openhab

                          __  _____    ____      
  ____  ____  ___  ____  / / / /   |  / __ )     
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
    /_/                        2.4.0
                               Release Build   

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab> bundle:list -s |grep veris
332 │ Installed │  80 │ 2.5.0.201909161750     │ org.openhab.binding.verisure
openhab> bundle:stop 332
openhab> bundle:uninstall 332
openhab> bundle:install -s file:/usr/share/openhab2/addons/org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar
Bundle ID: 333
Error executing command: Error installing bundles:
	Unable to start bundle file:/usr/share/openhab2/addons/org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar: org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.verisure [333]
  Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

openhab> bundle:install http://central.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar                                                                                                      
Bundle ID: 334
openhab> bundle:restart 333
openhab> bundle:list -s |grep veris
333 │ Active    │  80 │ 2.5.0.201909161750     │ org.openhab.binding.verisure

Interesting to know if you get the same behaviour, I’m still running OH2.4.0 in my production environment. (In my local test environment using Docker and OH2.5.0M3 I did not get the gson resolve issue.)

I am using this new Verisure binding as part of my 2.4.0 OpenHab environment, and I also had to manually install the gson dependency. Got my bridge and Yale Doorman online.

One challenge using the binding with my Yale Doorman though: There seems to be slow/no datapoint response to OpenHab when the lock is handled manually in my setup (THUMB, CODE, AUTO).

I have set my lock to autolock when door is closed. I am also trying to generate a rule “when UNLOCKED” and if “ChangedVia is CODE” to trigger some actions. But the binding (openhab log) does not recognise when the lock is handled using code, i.e. no state change of the channel (even though recognised by the verisure app).

Any idea?

One challenge using the binding with my Yale Doorman though: There seems to be slow/no datapoint response to OpenHab when the lock is handled manually in my setup (THUMB, CODE, AUTO).

Since the binding polls the Verisure API, it will take up to configured poll time (Refresh Interval) until the binding gets knowledge of a manual change of lock status. The default poll time is 600s and with that frequency I’ve not received any complaints from Verisure.

If you look earlier in the thread you’ll find a post from @Daniel_Linder that has used Tasker to intercept push messages from Verisure and then Tasker is configured to call the OpenHAB REST API to initiate a refresh on the binding.

In my effort to get this binding to be a part of the official bindings in OpenHAB I’ve gotten some recent review comments from maintainers that have impacted the things modelling and existing channels for SmartLock, SmartPlug and Alarm.

The README has been updated to reflect the changes and in summary all channels that was used to get status have been removed and now the same channel is used for both reading and changing status.

New jar-file for test.

openhab@openhab2:/usr/share/openhab2/addons $ md5sum org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar 
11d7f42ab0dc469da663393382860b22  org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar

README.

Really appreciate if you could test this latest version of the binding, I would recommend to re-discover the SmartLock/SmartPlug and Alarms things again (delete from paperUI and then auto discover) if you use auto-discovery.

See posts above if you get problems with resolving gson.

1 Like

@jannegpriv
Have tested your new binding, and installation works fine for me having the bridge and Yale Doorman. Had to manually add gson dependency as before. Appreciate your work!

Although, there seems to be less channels/items associated with Yale Doorman with the new binding compared to previous? Maybe this relate to the changes you had to make? Anyway, have not identified any required/missing channels.

Hi Jan,

Just installed the updated binding on OH 2.5.0.M4 and first tests shows the basics work but after a few try runs I had this error:

2019-10-23 20:44:57.679 [WARN ] [ng.verisure.internal.VerisureSession] - Caught ExecutionException {}
java.util.concurrent.ExecutionException: java.io.EOFException: HttpConnectionOverHTTP@b268270::DecryptedEndPoint@57b4cD61{m-api01.verisure.com/195.170.189.34:443<->/172.28.0.6:40572,OPEN,fill=-,flush=-,to=10003/0}
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[?:?]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[?:?]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:683) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.postVerisureAPI(VerisureSession.java:360) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.postVerisureAPI(VerisureSession.java:407) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.setSessionCookieAuthLogin(VerisureSession.java:461) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.updateStatus(VerisureSession.java:555) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.refresh(VerisureSession.java:145) ~[?:?]
	at org.openhab.binding.verisure.internal.handler.VerisureBridgeHandler.refreshAndUpdateStatus(VerisureBridgeHandler.java:181) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
	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) [?:?]
Caused by: java.io.EOFException: HttpConnectionOverHTTP@b268270::DecryptedEndPoint@57b4cD61{m-api01.verisure.com/195.170.189.34:443<->/172.28.0.6:40572,OPEN,fill=-,flush=-,to=10003/0}
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.earlyEOF(HttpReceiverOverHTTP.java:338) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1551) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.shutdown(HttpReceiverOverHTTP.java:209) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:147) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:73) ~[?:?]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133) ~[?:?]
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:155) ~[?:?]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:427) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:321) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:159) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[?:?]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) ~[?:?]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804) ~[?:?]
	... 1 more

After that the alarm arm/disarm worked fine again. Looks like an API ‘hickup’ (early EOF)?

Thanks for testing :-), never seen that exception before, I found this thread discussing the same exception trace.

New jar-file that handles pin-codes starting with zeroes, thanks @Calle for reporting it!

[22:17:35] openhabian@openhab:/usr/share/openhab2/addons$ md5sum org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar 
89fc968d6a528d4c96e6720c2eb41294  org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar

README.

See posts above if you get problems with resolving gson.

2 Likes

Hi, new to openHAB getting ready to give the Verisure binding a try. is there a good starting point for this without having to read through the 270 posts in this thread? :slightly_smiling_face:

Hi,
I’ve been using an older version of the binding. It’s been working great until lately, when the bridge status suddently changed to OFFLINE - COMMUNICATION_ERROR.
I’ve tried to install the latest version of the binding manually but it wont install (does’nt show up in paper UI). 'm trying to look into the gson dependency installation, but i cant figure out how it works. What is Karaf and how do i open the karaf console?
I really appreciate all help.
Br Nikolaj

Hi @Nikolaj_Thomsen and @KlingsporC!

The Karaf console or just console is a neat tool to work with binding jar-files and much more.

To install the Verisure biinding you must place the jar-file in the /usr/share/openhab2/addons folder.

Then start the console by typing openhab-cli console, if you are prompted to enter password use habopen:

[20:08:24] openhabian@openhab:~$ openhab-cli console

Logging in as openhab
Password:  

                          __  _____    ____      
  ____  ____  ___  ____  / / / /   |  / __ )     
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
    /_/                        2.5.0.M5
                               Milestone Build   

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

You can then check if you are running the Verisure binding bu issuing the
bundle:list | grep Verisure command:

openhab> bundle:list |grep Verisure                                                                                                                                                                      
244 │ Active │  80 │ 2.5.0.201912010202      │ openHAB Add-ons :: Bundles :: Verisure Binding

In this case the binding is already running and its state is Active. If you want to replace the jar-file with a later version, I perform these steps:

openhab> bundle:stop 244
openhab> bundle:uninstall 244                                                                                                                                                          
openhab> bundle:list |grep Verisure
openhab> bundle:install -s file:/usr/share/openhab2/addons/org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar
Bundle ID: 245
openhab> bundle:list |grep Verisure
245 │ Active │  80 │ 2.5.0.201912010202      │ openHAB Add-ons :: Bundles :: Verisure Binding

If it is your first installation of the Verisure binding, you only have to perform the bundle:install step.

If you get an error when performing the bundle:install complaining about an Unresolved requirement that the binding-jar fails to resolve the com.google.json, then perfrom the following steps:

openhab> bundle:install -s file:/usr/share/openhab2/addons/org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar
Bundle ID: 333
Error executing command: Error installing bundles:
	Unable to start bundle file:/usr/share/openhab2/addons/org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar: org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.verisure [333]
  Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

openhab> bundle:install http://central.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar                                                                                                      
Bundle ID: 334
openhab> bundle:restart 333
openhab> bundle:list -s |grep veris
333 │ Active    │  80 │ 2.5.0.201912010202     │ org.openhab.binding.verisure

Then when the binding status is Active it is time to launch the PaperUI to create a Verisure Bridge.
Choose Configuration/Bindings and then you should see the Verisure Binding listed:

Then click on Configuration/Things and the ‘+’ button and select the Verisure binding and then the Verisure Bridge, then configure according to README.
When the Verisure Bridge thing is Online (you need to press the refresh button)

You can let the auto-discovery find all your other Verisure things by clicking on Inbox and the + button and Verisure Binding, then press the refresh-button.

It is also possible to configure the Verisure bridge and things in a so called things-file, but that is out of scope for this post.

If you run into problems, the Verisure log is very handy for me to try to figure out what has gone wrong. It is also possible to set log levels in the console, and to really know what’s going on you need to set the log level to DEBUG:

openhab> log:set DEBUG org.openhab.binding.verisure
openhab> log:tail org.openhab.binding.verisure

Read more about logging here.

1 Like

Thank you so much. Finally it worked!

Wow, thanks! That really helped.

Stupid question maybe. How do I exit out of the console, back to the ssh-session?

Type logout or Ctrl-d to exit console.

New jar-file built due to fixing code review comments.

[10:24:54] openhabian@openhab:/usr/share/openhab2/addons$ md5sum org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar 
6f3b3c83f4803a224e49b820fd1f0c9a  org.openhab.binding.verisure-2.5.0-SNAPSHOT.jar

README.

I got small hopes for the binding being included in OH 2.5.0 due for release next week, but I will not give up hope for it being included in an upcoming official OH release. Thanks for all support and tests during this year! :slight_smile:

2 Likes

Thank you Jan! Your binding is awesome, use it with success since months now! :slight_smile: Merry x-mas!

/Chris

1 Like

Great work Jan, thanks again!

One small remark about the README: :grin:
In the channel definitions, the alarm status is defined as a Number:

Channel Type ID Item type Description
alarmStatus Number This channel is used to arm/disarm the alarm. Available alarm status are “DISARMED”, “ARMED_HOME” and “ARMED_AWAY”.

and in the example it is shown as a String:

String AlarmHome "Alarm Home" <alarm> {channel="verisure:alarm:myverisure:JannesAlarm:alarmStatus"}

Good find, I’ll fix! :slight_smile:

1 Like