[ NUKI Smartlock ] 73_NUKIBridge.pm und 74_NUKDevice.pm

Begonnen von CoolTux, 18 Juli 2016, 23:50:11

Vorheriges Thema - Nächstes Thema

samh

#555
Hallo,

hoffe, dass das hilfreich ist.

Gruß Sam




2017.01.06 18:22:01 1: PERL WARNING: Use of uninitialized value $list in concatenation (.) or string at ./FHEM/73_NUKIBridge.pm line 263.
2017.01.06 18:22:11 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/list?token=YYYYYYYYYY
2017.01.06 18:22:11 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:11 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 18:22:11 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:11 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 18:22:11 5: NUKIBridge (NBridge1) - Bridge ist online
2017.01.06 18:22:11 5: NUKIBridge (NBridge1) - Response JSON: [{"nukiId":ZZZZZZZZZ,"name":"HT vorn","lastKnownState":{"nukiId":ZZZZZZZZZ,"state":3,"stateName":"unlocked","batteryCritical":false}}]
2017.01.06 18:22:11 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/info?token=YYYYYYYYYY
2017.01.06 18:22:11 5: NUKIBridge (NBridge1) - Response JSON: {"bridgeType":2,"ids":{"serverId":bbbbbbbb},"versions":{"appVersion":"0.2.14"},"uptime":168877,"currentTime":"2017-01-06T17:22:14Z","serverConnected":true,"scanResults":[{"nukiId":ZZZZZZZZZ,"name":"Nuki_AAAAAAAA","rssi":-79,"paired":true}]}
2017.01.06 18:22:15 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockState?token=YYYYYYYYYY&nukiId=ZZZZZZZZZ
2017.01.06 18:22:17 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"state":3,"stateName":"unlocked","success":true}
2017.01.06 18:22:30 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:30 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 18:22:30 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:30 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 18:22:30 5: NUKIBridge (NBridge1) - Bridge ist online
2017.01.06 18:22:51 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:51 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 18:22:51 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:22:51 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 18:22:51 5: NUKIBridge (NBridge1) - Bridge ist online
2017.01.06 18:22:57 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/info?token=YYYYYYYYYY
2017.01.06 18:22:57 5: NUKIBridge (NBridge1) - Response JSON: {"bridgeType":2,"ids":{"serverId":BBBBBBBBB},"versions":{"appVersion":"0.2.14"},"uptime":168920,"currentTime":"2017-01-06T17:23:00Z","serverConnected":true,"scanResults":[{"nukiId":ZZZZZZZZZ,"name":"Nuki_AAAAAAA","rssi":-75,"paired":true}]}
2017.01.06 18:23:09 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockAction?token=YYYYYYYYYY&action=2&nukiId=ZZZZZZZZZ
2017.01.06 18:23:17 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:23:17 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 18:23:17 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:23:17 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 18:23:17 5: NUKIBridge (NBridge1) - Bridge ist online
2017.01.06 18:23:20 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'","batteryCritical":false,"success":true}

samh

Der Status hatte sich nach dem Lock-Kommando nicht geändert, aber das Schloss hatte sofort reagiert.
Nach dem 1. manuellen StatusRequest wechselte der Status zu "lock".
Erst nach dem 2. man. StatusRequest zu 'locked'.

Die Antwort im Log sieht bei beiden identisch aus.


2017.01.06 18:38:14 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockState?token=YYYYYYYYYY&nukiId=ZZZZZZZZZ
2017.01.06 18:38:16 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"state":1,"stateName":"locked","success":true}
2017.01.06 18:38:30 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:38:30 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 18:38:30 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 18:38:30 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 18:38:30 5: NUKIBridge (NBridge1) - Bridge ist online
2017.01.06 18:38:31 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockState?token=YYYYYYYYYY&nukiId=ZZZZZZZZZ
2017.01.06 18:38:33 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"state":1,"stateName":"locked","success":true}


CoolTux

Ich sehe das Problem. Woher es kommt oder besser wieso es so ist muss ich erst noch schauen. Aus irgendeinem Grund werden Response Daten durcheinander gewürfelt.

Ich schaue es mir die Tage an.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

samh

Das klingt doch schon mal zuversichtlich.  ;)

Wenn ich dazu beitragen kann, lass es mich wissen.

Gute Zeit

Sam

CoolTux

Zitat von: samh am 06 Januar 2017, 19:11:41
Das klingt doch schon mal zuversichtlich.  ;)

Wenn ich dazu beitragen kann, lass es mich wissen.

Gute Zeit

Sam

Hihi wirst du wohl müssen. Glaube bist Schuld. Lach. Nein nicht ganz so schlimm. Ich denke es hat was mit der Art und Weise des alive Checks der Bridge zu tun und der Änderung die ich dank deines Hinweises getätigt habe. Ich denke ich muss mir da was anderes einfallen lassen. Ich bereite nachher mal eine Testversion vor.


Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

CoolTux

Habe gerade noch was gefunden. Stell mal bitte beim Bridgedevice das Attribut disable auf 1 und warte eine Minute. Danach bitte noch mal. Die Schaltbefehle probieren und schauen ob der Status nun korrekt gesetzt wird.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

samh

Der Status ändert sich sofort, aber nur auf die ausgeführte Aktion.
Also lock statt locked.
Erst nach man. StatusRequest wird dann korrekt aktualisiert.

Gruß

CoolTux

Ok jetzt verstehe ich. Du hattest aber bestimmt niemals locked stehen, oder? Also noch nie seit Du die Module verwendest?
Ich werde das mal entsprechend ändern. Das wird aber etwas dauern. Und dann ist da ja auch noch das Problem mit dem Alice Check  ;D
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

samh

Hallo,

doch, doch...
Der Status wurde schon auf Locked oder Unlocked gesetzt. Aber eben nicht automatisch.
Ich mußte immer erst mehrmals den StatusRequest ausführen.

Ich habe kein schlechtes Gewissen, dass ich Dich so trietze, denn ich geh mal davon aus,
dass der Spaß an der Entwicklung Dich dazu gebracht hat, die Module zu bauen.
Insofern freut es mich, dass ich für noch mehr Spaß sorgen kann.  ;D

Es ist aber schon toll, wie zeitnah Deine Antworten kommen und ich bin, eigensüchtig wie ich bin,
natürlich auch daran interessiert, dass die Module optimal funktionieren. Leider versteh ich nicht
so viel von der Programmierung, dass ich da durch Handauflegen etwas bewirken könnte.

Steh gerne weiter zur Verfügung.

Gruß Sam

CoolTux

Ab jetzt weiß ich wie du zu den Zuständen kommst. Gut und ich weiß wie ich das am besten mache. Werde noch mal in die API schauen.
Danke Dir erstmal ganz doll fürs fleißige testen.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

CoolTux

#565
Kannst Du bitte einmal die beiden Module installieren und noch mal testen? Bitte das disable bei der bridge raus nehmen. aber verbose 5 bei bridge und smartlock device lassen.
DANKE
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

samh

Ha, der erste Befehl wurde sofort ausgeführt und sofort der Status korrekt gesetzt.
Dann nach dem 2. Befehl reagiert das Schloss, aber keine Statusänderung.
Schade....


2017.01.06 21:54:27 1: PERL WARNING: Use of uninitialized value $list in concatenation (.) or string at ./FHEM/73_NUKIBridge.pm line 263.
2017.01.06 21:54:40 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/list?token=YYYYYYYYYY
2017.01.06 21:54:40 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:54:40 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 21:54:40 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response JSON: [{"nukiId":ZZZZZZZZZ,"name":"HT vorn","lastKnownState":{"nukiId":ZZZZZZZZZ,"state":1,"stateName":"locked","batteryCritical":false}}]
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:54:41 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/info?token=YYYYYYYYYY
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response CODE: 400
2017.01.06 21:54:41 4: NUKIBridge (NBridge1) - action is undefined
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response JSON: {"bridgeType":2,"ids":{"serverId":202275232},"versions":{"appVersion":"0.2.14"},"uptime":179117,"currentTime":"2017-01-06T20:54:43Z","serverConnected":true,"scanResults":[{"nukiId":ZZZZZZZZZ,"name":"Nuki_CCCCCCC","rssi":-77,"paired":true}]}
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:54:41 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:54:43 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge check Bridge connected
2017.01.06 21:54:43 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge Bridge is connected call IOWrite
2017.01.06 21:54:43 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockState?token=YYYYYYYYYY&nukiId=ZZZZZZZZZ
2017.01.06 21:54:43 5: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_GetUpdate Call NUKIDevice_ReadFromNUKIBridge
2017.01.06 21:54:46 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"state":1,"stateName":"locked","success":true}
2017.01.06 21:54:46 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:54:46 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:54:46 5: NUKIDevice (NUKI_HT_vorn) - parse status message for NUKI_HT_vorn
2017.01.06 21:54:46 5: NUKIDevice (NUKI_HT_vorn) - readings set for NUKI_HT_vorn
2017.01.06 21:55:02 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:02 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 21:55:02 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:03 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 21:55:03 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:03 5: NUKIBridge (NBridge1) - Response CODE: 400
2017.01.06 21:55:03 4: NUKIBridge (NBridge1) - action is undefined
2017.01.06 21:55:09 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge check Bridge connected
2017.01.06 21:55:09 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge Bridge is connected call IOWrite
2017.01.06 21:55:09 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockAction?token=YYYYYYYYYY&action=1&nukiId=ZZZZZZZZZ
2017.01.06 21:55:20 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"success":true}
2017.01.06 21:55:20 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:20 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:55:20 5: NUKIDevice (NUKI_HT_vorn) - parse status message for NUKI_HT_vorn
2017.01.06 21:55:20 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge check Bridge connected
2017.01.06 21:55:20 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge Bridge is connected call IOWrite
2017.01.06 21:55:20 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockState?token=YYYYYYYYYY&nukiId=ZZZZZZZZZ
2017.01.06 21:55:20 5: NUKIDevice (NUKI_HT_vorn) - readings set for NUKI_HT_vorn
2017.01.06 21:55:21 5: NUKIBridge (NBridge1) - Response JSON: {"batteryCritical":false,"state":3,"stateName":"unlocked","success":true}
2017.01.06 21:55:21 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:21 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:55:21 5: NUKIDevice (NUKI_HT_vorn) - parse status message for NUKI_HT_vorn
2017.01.06 21:55:21 5: NUKIDevice (NUKI_HT_vorn) - readings set for NUKI_HT_vorn
2017.01.06 21:55:21 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:21 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 21:55:21 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:22 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 21:55:22 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:22 5: NUKIBridge (NBridge1) - Response CODE: 400
2017.01.06 21:55:22 4: NUKIBridge (NBridge1) - action is undefined
2017.01.06 21:55:33 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge check Bridge connected
2017.01.06 21:55:33 4: NUKIDevice (NUKI_HT_vorn) - NUKIDevice_ReadFromNUKIBridge Bridge is connected call IOWrite
2017.01.06 21:55:33 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockAction?token=YYYYYYYYYY&action=2&nukiId=ZZZZZZZZZ
2017.01.06 21:55:41 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:41 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 21:55:41 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:55:42 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 21:55:42 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:42 5: NUKIBridge (NBridge1) - Response CODE: 400
2017.01.06 21:55:42 4: NUKIBridge (NBridge1) - action is undefined
2017.01.06 21:55:44 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'","batteryCritical":false,"success":true}
2017.01.06 21:55:44 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:55:44 5: NUKIBridge (NBridge1) - Response CODE: 200
2017.01.06 21:56:01 4: NUKIBridge (NBridge1) - NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:56:01 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/alive?token=YYYYYYYYYY
2017.01.06 21:56:01 4: NUKIBridge (NBridge1) - Call InternalTimer for NUKIBridge_GetCheckBridgeAlive
2017.01.06 21:56:01 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'"}
2017.01.06 21:56:01 5: NUKIBridge (NBridge1) - Response ERROR:
2017.01.06 21:56:01 5: NUKIBridge (NBridge1) - Response CODE: 400
2017.01.06 21:56:01 4: NUKIBridge (NBridge1) - action is undefined

samh

Hhmm...

sieht das nicht irgendwie durcheinandergewürfelt aus ?


Response JSON: {"error":"unknown action: '\/alive'","batteryCritical":false,"success":true}

CoolTux

Das sieht nur so aus. Die Zeiten sind weit auseinander. Du sendest beim zweiten mal die lockAction

2017.01.06 21:55:33 4: NUKIBridge (NBridge1) - Send HTTP POST with URL http://192.168.XXX.XXX:8080/lockAction?token=YYYYYYYYYY&action=2&nukiId=ZZZZZZZZZ

und erst 10s später kommt ein Response der aber irgendwie zwar den Response von der lockAction enthält aber auch eine Error Meldung. Muss mir mit dem Alive Check mal was anderes überlegen.

2017.01.06 21:55:44 5: NUKIBridge (NBridge1) - Response JSON: {"error":"unknown action: '\/alive'","batteryCritical":false,"success":true}

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

CoolTux

#569
So ich habe mal ein paar Zeilen Code geändert und etwas umgebaut. Ich denke so wie es jetzt ist ist es sogar noch besser.
Ich hoffe nur das die Hardware Bridge Leute keine Probleme haben  ;D

Bitte noch mal testen und berichten
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net