Open Huugii opened 5 years ago
Hi, which version of Nubli do you have? Normally it should display something like "Ready to scan". Have you changed the pair.js example? Make sure that you have installed version 1.0.0 from NPM (or clone via Github).
Yes I read the code and try to repair it but without success I re-install Node, clone nubli v1.0 from NPM and now I have :
The program shouldn't abort during pairing. Have you manually cancelled it? Is the Smart Lock set to pairing mode?
And do you have a bridge? If so, try smartLock.pair(false) to pair as an app. Is a config file being created ./config/*.json
?
No i didn't cancelle it and I set the Smart Lock in paring mode. I don't have bridge. There is no json created (there is no ./config folder)
Weird. What's the exit code after the program terminates?
I don't see any exit code when the program terminates
Just a tsconfig.json in ..../node-modules/nubli/
Can you send me an exemple of ./config/*.json completed ?
Hi Huugi, the config file doesn't help you first need to get the encryption keys from Nuki.
When you run the pair.js file and it terminates, check the exit code with echo $?
You need to run the command directly after running pair.js as it will always print the exit code of the last shell command.
Hi, the error code is "0".
Weird, you can try to add some debug statements (console.log("test"), etc.) to the code and check where it stops.
I know... I acctualy doing that and I found were the code stop but i don't know why
Thanks. Please try to replace dist/lib/smartLock.js with the following file and try again.
Note that you need to rename the extension back to .js. GitHub doesn't allow to upload .js files.
No .. It doesn't work. The code stop at the same place
Hmm. Can you find the exact spot in NukiConfig.readConfig() where it's stuck?
Which node Version do you use? (node --version
)
I'm using Node v9.11.2. I got something ! Now the code continue correctly but stop in smartLockPairer.js like on the following screen.
Weird. I don't really get why the program terminates. If it's not resolving and not rejecting it should just hang.
Subscribe is implemented by Noble, so I can't really help you there. You may want to try to run it on a server system. Maybe the Desktop is interfering with the Bluetooth hardware. You could also try to run it as root.
I'm using node v8.15.1. You may want to try with that.
I'm changing version of node. Can you send me your package-lock.json ? I have a lot of warning when I use npm install
and some of them concern noble. I also have 2 low severity vulnerabilities
I have them too. Shouldn't be a problem. I have attached my package-lock.json
Note that it uses the Git version. So you may need to clone the repository and place the package-lock.json in there.
Hi Henry,
I tried to install nubli from github repo but I don't know how to install from there. So, can you make a little tutorial to install it correctly please ?
Hi,
just clone the Repo (git clone https://github.com/...
) and run npm install
in the repo directory. You should be able to pair with node examples/pair.js
When I start /exemple/pair.js I have the same problem as before (code stop after log : "All characteristics found. Try to pair ..."). Maybe hardware ? I run it on Ubuntu 16.04 on ASUS P2530U It's working well for you ?
The problem isn't the hardware, I've change and have the same problem
Hmm, shouldn't really matter. I'm using a Raspberry with Raspbian (Debian Stretch) and a CSR Bluetooth Dongle ($4 on eBay) and it works without any issues. I don't think Nubli is the problem but the Noble Library. Do you use the internal Bluetooth Module of your Laptop? It may not be well supported by Noble. You could try to use a USB Dongle like a CSR one.
Edit: Do you use Bluetooth with anything else on your Laptop? Only one app at a time can use the Bluetooth adapter (At least Noble can only use one)
The program shouldn't abort during pairing. Have you manually cancelled it? Is the Smart Lock set to pairing mode?
Hi, sorry to interrupt this thread, but i noticed this comment. I cancelled pair.js with Ctrl-C because it was taking so long and now I'm at the same position than Huugii. Program exits abruptly at "Trying to pair".
I tried to reboot system and smartlock and nothing changes. Any idea?
I'm on raspberry pi with BT usb dongle and node v8.16.0.
Thanks.
@mazafra1 Thanks for letting me know. That should definitely not happen as you have the same hardware/software as I do. You use the Smart Lock v2 right?
I will unpair my Smart Lock today when I have time and setup everything from scratch to confirm that the repo version work (at least for me). Which version do you have installed on your Smart Lock?
Edit: Please also provide output of the command hciconfig
(You can hide the MACs if you like)
@mazafra1 Thanks for letting me know. That should definitely not happen as you have the same hardware/software as I do. You use the Smart Lock v2 right?
I will unpair my Smart Lock today when I have time and setup everything from scratch to confirm that the repo version work (at least for me). Which version do you have installed on your Smart Lock?
Edit: Please also provide output of the command
hciconfig
(You can hide the MACs if you like)
Thanks @henry-spanka for the quick answer. Yes, it's Smart Lock v2 and I'm on I'm on firmware 2.4.5.
I did install homebridge-nubli via npm, getting homebridge-nubli v1.0.1 and nubli v1.0.0.
hci0: Type: Primary Bus: USB BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING RX bytes:10315385 acl:295 sco:0 events:260152 errors:0 TX bytes:19394 acl:310 sco:0 commands:1632 errors:0
I also disabled raspberrypi BT chip on UART to avoid confusion.
Thanks, I can confirm. Pairing doesn't work for me either now :( I'll let you know once I know what's the issue.
Well ... I went through all commits to find the issue. Turned out it was an incorrect process.exit in the pairing example. Please try to remove the process.exit from examples/pair.js and try to pair again. I'll update the examples if it works for you.
Well ... I went through all commits to find the issue. Turned out it was an incorrect process.exit in the pairing example. Please try to remove the process.exit from examples/pair.js and try to pair again. I'll update the examples if it works for you.
Great!! it works!! Although I did some changes since running the script with sudo creates some mess with the path of the resulting file.
Thank you very much!
Thanks. You don't need to run it with sudo.
You can allow node to access the Bluetooth Dongle without root access:
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
Hi, I'm already try to remove process.exit and it doesn't work
Le ven. 26 avr. 2019 à 22:51, Henry Spanka notifications@github.com a écrit :
Well ... I went through all commits to find the issue. Turned out it was an incorrect process.exit in the pairing example. Please try to remove the process.exit from examples/pair.js and try to pair again. I'll update the examples if it works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/henry-spanka/nubli/issues/1#issuecomment-487163872, or mute the thread https://github.com/notifications/unsubscribe-auth/AL3IMSHYKBX7WNMWDBVERGDPSNFMXANCNFSM4HG4XBFA .
Can you please post the output of hciconfig
. Also please upload the contents of example/pair.js to GitHub (rename as .txt). It is stuck after "Trying to pair", right?
I can confirm it's stuck at "trying to pair" My specs: Raspbian Stretch Node 8 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
I will try to investigate the changes since I remember being able to pair in the past.
Apparently noble supports long receives, because if I check for the buffer size after the public key request it says 36 bytes. If I understood correctly, nubli expects the public key to be sent in 2 steps, but noble already bundles the 2 transmissions together, this is why the pairing gets stuck at REQ_PUB_KEY.
Update: I was able to pair the lock after converting all the multi-step data receptions to single step receptions (basically throwing out partialPayload). I tested the pairing config by locking and unlocking, but upon first glance requestConfig seems to have the same issue with multi-step transmissions as pairing.
Update 2: requestConfig failed for me because I have a V1 Lock. The response is only 70 bytes long. For backwards compatibility I would suggest to check version field and otherwise leave homekitStatus and timezoneId empty.
Is there some flag in noble to enable long receives? Because with my installation it definitely sent the public key in multiple steps. Not sure why this changed now. Maybe the V1 lock sends it in one transmission and the V2 in two?
I don't think it's the lock version. I've implemented a Nuki fob based on the NRF51822 (https://github.com/zilluss/Open-Nuki-Fob) and I have to use multiple step reads in the code as well. I suspect this is due to the MTU size the BLE stack the NRF uses (23 bytes, so 20 bytes of data + 3 bytes of overhead).
I checked the logs of my lock and I paired with Nubli someday on July 2019, so with the old multi-step code. That was with the onboard Bluetooth of the RPi 3. I couldn't use Nubli though because the BT was unreliable (even pairing took several attempts). Now I'm using an USB adapter as the readme suggests and it will only work with the changes I've made in the PR (using single-step reads). Running hciconfig tells me an ACL MTU of 310 bytes, so enough to transmit the Nuki reads in a single receive. I've disabled the internal BT adapter of my RPi at the moment, but several sources online suggest the default MTU for it is 23 bytes.
hi, i have that problem, after a couple of second then "disconnect". node version: 8.15, OS: raspbian, Bluetooth dongle: CSR 4.0. 2021-4-20 09:24:24 state change: poweredOn Ready to scan :) 2021-4-20 09:24:24 Started scanning 2021-4-20 09:24:24 Peripheral matched filter: 54d2727e7774 - Nuki_1E7E7774 2021-4-20 09:24:24 Stopped scanning 2021-4-20 09:24:25 54d2727e7774: connected connected 2021-4-20 09:24:25 54d2727e7774: All characteristics found. Trying to pair successfully paired (node:2869) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open './config/54d2727e7774.json' (node:2869) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:2869) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Hello, I have a problem : After installing everything I launch pair.js to pair my nuki smart lock v2.0 and I have a "disconnected" line. The program stop and do nothing anymore.
Somebody can help me ?