New openHAB2 Binding for Nuki Smart Locks

openhab2
binding
Tags: #<Tag:0x00007fe057c29900> #<Tag:0x00007fe057c29590>

(Stefan) #81

ahh thats perhaps the hint.

I tried the binding half year ago but with callback

http://192.168.123.123:8080/callback/add?http://openhabhost.my.domain:8080/nuki/bcb&token=123456

so I will give the binding an additional try.

I will test it on the weekend.

@gittyhub2 thanks a lot


(Stefan) #82

@gittyhub2 it dosn´t work, no update via callback yet.

Read existing callbacks on lock

http://<IP-Adresse-NUKI-Bridge>:8080/callback/list?token=123456

thats the entry:

{"callbacks": [{"id": 0, "url": "http://<IP-Adresse-OPENHAB>:8080/nuki/bcb"}]}

I set it with:

http://<IP-Adresse-NUKI-Bridge>:8080/callback/add?url=http%3A%2F%2F<IP-Adresse-OPENHAB>%3A8080%2Fnuki%2Fbcb&token=123456

BUT then:

I had a websession with an engineer (Aeotec - also great JOB) for my Z-Wave problem and I had to reboot the Raspi two times.

WTF: It works!!! The Callback from Nuki Bridge WORKS!!!

So i think, after all the configuration you need a reboot of openhab server.

SOLVED


(Alexander) #83

:+1:


(Falk S.) #84

Same problem with callback but did try everything mentioned here.
OH is 2.3 stable, Nuki binding 2.1.

I have set up call back and checked it with the list function:

{“callbacks”: [{“id”: 0, “url”: “http://192.168.17.3:8080/nuki/bcb”}]}

Sending this request to openhab shows

{“status”:“OK”}

with log showing

13:29:34.150 [WARN ] [.internal.dataexchange.NukiApiServlet] - Could not handle request! Message[null]
java.lang.NullPointerException: null
at org.openhab.binding.nuki.internal.dataexchange.NukiApiServlet.service(NukiApiServlet.java:112) [190:org.openhab.binding.nuki:2.1.0.201705112100]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [31:javax.servlet-api:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.3.21.v20170918]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.21.v20170918]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]
at java.lang.Thread.run(Unknown Source) [?:?]

I don’t get any status updates on the actions I trigger. E.g. “lock state” remains “closing” and never switches to “closed”. Actions work well.
Rebooted bridge and OH server already.
What am I missing?

Thanks a lot


(Falk S.) #85

New info: enabled trace and found the communication to happen but the items are not been updated:

20:48:33.736 [DEBUG] [ing.nuki.handler.NukiSmartLockHandler] - Command[4] succeeded for channelUID[nuki:smartlock:NukiBridge:Ef_Haustuer_Lock:lockAction]
20:48:38.584 [DEBUG] [.internal.dataexchange.NukiApiServlet] - NukiApiServlet:service URI[/nuki/bcb] request[Request(POST //192.168.17.3/nuki/bcb)@11f6d82]
20:48:38.597 [TRACE] [.internal.dataexchange.NukiApiServlet] - requestContent[{"nukiId": 335452561, "state": 1, "stateName": "locked", "batteryCritical": false}]

How can I enable the binding to update the status of the items?


(Falk S.) #86

@binderth, did you find a solution to the “no update of status” problem in the meanwhile?


(Thomas Binder) #87

sorry for the delay!
to be frank, I didn’t pursue this issue any further… My Mom is a better Status indicator than I am! She’s got the Nuki App and tells me battery Status when she receives the notification! :wink:

… but as the days get Shorter, I try to find some time for my OH2 Installation and tweaking stuff.

but: what I noticed lately, that my Nuki Bridge oftentimes doesn’t find the Nuki Smart Lock or whatever that 503-error means:

2018-10-18 16:32:32.195 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.state)' threw an exception. [response={"success": false}]
org.openhab.core.transform.TransformationException: Invalid path '$.state' in '{"success": false}'
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [218:org.openhab.binding.http:1.12.0]
	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [194:org.openhab.core.compat1x:2.3.0]
2018-10-18 16:32:32.203 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.batteryCritical)' threw an exception. [response={"success": false}]
org.openhab.core.transform.TransformationException: Invalid path '$.batteryCritical' in '{"success": false}'
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [218:org.openhab.binding.http:1.12.0]
	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [194:org.openhab.core.compat1x:2.3.0]
2018-10-18 16:32:33.256 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation 'JSONPATH($.stateName)' threw an exception. [response={"success": false}]
org.openhab.core.transform.TransformationException: Invalid path '$.stateName' in '{"success": false}'
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:194) [218:org.openhab.binding.http:1.12.0]
	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [194:org.openhab.core.compat1x:2.3.0]
	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [194:org.openhab.core.compat1x:2.3.0]

that one isn’t from the callback, but from the API, if I try to open the door. sometimes it works in first attempt, sometimes you need a second or even third attempt to open the door via API.


(Markus) #88

@Falk This looks perfectly fine! Any odd log lines after this?


(Markus) #89

@binderth 503 means that the Smart Lock is offline (SL and Bridge are not able to communicate). Try to find a better place for your bridge (e.g. closer to the SL, direct visibility range, etc)


(Thomas Binder) #90

The Bridge is 1.5m away. With free sight… the errors appeared after the latest FW update.


(Markus) #91

Well, then report this problem to Nuki (contact@nuki.io)!
You did already? No, you didn’t! :wink:

Joke aside, a product can just be improved if the maker gets feedback and therefore knows about the probs!


(Falk S.) #92

@mkatter Nothing nuki related. Can’t see any error messages. Did not work with the binding version 2.4 either (still OH 2.3 stable). Have implemented a workaround via IFTTT and get the status from there (door status closed/open).

Is it supposed to be working since @binderth seems to have the same issue?


(Thomas Binder) #93

I contacted you like 10times on several issues on my Nuki… :wink:
In the mean time I got two replacement Smart Locks - I hope your v2 Upgrade-plan for firsttime users (I was a Kickstarter from day one) is a real deal.
But if you think it helps - I’ll file an issue again, but first I have to make a few thorough tests! :wink:


(Thomas Binder) #94

IFTTT is ok for non-realtime use because of immense lagging. I’m still waiting for a Nuki Binding - or for some time for setting up rules and stuff of my own.


(Markus) #95

@binderth @Falk I just pushed some changes to the PR. Please download and install the current build and send some feedback!

The link for the current dev build is in the first post!


(Stefan) #96

@mkatter
Do you have a release or feature note of changes?
What kind of JAR (2.1.0 or 2.4.0) for 2.3.0 stable build version should I use?
Is there any side effect if I use the newer JAR file? Now I use 2.1.0 (org.openhab.binding.nuki-2.1.0-SNAPSHOT.jar) and it works perfectly. No problems.


(Markus) #97

@The-Elk I’m running Raspbian Jessie, openHAB 2.3.0 (via apt, stable) and org.openhab.binding.nuki-2.4.0-SNAPSHOT.jar. Please see the README.md how to config the binding.


(Falk S.) #98

@mkatter thanks for providing an updated version. I guess this works with OH2.4 (it doesn’t with 2.3) therefore I need to update my system first. Will try and keep you posted …


(Markus) #99

@Falk As I already said, I am running the current org.openhab.binding.nuki-2.4.0-SNAPSHOT.jar on openHAB 2.3 on a Raspberry Pi (yesterday manually upgraded to Raspbian Stretch).

pi@RasPi2:~ $ cat /var/lib/openhab2/etc/version.properties
openHAB Distribution Version Information
----------------------------------------
build-no        : Release Build
online-repo     : https://dl.bintray.com/openhab/mvn/online-repo/2.3

Repository        Version
----------------------------------------
openhab-distro  : 2.3.0
smarthome       : 0.10.0.oh230
openhab-core    : 2.3.0
openhab1-addons : 1.12.0
openhab2-addons : 2.3.0
karaf           : 4.1.5

If the binding is “not working” for you, please post logs on trace level, thx!


(Falk S.) #100

@mkatter sorry for the confusion. I just realized that channels changed between versions.

This version of the binding works for me and the status is being updated as well! :smile:
I can also confirm your data of version.properties. Have same setup here.

Thanks
Falk