jandebeule / nukiPyBridge

40 stars 19 forks source link

nukiPyBridge v2 #15

Open Huugii opened 5 years ago

Huugii commented 5 years ago

Hello,

Can you make an update for the Nuki v2.0 ?

Thanks !

dauden1184 commented 5 years ago

Just made a pull request for this #16 Give some feedback if you try it!

giejay commented 5 years ago

Thank you so much @dauden1184, just managed to get it working on my raspberry pi zero. Only thing is that Im seeing a lot of:

Traceback (most recent call last):
  File "unlock.py", line 8, in <module>
    nuki.lockAction("UNLOCK")
  File "/home/pirate/nuki/nuki.py", line 201, in lockAction
    self.device.char_write_handle(keyturnerUSDIOHandle,challengeReqEncryptedCommand,True,4)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/device.py", line 17, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/device.py", line 48, in char_write_handle
    self._backend.char_write_handle(self, handle, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 35, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 427, in char_write_handle
    self._receiver.wait("char_written", timeout=2)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 126, in wait
    raise NotificationTimeout()
pygatt.exceptions.NotificationTimeout: None
dauden1184 commented 5 years ago

Uhm it seems to be a timeoput problem again. You can try to change the pygatttool.py file at line 427

self._receiver.wait("char_written", timeout=2)

to something like

self._receiver.wait("char_written", timeout=5)

maybe it will get better.

giejay commented 5 years ago

Thanks, that seems to help a bit:)

Only one problem remaining, the getLog method is not working for me.

Decrypting message e14948ea2fa9ffa4212010c206e288fbdf2ecff76b241630df5c34001b00ba9c6d1e43cf18c66e07de4ea2ed57ec1a42981------------ command = 0012, payload = ff2300, crc = ad24 Unable to decrypt message

I have reset the pin to 0000 and Im calling the method like this:

nuki.Nuki(mac).getLogEntries(1, "%04x" % 0000)

Any idea what Im doing wrong? Did you manage to get the logentries?

Btw, I also forked the project and added Flask to (un)lock nukis through http: https://github.com/giejay/nukiPyBridge