-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example not working #76
Comments
What exactly is not working? These errors are expected when no pairing data is present. Put the Nuki device in pairing mode and these errors will disappear. |
I have a Nuki 2.0 and a Nuki 3.0 but none of them "in binding" mode will change this behavior :-( |
You should enable debug logging using the Arduino/ESP-IDF settings in whatever build system you are using to compile and define appropriate debug vars. Might be better to start from a working implementation such as nuki hub (complex) or esphome_nuki_lock (basic) |
"nuki hub" is much too complex, would need me to strip down nearly all beside the NUKI plain connect part. "esphome_nuki_lock" is even a big framework (behind ESPHome) , that's why i directly choose NukiBleEsp32 as start for a own project. I simply downloaded the zip from here, extracted it, opened it in VSCode/PlatfomIO, build the example and uploaded it (to different ESP32 Wroom Boards with 4MB Flash) with the result i showed above. As quickcheck i downloaded and build and uploaded "nuki hub" now only to check if the locks and the ESP32 Hardware is working as expected. I never used debugging on a ESP32 (beside Serial) so no clue at the moment to to debug this problem. Not sure how to continue now. |
Here are two serial output snippets from debug build: (cut from long serial output) Only difference: If the lock is not in binding mode then it looks like that I marked the line with ************************** at the line end
|
I now installed a fresh VSCode with fresh installed PlatformIO . |
Below is a serial output from the powerup, a Nuki V3 was in bind mode, so the typical I tracked down the message "No service data found" in sourcecode "NimBLEAdvertisedDevice.cpp" I still think that something is wrong or missing in the example code.
|
Finally found this older issue ( #38 ) That gave the hint to a specific branch "pair-and-unpair-refactor" ( https://github.com/I-Connect/NukiBleEsp32/tree/pair-and-unpair-refactor ) I tried it and this one immediatly worked out of the box !!! |
Good NEWS !!! by comparing line by line and having a lot additional log outputs i tracked down the binding problem to only a couple of lines where the UUIDs are defined.
If i change this to:
then binding even works now in the "main" branch, no need to go for the "pair-and-unpair-refactor" anymore Please note, both version will compile without errors, but with the not working one binding itself will not work at all, see my comments above. |
I have no explanation why this makes a difference, both should create identical NimBLEUUID objects. Could you add some debug output inside NukiBle.cpp for testing, to see if there's a difference. The NimBLEUUID class has a toString() method you can use. Both ways should have identical output. |
No, as far i could see, both create different NimBLEUUID objects. I tried to output the UUID in a readable way, but .toString does not work for me, with it i only get non printable characters. So i have done my own conversion to format the data for outputting it as single chars and hex, byte by byte. e.g. here is a byte by byte representation of pairingServiceUUID in NukiBle.cpp when using directly "NimBLEUUID("a92ee100-5501-11e4-916c-0800200c9a66")," at "NukiLock::NukiLock(const std::string& deviceName, const uint32_t deviceId)"
and here are when using "keyturnerPairingServiceUUID"
btw: |
For a test i changed the following: in Nukilock.cpp
in Nukilock.h
and in NukiSmartlockTest.h (-> main.cpp)
Even if this is not a real solution and only a prove of concept, it will work then. For me it looks like as if at the time when the object NukiLock" is created from "NukiBle" ( see "NukiLock.cpp NukiLock.h") the NimBLEUUID object with the constant UUIDs are not already evaluated. |
Strange, I can't really make sense of it, I'll have to think about it. |
When i try the example code (without any Modification) i only get the following error at the serial monitor:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
[ 287][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 287][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
[ 296][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 299][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
[ 807][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 807][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
[ 1311][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 1312][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
[ 1815][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 1816][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
[ 2319][E][Preferences.cpp:503] getBytesLength(): nvs_get_blob len fail: bleAddress NOT_FOUND
[ 2320][E][NukiBle.cpp:939] retrieveCredentials(): Error getting data from NVS
...
Any Hint where to search ?
The text was updated successfully, but these errors were encountered: