heggink / domoticz-nuki

python plugin for the nuki locks
MIT License
9 stars 5 forks source link

NUKI HTTPError code: 403 #2

Closed salopette closed 4 years ago

salopette commented 4 years ago

2019-10-13 10:41:24.448 Status: (Nuki) Stop directive received. 2019-10-13 10:41:24.449 Status: (Nuki) Exiting work loop. 2019-10-13 10:41:24.649 Status: (Nuki) Stopping threads. 2019-10-13 10:41:24.649 Status: (Nuki) Stopped. 2019-10-13 10:41:24.649 Status: (Nuki) Started. 2019-10-13 10:41:25.065 (Nuki) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL 2019-10-13 10:41:25.065 (Nuki) 'DomoticzVersion':'4.11361' 2019-10-13 10:41:25.065 (Nuki) 'Name':'Nuki' 2019-10-13 10:41:25.065 (Nuki) 'Mode4':'8080' 2019-10-13 10:41:25.065 (Nuki) 'HardwareID':'24' 2019-10-13 10:41:25.065 (Nuki) 'Mode2':'MY TOKEN' 2019-10-13 10:41:25.065 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-10-13 10:41:25.065 (Nuki) 'Port':'8008' 2019-10-13 10:41:25.065 (Nuki) 'DomoticzBuildTime':'2019-10-11 16:42:44' 2019-10-13 10:41:25.065 (Nuki) 'DomoticzHash':'1872f7e5d' 2019-10-13 10:41:25.065 (Nuki) 'Mode3':'10' 2019-10-13 10:41:25.065 (Nuki) 'Mode1':'192.168.178.126' 2019-10-13 10:41:25.066 (Nuki) 'Language':'de' 2019-10-13 10:41:25.066 (Nuki) 'Key':'NukiLock' 2019-10-13 10:41:25.066 (Nuki) 'Author':'heggink' 2019-10-13 10:41:25.066 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-10-13 10:41:25.066 (Nuki) 'Mode6':'File' 2019-10-13 10:41:25.066 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-10-13 10:41:25.066 (Nuki) 'Version':'1.0.5' 2019-10-13 10:41:25.066 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-10-13 10:41:25.066 (Nuki) Device count: 0 2019-10-13 10:41:25.066 (Nuki) My IP is 192.168.178.37 2019-10-13 10:41:25.066 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-10-13 10:41:25.066 (Nuki) REQUESTING http://192.168.178.126:8080/list?token=MY TOKEN 2019-10-13 10:41:25.063 Status: (Nuki) Initialized version 1.0.5, author 'heggink' 2019-10-13 10:41:25.062 Status: (Nuki) Entering work loop. 2019-10-13 10:41:25.221 Error: (Nuki) NUKI HTTPError code: 403 2019-10-13 10:41:29.296 (Mi Alarmanlage) Light/Switch (Flur Motion Sensor) 2019-10-13 10:41:35.066 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-10-13 10:41:35.110 (Nuki) Processing 'onHeartbeatCallback' message 2019-10-13 10:41:35.110 (Nuki) Calling message handler 'onHeartbeat'. 2019-10-13 10:41:35.111 (Nuki) onHeartbeat called 1

salopette commented 4 years ago

2019-10-13 10:41:45.068 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-10-13 10:41:45.111 (Nuki) Processing 'onHeartbeatCallback' message 2019-10-13 10:41:45.112 (Nuki) Calling message handler 'onHeartbeat'. 2019-10-13 10:41:45.113 (Nuki) onHeartbeat called 2

2019-10-13 10:41:55.069 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-10-13 10:41:55.113 (Nuki) Processing 'onHeartbeatCallback' message 2019-10-13 10:41:55.113 (Nuki) Calling message handler 'onHeartbeat'. 2019-10-13 10:41:55.113 (Nuki) onHeartbeat called 3

2019-10-13 10:42:05.071 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-10-13 10:42:05.078 (Nuki) Processing 'onHeartbeatCallback' message 2019-10-13 10:42:05.079 (Nuki) Calling message handler 'onHeartbeat'. 2019-10-13 10:42:05.079 (Nuki) onHeartbeat called 4

salopette commented 4 years ago

2019-10-13 10:45:15.851 Status: (Nuki) Stop directive received. 2019-10-13 10:45:15.851 Status: (Nuki) Exiting work loop. 2019-10-13 10:45:16.475 (Nuki) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL 2019-10-13 10:45:16.475 (Nuki) 'DomoticzVersion':'4.11361' 2019-10-13 10:45:16.475 (Nuki) 'Name':'Nuki' 2019-10-13 10:45:16.475 (Nuki) 'Mode4':'8080' 2019-10-13 10:45:16.475 (Nuki) 'HardwareID':'24' 2019-10-13 10:45:16.475 (Nuki) 'Mode2':'MY TOKEN' 2019-10-13 10:45:16.475 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-10-13 10:45:16.475 (Nuki) 'Port':'8008' 2019-10-13 10:45:16.475 (Nuki) 'DomoticzBuildTime':'2019-10-11 16:42:44' 2019-10-13 10:45:16.475 (Nuki) 'DomoticzHash':'1872f7e5d' 2019-10-13 10:45:16.476 (Nuki) 'Mode3':'10' 2019-10-13 10:45:16.476 (Nuki) 'Mode1':'192.168.178.126' 2019-10-13 10:45:16.476 (Nuki) 'Language':'de' 2019-10-13 10:45:16.476 (Nuki) 'Key':'NukiLock' 2019-10-13 10:45:16.476 (Nuki) 'Author':'heggink' 2019-10-13 10:45:16.476 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-10-13 10:45:16.476 (Nuki) 'Mode6':'Debug' 2019-10-13 10:45:16.476 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-10-13 10:45:16.476 (Nuki) 'Version':'1.0.5' 2019-10-13 10:45:16.476 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-10-13 10:45:16.476 (Nuki) Device count: 0 2019-10-13 10:45:16.476 (Nuki) My IP is 192.168.178.37 2019-10-13 10:45:16.476 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-10-13 10:45:16.476 (Nuki) REQUESTING http://192.168.178.126:8080/list?token=MY TOKEN 2019-10-13 10:45:16.052 Status: (Nuki) Stopping threads. 2019-10-13 10:45:16.052 Status: (Nuki) Stopped. 2019-10-13 10:45:16.052 Status: (Nuki) Started. 2019-10-13 10:45:16.473 Status: (Nuki) Entering work loop. 2019-10-13 10:45:16.473 Status: (Nuki) Initialized version 1.0.5, author 'heggink' 2019-10-13 10:45:16.598 Error: (Nuki) NUKI HTTPError code: 403

heggink commented 4 years ago

2019-10-13 10:41:25.066 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-10-13 10:41:25.066 (Nuki) REQUESTING http://192.168.178.126:8080/list?token=MY TOKEN 2019-10-13 10:41:25.221 Error: (Nuki) NUKI HTTPError code: 403

These messages indicate that your domoticz installation is on IP 192.168.178.37 and the callback port is 8008 (the port that domoticz will listen on for status messages from the lock).

Then the plugin reaches out to the nuki bridge on IP 192.168.178.126 with port 8080 (as you configured when putting it in development mode which gave you the bridge token) but gets an HTTP 403 error indicating the action is forbidden.

Can you let me know what platform you are running on? If on any linux flavour, can you run that command by hand in a command shell? The command http://192.168.178.126:8080/list?token=MY TOKEN should return with a list of locks installed in the bridge. You could run it with the command curl -s " http://192.168.178.126:8080/list?token=MY TOKEN"

Let me know how it works. H

salopette commented 4 years ago

That's the curl issue

HTTP 403 Forbiddenpi@raspberrypi:~ $

I use last Domoticz Beta on Pi3b +

heggink commented 4 years ago

OK, good, I run on pi3b+ too.

Here's what the API documentation says: Once a bridge has been discovered on the LAN the API can be activated and the API token retrieved by calling the /auth command. The user has to confirm this request by pressing the button on the bridge. For more details see the description of the /auth command. Alternatively you can activate the API and set the token by managing the Bridge in the Nuki App.

If discovery is disabled via /configAuth or through the Nuki App, the IP is 0.0.0.0 and the port 0. In this case the /auth command fails with HTTP error 403.

This seems to indicate that a 403 is returned if you did not activate the API in the nuki app...

heggink commented 4 years ago

as per the readme: This plugin requires python modules json and urllib It also requires all the locks to be assigned to the bridge and for the bridge to be put in developer mode in order to use the HTTP API

heggink commented 4 years ago

you can do that in the app somewhere

salopette commented 4 years ago

Thanks for the tip with the app, I always tried to generate the bucket on the website.

https://web.nuki.io/de/#/admin/web-api

salopette commented 4 years ago

2019-10-15 20:23:20.928 Status: (Nuki) Stop directive received. 2019-10-15 20:23:20.928 Status: (Nuki) Exiting work loop. 2019-10-15 20:23:21.553 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-10-15 20:23:21.128 Status: (Nuki) Stopping threads. 2019-10-15 20:23:21.128 Status: (Nuki) Stopped. 2019-10-15 20:23:21.128 Status: (Nuki) Started. 2019-10-15 20:23:21.550 Status: (Nuki) Entering work loop. 2019-10-15 20:23:21.550 Status: (Nuki) Initialized version 1.0.5, author 'heggink' 2019-10-15 20:24:00.875 Error: (Nuki) 'onStart' failed 'RemoteDisconnected'. 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 345 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 161 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 1282 in '/usr/lib/python3.5/urllib/request.py', function http_open 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 1215 in '/usr/lib/python3.5/http/client.py', function getresponse 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 297 in '/usr/lib/python3.5/http/client.py', function begin 2019-10-15 20:24:00.876 Error: (Nuki) ----> Line 266 in '/usr/lib/python3.5/http/client.py', function _read_status

heggink commented 4 years ago

it looks like you need to restart domoticz as this time, it doesn't even start the plugin at all as no debug messages are there, only framework python errors... Are you still on python 3.5? EDIT: Ignore, I am on 3.5.3 as well.

salopette commented 4 years ago

2019-10-17 04:57:46.070 Error: dzVents: Error: (2.4.29) Discarding device. No last update info found: {["rawData"]={"Locked"}, ["switchTypeValue"]=19, ["batteryLevel"]=0, ["deviceID"]="", ["id"]=4132, ["deviceType"]="Light/Switch", ["description"]="", ["baseType"]="device", ["data"]={["_state"]="Locked", ["hardwareType"]="Nuki Lock Plugin", ["_nValue"]=1, ["hardwareTypeValue"]=94, ["icon"]="door", ["hardwareID"]=1962523184, ["usedByCamera"]=false, ["protected"]=false, ["maxDimLevel"]=100, ["internalState"]="Locked", ["unit"]=1, ["levelVal"]=0, ["hardwareName"]="Nuki"}, ["switchType"]="Door Lock", ["signalLevel"]=0, ["lastLevel"]=255, ["name"]="Nuki - Haustür", ["changed"]=true, ["protected"]=false, ["lastUpdate"]="", ["timedOut"]=false, ["subType"]="Switch"} 2019-10-17 04:57:56.066 (RFLink-Getway) Temp + Humidity (Aussen) 2019-10-17 04:58:21.144 (Mi WC Gatway) General/kWh (Xiaomi Smart Plug Usage) 2019-10-17 04:58:34.974 (Mi Alarmanlage) Light/Switch (Flur Motion Sensor) 2019-10-17 04:58:51.710 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-10-17 04:58:51.712 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-10-17 04:58:51.713 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-10-17 04:59:05.716 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-10-17 04:59:05.716 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-10-17 04:59:05.716 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-10-17 04:59:14.383 MQTT: Topic: domoticz/in, Message: {"idx":338,"nvalue":0,"svalue":"20.9;61.3;1","Battery":200,"RSSI":7} 2019-10-17 04:59:19.719 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-10-17 04:59:19.719 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-10-17 04:59:19.719 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-10-17 04:59:33.722 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-10-17 04:59:33.723 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-10-17 04:59:33.723 Error: Nuki hardware (24) thread seems to have ended unexpectedly

heggink commented 4 years ago

You get these errors if one of the plugins is in a waiting state. This does not mean that the plugin has ended but seems that way. Any other messages?

salopette commented 4 years ago

I have no other messages, Domoticz then hangs up, just help restart.

Can that be that it has conflict with the other plugins because of port 443?

heggink commented 4 years ago

As indicated above, the plugin reaches out to the bridge and does that in a synchronous way (it waits for the response from the bridge first time). You can check that manually by running the curl command to list the locks in the bridge using the bridge IP, port and bridge token you got from the app. That should give a response from the bridge. If that locks then Domoticz locks until a timeout is received. So try the curl command by hand and let me know what happened.

heggink commented 4 years ago

Any update?

salopette commented 4 years ago

Hi, I have not had time to try it yet.

salopette commented 4 years ago

here is the same problem https://github.com/frustreermeneer/domoticz-wled-plugin/issues/3

heggink commented 4 years ago

It's not the same problem, it's a problem with the same behaviour. As per my Oct 17th comment, please check using the curl command whether you can access the bridge from outside domoticz using the parameters you entered in the plugin. If you can access the bridge from curl then it should work from domoticz as well. If you can;t then that's info I can work with. Please also send me a screen shot of all parameters in the plugin...

salopette commented 4 years ago

How do I do that with curl?

salopette commented 4 years ago

When I start your plugin, the others will go offline. (Shelly, Deconz)

2019-11-18 21:07:03.668 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:07:17.671 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:07:17.672 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:07:17.672 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:07:31.675 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:07:31.675 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:07:31.675 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:07:45.678 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:07:45.678 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:07:45.678 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:07:48.289 MQTT: Topic: domoticz/in, Message: {"idx":338,"nvalue":0,"svalue":"20.4;59.0;1","Battery":200,"RSSI":9} 2019-11-18 21:07:59.681 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:07:59.681 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:07:59.681 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:08:13.684 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:08:13.685 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:08:13.686 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:08:27.689 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:08:27.689 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:08:27.689 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-18 21:08:41.692 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-18 21:08:41.692 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-18 21:08:41.692 Error: Nuki hardware (24) thread seems to have ended unexpectedly

salopette commented 4 years ago

And then depends also domiticz. Just help restart and turn off Nuki plugin

heggink commented 4 years ago

Can you send me what you filled in on the plugin config screen? If you send me a screen shot, I will tell you how to issue the curl command and you can give me the output. The plugin only issues http statements that you can also issue from any browser (or curl). That's the simplest way to figure out what's not working. I am sure we can get it to work without these "has died unexpectedly" messages.

salopette commented 4 years ago

Unbenannt

heggink commented 4 years ago

OK, so you should be able to issue the following command: curl -s "http://192.168.178.126:8080/info?token=FILLINYOURTOKEN" replace FILLINYOURTOKEN with the token blanked out above. If you don't want to use curl, you can also just type in the following in any browser: http://192.168.178.126:8080/info?token=FILLINYOURTOKEN

This should make the bridge return some data to you including its version, current time and so on.

Let me know if that works.

as an example, here's mine: {"bridgeType": 1, "ids": {"hardwareId": 91185425, "serverId": 149714647}, "versions": {"firmwareVersion": "1.13.1", "wifiFirmwareVersion": "1.2.0"}, "uptime": 7021412, "currentTime": "2019-11-18T20:50:38+00:00", "serverConnected": true, "scanResults": [{"deviceType": 0, "nukiId": 12345678, "name": "Nuki_123AB4C5", "rssi": -79, "paired": true}]}

heggink commented 4 years ago

Also, can you make sure that the port you specified for domoticz to listen on (8008) is actually free: sudo lsof -i -P -n | grep LISTEN | grep 8008

I personally use a port in the 15000 range (like 15002) which is usually free but of 8008 is free on your domoticz system then that should not be a problem.

heggink commented 4 years ago

In case you are interested, the full http API can be found here: https://developer.nuki.io/uploads/short-url/tRDQAiAtFYD48qE0uM257632p2y.pdf

salopette commented 4 years ago

http://192.168.178.126:8080/info?token=xxxxx

{"bridgeType": 1, "ids": {"hardwareId": 442572602, "serverId": 1891xxxxxxx}, "versions": {"firmwareVersion": "2.2.13", "wifiFirmwareVersion": "2.0.0"}, "uptime": 48713, "currentTime": "2019-11-19T17:14:08+00:00", "wlanConnected": true, "serverConnected": true, "scanResults": [{"deviceType": 0, "nukiId": 449156989, "name": "Nuki_1AC5xxxxx", "rssi": -64, "paired": true}]}

hi, so the command works in the browser, but not on the Pi

salopette commented 4 years ago

So the curl command does not work.

heggink commented 4 years ago

Ah. Progress. can you try if curl works at all? Assuming the command is installed, can you try curl -s "www.google.com" ? Can you ping the bridge (ping 192.168.178.126)? If that doesn't work, my assumption is that something is wrong with (some of) your installation. You must have installed the python urllib and json libraries (as per the installation instructions) as, otherwise, the plugin would have borked on the import statement. We're getting somewhere...

heggink commented 4 years ago

maybe also have a look at: https://www.raspberrypi.org/forums/viewtopic.php?t=239869 shows a solution for a borked curl installation.

salopette commented 4 years ago

pi@raspberrypi:~ $ curl -s "www.google.com" <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="de"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/logos/doodles/2019/200th-anniversary-of-museo-del-prado-4899096010686464.3-l.png" itemprop="image"><meta content="200.▒Jahrestag des Museo del Prado" property="twitter:title"><meta content="200.▒Jahrestag des Museo del Prado #GoogleDoodle" property="twitter:description"><meta content="200.▒Jahrestag des Museo del Prado #GoogleDoodle" property="og:description"><meta content="summary_large_image" property="twitter:card"><meta content="@GoogleDoodles" property="twitter:site"><meta content="https://www.google.com/logos/doodles/2019/200th-anniversary-of-museo-del-prado-4899096010686464.2-2x.png" property="twitter:image"><meta content="https://www.google.com/logos/doodles/2019/200th-anniversary-of-museo-del-prado-4899096010686464.2-2x.png" property="og:image"><meta content="1260" property="og:image:width"><meta content="440" property="og:image:height"><title>Google</title><script nonce="i+dSxldm9Zn2ej9Wbsc2zg==">(function(){window.google={kEI:'HS3UXaKqC8icsAeKnZKwAQ',kEXPI:'0,1353746,5662,732,223,510,245,820,3152,377,207,1017,2187,10,169,544,338,96,111,7,325,926,16,493,4,657,95,30,121,24,1129561,143,1197712,437,329118,1294,12383,4855,32692,15247,867,19398,9286,369,524,2790,5505,6365,2019,1119,2,579,727,2431,1362,4323,3696,1272,773,2250,4744,2902,216,6196,1719,1808,1976,2044,8909,4209,2,1086,2016,38,920,873,1217,2975,2736,1558,2136,3240,4192,3874,2884,16,322,234,3913,1,371,2777,517,400,992,1285,8,85,2711,887,80,601,11,14,667,612,2212,202,37,286,5,1252,840,324,193,1466,8,48,158,662,3438,108,152,52,1137,2,2669,1839,184,595,1702,1704,243,418,329,429,44,1009,93,328,1284,16,84,336,81,2426,1639,607,474,1339,748,209,830,3094,133,773,1548,524,7,728,89,503,1574,1832,82,1,1479,1345,770,5028,663,52,2244,588,258,214,367,60,51,120,125,228,456,1042,1177,1282,218,798,43,565,1064,280,562,1475,113,1505,1222,1136,164,132,1001,581,72,338,143,447,362,99,2,432,1238,243,402,42,2,1,3,249,576,262,105,128,625,128,4,988,259,6,6,253,326,20,74,9,246,95,16,253,10,252,9,1,83,2,119,7,2,922,12,766,72,1022,34,6,122,59,8,872,161,64,94,186,587,1468,80,139,177,1,5867838,1873,1259,1802762,4194851,1,2799594,4,1572,549,333,444,1,2,80,1,900,896,1,8,1,2,2551,1,889,59,736,2,561,1,4264,1,1,1,1,1,3,7,357,16,1,1,9,2,2,49,4,43,1,1,6,2,2,16,1,20745192,3220019',authuser:0,kscs:'c9c918f0_HS3UXaKqC8icsAeKnZKwAQ',kGL:'DE',kBL:'7xjy'};google.sn='webhp';google.kHL='de';google.jsfs='Ffpdje';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};google.ml=function(){return null};google.time=function(){return(new Date).getTime()};google.log=function(a,b,e,c,g){if(a=google.logUrl(a,b,e,c,g)){b=new Image;var d=google.lc,f=google.li;d[f]=b;b.onerror=b.onload=b.onabort=function(){delete d[f]};google.vel&&google.vel.lu&&google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,e,c,g){var d="",f=google.ls||"";e||-1!=b.search("&ei=")||(d="&ei="+google.getEI(c),-1==b.search("&lei=")&&(c=google.getLEI(c))&&(d+="&lei="+c));c="";!e&&google.cshid&&-1==b.search("&cshid=")&&"slh"!=a&&(c="&c

salopette commented 4 years ago

pi@raspberrypi:~ $ curl -s "http://192.168.178.126:8080/info?token=xxxxxx" {"bridgeType": 1, "ids": {"hardwareId": 4425xxxxx, "serverId": 18913xxxxx}, "versions": {"firmwareVersion": "2.2.13", "wifiFirmwareVersion": "2.0.0"}, "uptime": 51368, "currentTime": "2019-11-19T17:59:45+00:00", "wlanConnected": true, "serverConnected": true, "scanResults": [{"deviceType": 0, "nukiId": 449156989, "name": "Nuki_1ACxxxxx", "rssi": -75, "paired": true}]}pi@raspberrypi:~ $

heggink commented 4 years ago

ah, so curl is working now! great. That shows the bridge is up and accessible. Can you try the following: curl -s "http://192.168.178.126:8080/callback/list?token=YOURTOKEN"

That should should return a JSON message indicating the callbacks installed in the bridge.

salopette commented 4 years ago

pi@raspberrypi:~ $ curl -s "http://192.168.178.126:8080/callback/list?token=xxxxxx" {"callbacks": []}pi@raspberrypi:~ $

heggink commented 4 years ago

Ah, also good so the lock reports no callbacks installed just yet. Now can you check if the 8008 callback port is actually available? issue the command: sudo lsof -i -P -n | grep LISTEN | grep 8008 There should be no output. If there is then please paste it.

salopette commented 4 years ago

pi@raspberrypi:~ $ sudo lsof -i -P -n | grep LISTEN | grep 8008 sudo: lsof: Befehl nicht gefunden pi@raspberrypi:~ $

heggink commented 4 years ago

ah, you need to install lsof first: sudo apt install lsof

salopette commented 4 years ago

pi@raspberrypi:~ $ sudo lsof -i -P -n | grep LISTEN | grep 8008 pi@raspberrypi:~ $

heggink commented 4 years ago

also good so the callback port is free. In summary, your bridge is up and running, it has your lock configured, it listens to the API commands which means it's in developer mode so all the prerequisites are satisfied. That means that everything 'should' work. Since you are on dzvents 2.4.29, you seem to be on a pretty recent version of domoticz so that should also not be a problem. Frankly, I don't see why it shouldn't work. Would you mind enabling the plugin one more time and capture all the plugin output for me? Maybe I can see something I have not seen or missed before.

salopette commented 4 years ago

2019-11-19 21:15:40.762 Status: (Nuki) Started. 2019-11-19 21:15:41.243 (Nuki) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL 2019-11-19 21:15:41.243 (Nuki) 'Key':'NukiLock' 2019-11-19 21:15:41.243 (Nuki) 'Mode2':'xxxxxx' 2019-11-19 21:15:41.243 (Nuki) 'Mode6':'Debug' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzHash':'01271c298' 2019-11-19 21:15:41.243 (Nuki) 'Port':'8008' 2019-11-19 21:15:41.243 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-11-19 21:15:41.243 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.243 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-11-19 21:15:41.243 (Nuki) 'HardwareID':'24' 2019-11-19 21:15:41.243 (Nuki) 'Mode1':'192.168.178.126' 2019-11-19 21:15:41.243 (Nuki) 'Name':'Nuki' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzBuildTime':'2019-11-19 17:02:22' 2019-11-19 21:15:41.243 (Nuki) 'Mode4':'8080' 2019-11-19 21:15:41.243 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzVersion':'4.11501' 2019-11-19 21:15:41.243 (Nuki) 'Language':'de' 2019-11-19 21:15:41.243 (Nuki) 'Version':'1.0.5' 2019-11-19 21:15:41.243 (Nuki) 'Author':'heggink' 2019-11-19 21:15:41.243 (Nuki) 'Mode3':'10' 2019-11-19 21:15:41.244 (Nuki) Device count: 1 2019-11-19 21:15:41.244 (Nuki) Device: 1 - ID: 4132, Name: 'Nuki - Haustür', nValue: 0, sValue: 'Unlocked' 2019-11-19 21:15:41.244 (Nuki) Device ID: '4132' 2019-11-19 21:15:41.244 (Nuki) Device Name: 'Nuki - Haustür' 2019-11-19 21:15:41.244 (Nuki) Device nValue: 0 2019-11-19 21:15:41.244 (Nuki) Device sValue: 'Unlocked' 2019-11-19 21:15:41.244 (Nuki) Device LastLevel: 0 2019-11-19 21:15:41.244 (Nuki) My IP is 192.168.178.37 2019-11-19 21:15:41.244 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-11-19 21:15:41.244 (Nuki) REQUESTING http://192.168.178.126:8080/list?token=xxxxxx 2019-11-19 21:15:41.498 (Nuki) Lock list received [{"deviceType": 0, "nukiId": 44915xxxx, "name": "Haustür", "lastKnownState": {"mode": 2, "state": 3, "stateName": "unlocked", "batteryCritical": false, "timestamp": "2019-11-19T18:33:37+00:00"}}] 2019-11-19 21:15:41.498 (Nuki) I count 1 locks 2019-11-19 21:15:41.498 (Nuki) Lock Haustür already exists. 2019-11-19 21:15:41.498 (Nuki) Lock batt False 2019-11-19 21:15:41.498 (Nuki) Lock stateName unlocked 2019-11-19 21:15:41.498 (Nuki) Lock state 3 2019-11-19 21:15:41.499 (Nuki - Haustür) Updating device from 0:'Unlocked' to have values 0:'Unlocked'. 2019-11-19 21:15:41.505 (Nuki) Lock(s) created 2019-11-19 21:15:41.505 (Nuki) 'Key':'NukiLock' 2019-11-19 21:15:41.505 (Nuki) 'Mode2':'xxxxxx' 2019-11-19 21:15:41.505 (Nuki) 'Mode6':'Debug' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzHash':'01271c298' 2019-11-19 21:15:41.505 (Nuki) 'Port':'8008' 2019-11-19 21:15:41.505 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-11-19 21:15:41.505 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.505 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-11-19 21:15:41.505 (Nuki) 'HardwareID':'24' 2019-11-19 21:15:41.505 (Nuki) 'Mode1':'192.168.178.126' 2019-11-19 21:15:41.505 (Nuki) 'Name':'Nuki' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzBuildTime':'2019-11-19 17:02:22' 2019-11-19 21:15:41.505 (Nuki) 'Mode4':'8080' 2019-11-19 21:15:41.505 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzVersion':'4.11501' 2019-11-19 21:15:41.505 (Nuki) 'Language':'de' 2019-11-19 21:15:41.506 (Nuki) 'Version':'1.0.5' 2019-11-19 21:15:41.506 (Nuki) 'Author':'heggink' 2019-11-19 21:15:41.506 (Nuki) 'Mode3':'10' 2019-11-19 21:15:41.506 (Nuki) Device count: 1 2019-11-19 21:15:41.506 (Nuki) Device: 1 - ID: 4132, Name: 'Nuki - Haustür', nValue: 0, sValue: 'Unlocked' 2019-11-19 21:15:41.506 (Nuki) Device ID: '4132' 2019-11-19 21:15:41.506 (Nuki) Device Name: 'Nuki - Haustür' 2019-11-19 21:15:41.506 (Nuki) Device nValue: 0 2019-11-19 21:15:41.506 (Nuki) Device sValue: 'Unlocked' 2019-11-19 21:15:41.506 (Nuki) Device LastLevel: 0 2019-11-19 21:15:41.506 (Nuki) checking callback http://192.168.178.126:8080/callback/list?tokenxxx 2019-11-19 21:15:41.240 Status: (Nuki) Entering work loop. 2019-11-19 21:15:41.240 Status: (Nuki) Initialized version 1.0.5, author 'heggink' 2019-11-19 21:16:13.079 MQTT: Topic: domoticz/in, Message: {"idx":338,"nvalue":0,"svalue":"23.4;50.0;1","Battery":200,"RSSI":9} 2019-11-19 21:16:13.227 EventSystem: Event triggered: Vali-Schrank Heizung_2 2019-11-19 21:16:13.261 (Virtual) Light/Switch (Vali-Schrank-HZ) 2019-11-19 21:16:43.360 (RFLink-Getway) Temp + Humidity (Aussen) 2019-11-19 21:16:43.731 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-19 21:16:43.731 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-19 21:16:43.732 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:16:47.182 Status: User: Admin initiated a switch command (1909/deconz - Lampe 8-fach/Off) 2019-11-19 21:16:49.934 Status: User: Admin initiated a switch command (1909/deconz - Lampe 8-fach/Set Level) 2019-11-19 21:16:57.734 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-19 21:16:57.734 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-19 21:16:57.735 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:17:10.650 (deconz) onCommand called for Unit 17: Parameter 'Off', Level: 0, Hue: 2019-11-19 21:17:10.678 (deconz) onCommand called for Unit 17: Parameter 'Set Level', Level: 74, Hue: 2019-11-19 21:17:10.922 (deconz) Incomplete Json keep it for later : b'\x81~\x00\xb1{"e":"changed","id":"15","r":"lights","state":{"alert":null,"bri":140,"colormode":"ct","ct":280,"on":false,"r' 2019-11-19 21:17:10.647 Error: (Nuki) 'onStart' failed 'RemoteDisconnected'. 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 345 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 161 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1282 in '/usr/lib/python3.5/urllib/request.py', function http_open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1215 in '/usr/lib/python3.5/http/client.py', function getresponse 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 297 in '/usr/lib/python3.5/http/client.py', function begin 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 266 in '/usr/lib/python3.5/http/client.py', function _read_status 2019-11-19 21:17:11.347 EventSystem: Event triggered: Treppenlicht EG_1 2019-11-19 21:17:11.371 (deconz) onCommand called for Unit 86: Parameter 'Set Level', Level: 3, Hue: 2019-11-19 21:17:11.778 (Shellys) Connected to MQTT Server: 192.168.178.37:1883 2019-11-19 21:17:11.092 Error: (Shellys) Disconnected from MQTT Server: 192.168.178.37:1883 2019-11-19 21:17:11.737 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:17:20.256 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:20.275 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:20.275 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:20.275 (Nuki) onHeartbeat called 1 2019-11-19 21:17:30.258 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:30.295 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:30.295 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:30.295 (Nuki) onHeartbeat called 2 2019-11-19 21:17:40.259 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:40.304 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:40.304 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:40.304 (Nuki) onHeartbeat called 3 2019-11-19 21:17:42.358 (RFLink-Getway) Temp + Humidity (Aussen) 2019-11-19 21:17:50.261 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:50.271 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:50.271 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:50.272 (Nuki) onHeartbeat called 42019-11-19 21:15:40.762 Status: (Nuki) Started. 2019-11-19 21:15:41.243 (Nuki) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL 2019-11-19 21:15:41.243 (Nuki) 'Key':'NukiLock' 2019-11-19 21:15:41.243 (Nuki) 'Mode2':'xxxxxx' 2019-11-19 21:15:41.243 (Nuki) 'Mode6':'Debug' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzHash':'01271c298' 2019-11-19 21:15:41.243 (Nuki) 'Port':'8008' 2019-11-19 21:15:41.243 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-11-19 21:15:41.243 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.243 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-11-19 21:15:41.243 (Nuki) 'HardwareID':'24' 2019-11-19 21:15:41.243 (Nuki) 'Mode1':'192.168.178.126' 2019-11-19 21:15:41.243 (Nuki) 'Name':'Nuki' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzBuildTime':'2019-11-19 17:02:22' 2019-11-19 21:15:41.243 (Nuki) 'Mode4':'8080' 2019-11-19 21:15:41.243 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.243 (Nuki) 'DomoticzVersion':'4.11501' 2019-11-19 21:15:41.243 (Nuki) 'Language':'de' 2019-11-19 21:15:41.243 (Nuki) 'Version':'1.0.5' 2019-11-19 21:15:41.243 (Nuki) 'Author':'heggink' 2019-11-19 21:15:41.243 (Nuki) 'Mode3':'10' 2019-11-19 21:15:41.244 (Nuki) Device count: 1 2019-11-19 21:15:41.244 (Nuki) Device: 1 - ID: 4132, Name: 'Nuki - Haustür', nValue: 0, sValue: 'Unlocked' 2019-11-19 21:15:41.244 (Nuki) Device ID: '4132' 2019-11-19 21:15:41.244 (Nuki) Device Name: 'Nuki - Haustür' 2019-11-19 21:15:41.244 (Nuki) Device nValue: 0 2019-11-19 21:15:41.244 (Nuki) Device sValue: 'Unlocked' 2019-11-19 21:15:41.244 (Nuki) Device LastLevel: 0 2019-11-19 21:15:41.244 (Nuki) My IP is 192.168.178.37 2019-11-19 21:15:41.244 (Nuki) Nuki plugin started on IP 192.168.178.37 and port 8008 2019-11-19 21:15:41.244 (Nuki) REQUESTING http://192.168.178.126:8080/list?token=xxxxxx 2019-11-19 21:15:41.498 (Nuki) Lock list received [{"deviceType": 0, "nukiId": 44915xxxx, "name": "Haustür", "lastKnownState": {"mode": 2, "state": 3, "stateName": "unlocked", "batteryCritical": false, "timestamp": "2019-11-19T18:33:37+00:00"}}] 2019-11-19 21:15:41.498 (Nuki) I count 1 locks 2019-11-19 21:15:41.498 (Nuki) Lock Haustür already exists. 2019-11-19 21:15:41.498 (Nuki) Lock batt False 2019-11-19 21:15:41.498 (Nuki) Lock stateName unlocked 2019-11-19 21:15:41.498 (Nuki) Lock state 3 2019-11-19 21:15:41.499 (Nuki - Haustür) Updating device from 0:'Unlocked' to have values 0:'Unlocked'. 2019-11-19 21:15:41.505 (Nuki) Lock(s) created 2019-11-19 21:15:41.505 (Nuki) 'Key':'NukiLock' 2019-11-19 21:15:41.505 (Nuki) 'Mode2':'xxxxxx' 2019-11-19 21:15:41.505 (Nuki) 'Mode6':'Debug' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzHash':'01271c298' 2019-11-19 21:15:41.505 (Nuki) 'Port':'8008' 2019-11-19 21:15:41.505 (Nuki) 'HomeFolder':'/home/pi/domoticz/plugins/domoticz-nuki/' 2019-11-19 21:15:41.505 (Nuki) 'UserDataFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.505 (Nuki) 'Database':'/home/pi/domoticz/domoticz.db' 2019-11-19 21:15:41.505 (Nuki) 'HardwareID':'24' 2019-11-19 21:15:41.505 (Nuki) 'Mode1':'192.168.178.126' 2019-11-19 21:15:41.505 (Nuki) 'Name':'Nuki' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzBuildTime':'2019-11-19 17:02:22' 2019-11-19 21:15:41.505 (Nuki) 'Mode4':'8080' 2019-11-19 21:15:41.505 (Nuki) 'StartupFolder':'/home/pi/domoticz/' 2019-11-19 21:15:41.505 (Nuki) 'DomoticzVersion':'4.11501' 2019-11-19 21:15:41.505 (Nuki) 'Language':'de' 2019-11-19 21:15:41.506 (Nuki) 'Version':'1.0.5' 2019-11-19 21:15:41.506 (Nuki) 'Author':'heggink' 2019-11-19 21:15:41.506 (Nuki) 'Mode3':'10' 2019-11-19 21:15:41.506 (Nuki) Device count: 1 2019-11-19 21:15:41.506 (Nuki) Device: 1 - ID: 4132, Name: 'Nuki - Haustür', nValue: 0, sValue: 'Unlocked' 2019-11-19 21:15:41.506 (Nuki) Device ID: '4132' 2019-11-19 21:15:41.506 (Nuki) Device Name: 'Nuki - Haustür' 2019-11-19 21:15:41.506 (Nuki) Device nValue: 0 2019-11-19 21:15:41.506 (Nuki) Device sValue: 'Unlocked' 2019-11-19 21:15:41.506 (Nuki) Device LastLevel: 0 2019-11-19 21:15:41.506 (Nuki) checking callback http://192.168.178.126:8080/callback/list?token=xxxxx7 2019-11-19 21:15:41.240 Status: (Nuki) Entering work loop. 2019-11-19 21:15:41.240 Status: (Nuki) Initialized version 1.0.5, author 'heggink' 2019-11-19 21:16:13.079 MQTT: Topic: domoticz/in, Message: {"idx":338,"nvalue":0,"svalue":"23.4;50.0;1","Battery":200,"RSSI":9} 2019-11-19 21:16:13.227 EventSystem: Event triggered: Vali-Schrank Heizung_2 2019-11-19 21:16:13.261 (Virtual) Light/Switch (Vali-Schrank-HZ) 2019-11-19 21:16:43.360 (RFLink-Getway) Temp + Humidity (Aussen) 2019-11-19 21:16:43.731 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-19 21:16:43.731 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-19 21:16:43.732 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:16:47.182 Status: User: Admin initiated a switch command (1909/deconz - Lampe 8-fach/Off) 2019-11-19 21:16:49.934 Status: User: Admin initiated a switch command (1909/deconz - Lampe 8-fach/Set Level) 2019-11-19 21:16:57.734 Error: deconz hardware (22) thread seems to have ended unexpectedly 2019-11-19 21:16:57.734 Error: Shellys hardware (23) thread seems to have ended unexpectedly 2019-11-19 21:16:57.735 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:17:10.650 (deconz) onCommand called for Unit 17: Parameter 'Off', Level: 0, Hue: 2019-11-19 21:17:10.678 (deconz) onCommand called for Unit 17: Parameter 'Set Level', Level: 74, Hue: 2019-11-19 21:17:10.922 (deconz) Incomplete Json keep it for later : b'\x81~\x00\xb1{"e":"changed","id":"15","r":"lights","state":{"alert":null,"bri":140,"colormode":"ct","ct":280,"on":false,"r' 2019-11-19 21:17:10.647 Error: (Nuki) 'onStart' failed 'RemoteDisconnected'. 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 345 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 161 in '/home/pi/domoticz/plugins/domoticz-nuki/plugin.py', function onStart 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 163 in '/usr/lib/python3.5/urllib/request.py', function urlopen 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 466 in '/usr/lib/python3.5/urllib/request.py', function open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 484 in '/usr/lib/python3.5/urllib/request.py', function _open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 444 in '/usr/lib/python3.5/urllib/request.py', function _call_chain 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1282 in '/usr/lib/python3.5/urllib/request.py', function http_open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1260 in '/usr/lib/python3.5/urllib/request.py', function do_open 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 1215 in '/usr/lib/python3.5/http/client.py', function getresponse 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 297 in '/usr/lib/python3.5/http/client.py', function begin 2019-11-19 21:17:10.650 Error: (Nuki) ----> Line 266 in '/usr/lib/python3.5/http/client.py', function _read_status 2019-11-19 21:17:11.347 EventSystem: Event triggered: Treppenlicht EG_1 2019-11-19 21:17:11.371 (deconz) onCommand called for Unit 86: Parameter 'Set Level', Level: 3, Hue: 2019-11-19 21:17:11.778 (Shellys) Connected to MQTT Server: 192.168.178.37:1883 2019-11-19 21:17:11.092 Error: (Shellys) Disconnected from MQTT Server: 192.168.178.37:1883 2019-11-19 21:17:11.737 Error: Nuki hardware (24) thread seems to have ended unexpectedly 2019-11-19 21:17:20.256 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:20.275 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:20.275 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:20.275 (Nuki) onHeartbeat called 1 2019-11-19 21:17:30.258 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:30.295 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:30.295 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:30.295 (Nuki) onHeartbeat called 2 2019-11-19 21:17:40.259 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:40.304 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:40.304 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:40.304 (Nuki) onHeartbeat called 3 2019-11-19 21:17:42.358 (RFLink-Getway) Temp + Humidity (Aussen) 2019-11-19 21:17:50.261 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:17:50.271 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:17:50.271 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:17:50.272 (Nuki) onHeartbeat called 4

salopette commented 4 years ago

2019-11-19 21:23:10.461 (Nuki) onHeartbeat called 36 2019-11-19 21:23:20.450 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:23:20.461 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:23:20.461 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:23:20.461 (Nuki) onHeartbeat called 37 2019-11-19 21:23:28.803 (Nuki) Pushing 'onCommandCallback' on to queue 2019-11-19 21:23:28.827 (Nuki) Processing 'onCommandCallback' message 2019-11-19 21:23:28.827 (Nuki) Calling message handler 'onCommand'. 2019-11-19 21:23:28.827 (Nuki) onCommand called for Unit 1: Parameter 'On', Level: 0 2019-11-19 21:23:28.827 (Nuki) Switch device 449156989 with name Haustür 2019-11-19 21:23:28.827 (Nuki) setting action to 2 2019-11-19 21:23:28.827 (Nuki) Executing lockaction http://192.168.178.126:8080/lockAction?nukiId=449156989&action=2&token=xxxxxxx 2019-11-19 21:23:28.802 Status: User: Admin initiated a switch command (4132/Nuki - Haustür/On) 2019-11-19 21:23:36.360 (RFLink-Getway) Temp + Humidity (Aussen) 2019-11-19 21:23:37.649 (Nuki) Lock command response received {"success": true, "batteryCritical": false} 2019-11-19 21:23:37.649 (Nuki) UpdateDevice called with 1 1 Locked 0 2019-11-19 21:23:37.649 (Nuki - Haustür) Updating device from 0:'Unlocked' to have values 1:'Locked'. 2019-11-19 21:23:37.678 (Nuki) Update 1:'Locked' (Nuki - Haustür) 2019-11-19 21:23:37.789 Error: dzVents: Error: (2.5.0) Discarding device. No last update info found: {["deviceID"]="", ["subType"]="Switch", ["changed"]=true, ["baseType"]="device", ["lastLevel"]=255, ["timedOut"]=false, ["deviceType"]="Light/Switch", ["name"]="Nuki - Haustür", ["description"]="", ["switchType"]="Door Lock", ["signalLevel"]=13225232, ["data"]={["hardwareType"]="Nuki Lock Plugin", ["hardwareTypeValue"]=94, ["internalState"]="Locked", ["_state"]="Locked", ["hardwareID"]=2609232, ["usedByCamera"]=false, ["protected"]=false, ["icon"]="door", ["levelVal"]=0, ["_nValue"]=1, ["maxDimLevel"]=100, ["hardwareName"]="Nuki", ["unit"]=1}, ["id"]=4132, ["protected"]=false, ["switchTypeValue"]=19, ["lastUpdate"]="", ["batteryLevel"]=0, ["rawData"]={"Locked"}} 2019-11-19 21:23:39.178 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:23:39.199 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:23:39.199 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:23:39.199 (Nuki) onHeartbeat called 38 2019-11-19 21:23:49.183 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:23:49.189 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:23:49.189 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:23:49.190 (Nuki) onHeartbeat called 39 2019-11-19 21:23:59.185 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:23:59.208 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:23:59.208 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:23:59.208 (Nuki) onHeartbeat called 40 2019-11-19 21:24:09.186 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:24:09.197 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:24:09.197 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:24:09.197 (Nuki) onHeartbeat called 41 2019-11-19 21:24:13.133 MQTT: Topic: domoticz/in, Message: {"idx":338,"nvalue":0,"svalue":"21.9;51.3;1","Battery":200,"RSSI":9} 2019-11-19 21:24:19.189 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:24:19.195 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:24:19.195 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:24:19.195 (Nuki) onHeartbeat called 42 2019-11-19 21:24:29.191 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:24:29.218 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:24:29.218 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:24:29.218 (Nuki) onHeartbeat called 43 2019-11-19 21:24:39.193 (Nuki) Pushing 'onHeartbeatCallback' on to queue 2019-11-19 21:24:39.229 (Nuki) Processing 'onHeartbeatCallback' message 2019-11-19 21:24:39.230 (Nuki) Calling message handler 'onHeartbeat'. 2019-11-19 21:24:39.230 (Nuki) onHeartbeat called 44

salopette commented 4 years ago

here must be the mistake?

heggink commented 4 years ago

OK, thanks, so there is good and there is bad. The good is that the plugin now seems to communicate with the bridge. It get's the installed locks configured in the bridge: 2019-11-19 21:15:41.498 (Nuki) Lock list received [{"deviceType": 0, "nukiId": 44915xxxx, "name": "Haustür", "lastKnownState": {"mode": 2, "state": 3, "stateName": "unlocked", "batteryCritical": false, "timestamp": "2019-11-19T18:33:37+00:00"}}]

Then the plugin checks if a callback is already installed in the bridge: as soon as the lock changes a state (you open it manually or through an app), it needs to tell domoticz about the state change which is the callback url. the plugin will then listen for messages (the port 8008 that was open and you configured) and the bridge knows to send a message there.

What isn't working (and I don't know why) is that you can send a request to the bridge to list all the locks which works fine but sending a similar request to the bridge to list the callbacks throws an error. It uses the same urllib.request function. I did build in error handling for this which doesn't seem to function properly. I think I need to add HTTPException as an extra error check. Will add that to the plugin.

That said, that doesn't explain why, if you issue the command by hand (curl) the response is {"callbacks": []} but the plugin receives a RemoteDisconnected (ie no data).

What I can do is add the error handling for a HTTPException which, according to some googling, should catch it. It's not ideal (as I don;t understand why) but it will then decide that there are no callbacks and install one. The rest all seems to work but, in your case, we seem to be stuck on this empty response...

I just made the change in a separate branch called heggink-patch-1 I am not a git wizard by any means but I think you should be able to issue the following command to switch to the test branch (in the plugin directory): git checkout heggink-patch-1 and then restart domoticz for the patch to work

Let me know what;s happening please. Out of curiosity, what version of the lock are you using? The original v1 or v2? Maybe there's a difference there...

salopette commented 4 years ago

Hi, today I insatlled the patch from you and so far I have not had any mistakes! # Thank you

PS: I have v2 Nuki

heggink commented 4 years ago

Sweet! Letztendlich mal hat's geklappt! Please do a couple of checks, as I don't have a V2 myself, to see if domoticz responds to lock changes and the lock responds to domoticz. When you perform some tests, do realise that it typically takes tye bridge up to 10 seconds to report a change to domoticz. This is standard bridge behaviour and I cannot change it (it takes time for the lock to compete any action and then it needs to report to the bridge which then needs to report to domoticz). Also, don't set the poll interval too low as that drains the batteries quickly. Every time domoticz pings the bridge, the bridge wakes up the lock causing bluetooth messages to be exchanged. The more often you do that, the faster it drains. One reason why I replaced the batteries with a 220v-6v adapter (and made a special contact to replace the batteries). No more battery replacements for me :-).

Gern Geschehen!

Herman

salopette commented 4 years ago

Everything works so far! Thank you for that!