API Bluetooth: is disconnected just when performing an unlock

Hi,

I’ve achieved to pair and read lock state but when I try to send a unlock action I have the following error,

[D][nuki.cpp:166] read_status(): Status read:
 NUKI MODE 02
 LOCK STATE 01
 BATTERY 00
 LAST ACTION 04
 LAST TRIGGER 06
 DOOR SENSOR 01
[D][myBLE.cpp:82] myBLE_connect(): Unlocking the smart lock..
[D][nuki.cpp:176] create_challenge_payload(): CL Request Data 10 bytes (Unencrypted):
 9B  5D  34  00  01  00  04  00 
 64  B4 
[D][nuki.cpp:71] encrypt_payload(): client is encrypting payload message 10 bytes...
[D][nuki.cpp:77] encrypt_payload(): Authorization_id = 345D9B
[D][nuki.cpp:80] encrypt_payload(): crypto_secretbox_xsalsa20poly1305 (c,m,mlen,n,k)
[D][nuki.cpp:81] encrypt_payload(): m : 
 9B  5D  34  00  01  00  04  00 
 64  B4 
[D][nuki.cpp:83] encrypt_payload(): mlen : 10 
[D][nuki.cpp:84] encrypt_payload(): n : 
 A2  83  C7  D2  23  3A  2A  33 
 51  44  2B  BF  52  08  3C  9B 
 7C  3C  8D  27  01  3B  64  A1 
[D][nuki.cpp:86] encrypt_payload(): k : 
 03  EC  16  97  98  7A  16  FA 
 54  8C  5B  B0  20  F4  E0  B2 
 3C  F9  AC  51  59  19  64  68 
 F1  C0  06  2E  AD  86  99  D2 
[D][nuki.cpp:44] action_to_execute(): Action to execute: CL sends 56 bytes.
 A2  83  C7  D2  23  3A  2A  33 
 51  44  2B  BF  52  08  3C  9B 
 7C  3C  8D  27  01  3B  64  A1 
 9B  5D  34  00  1A  00  BF  41 
 E4  AD  E4  67  2E  30  40  C7 
 02  D6  4C  8F  53  7B  F8  0D 
 D6  A7  05  C7  21  D0  AF  D2 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 56
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3ffe92c0), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3ffe92c0), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee202-5501-11e4-916c-0800200c9a66, handle: 146 0x92, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:134] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:135] myBLE_notifyCallback(): a92ee202-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:136] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:294] processMessage(): client receives 20 bytes from uuid a92ee202-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:295] processMessage(): expected indication message CHALLENGE_COMMAND_IND
 D3  3A  96  E5  65  26  C0  B8 
 F7  8E  78  D0  B0  56  46  A0 
 67  CD  C3  05 
[E][nuki.cpp:399] get_commandId(): the message is encrypted.
[D][nuki.cpp:301] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee202-5501-11e4-916c-0800200c9a66, handle: 146 0x92, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:134] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:135] myBLE_notifyCallback(): a92ee202-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:136] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:294] processMessage(): client receives 20 bytes from uuid a92ee202-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:295] processMessage(): expected indication message CHALLENGE_COMMAND_IND
 74  DF  4B  A9  9B  5D  34  00 
 38  00  10  77  B1  29  B6  55 
 80  B3  29  7E 
[D][nuki.cpp:412] get_commandId(): multiple indication
[D][nuki.cpp:301] processMessage(): size of response buffer 40
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee202-5501-11e4-916c-0800200c9a66, handle: 146 0x92, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:134] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:135] myBLE_notifyCallback(): a92ee202-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:136] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:294] processMessage(): client receives 20 bytes from uuid a92ee202-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:295] processMessage(): expected indication message CHALLENGE_COMMAND_IND
 D4  AB  45  70  19  48  B3  F0 
 B9  AF  D5  9B  B2  BD  AA  1A 
 10  D0  82  5F 
[D][nuki.cpp:412] get_commandId(): multiple indication
[D][nuki.cpp:301] processMessage(): size of response buffer 60
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee202-5501-11e4-916c-0800200c9a66, handle: 146 0x92, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:134] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:135] myBLE_notifyCallback(): a92ee202-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:136] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:294] processMessage(): client receives 20 bytes from uuid a92ee202-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:295] processMessage(): expected indication message CHALLENGE_COMMAND_IND
 D9  C5  CA  4A  A9  0A  62  0E 
 A0  7E  FA  BB  28  86  34  9A 
 44  7F  E5  D9 
[D][nuki.cpp:412] get_commandId(): multiple indication
[D][nuki.cpp:301] processMessage(): size of response buffer 80
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee202-5501-11e4-916c-0800200c9a66, handle: 146 0x92, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:134] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:135] myBLE_notifyCallback(): a92ee202-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:136] myBLE_notifyCallback():  of data length 6

[D][nuki.cpp:294] processMessage(): client receives 6 bytes from uuid a92ee202-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:295] processMessage(): expected indication message CHALLENGE_COMMAND_IND
 E9  08  44  65  2F  66 
[D][nuki.cpp:412] get_commandId(): multiple indication
[D][nuki.cpp:301] processMessage(): size of response buffer 86
[D][nuki.cpp:349] processMessage(): Received challenge for lock action

[D][nuki.cpp:182] create_lock_action_payload(): client is sending lock action...
[D][nuki.cpp:102] decrypt_payload(): client is decrypting payload message 40 bytes...
[D][nuki.cpp:114] decrypt_payload(): crypto_secretbox_xsalsa20poly1305_open(m,c,clen,n,k)
[D][nuki.cpp:115] decrypt_payload(): c : 
 10  77  B1  29  B6  55  80  B3 
 29  7E  D4  AB  45  70  19  48 
 B3  F0  B9  AF  D5  9B  B2  BD 
 AA  1A  10  D0  82  5F  D9  C5 
 CA  4A  A9  0A  62  0E  A0  7E 
 FA  BB  28  86  34  9A  44  7F 
 E5  D9  E9  08  44  65  2F  66 
[D][nuki.cpp:117] decrypt_payload(): n : 
 D3  3A  96  E5  65  26  C0  B8 
 F7  8E  78  D0  B0  56  46  A0 
 67  CD  C3  05  74  DF  4B  A9 
[D][nuki.cpp:119] decrypt_payload(): k : 
 03  EC  16  97  98  7A  16  FA 
 54  8C  5B  B0  20  F4  E0  B2 
 3C  F9  AC  51  59  19  64  68 
 F1  C0  06  2E  AD  86  99  D2 
[D][nuki.cpp:141] decrypt_payload(): m : 
 9B  5D  34  00  04  00  FB  43 
 41  E6  79  36  69  38  66  C0 
 4F  66  64  8B  90  06  83  D0 
 25  B9  15  E9  BD  2C  86  74 
 02  A7  09  1E  89  61  92  7E 
[D][nuki.cpp:71] encrypt_payload(): client is encrypting payload message 46 bytes...
[D][nuki.cpp:77] encrypt_payload(): Authorization_id = 345D9B
[D][nuki.cpp:80] encrypt_payload(): crypto_secretbox_xsalsa20poly1305 (c,m,mlen,n,k)
[D][nuki.cpp:81] encrypt_payload(): m : 
 9B  5D  34  00  0D  00  01  BC 
 54  B1  77  00  FB  43  41  E6 
 79  36  69  38  66  C0  4F  66 
 64  8B  90  06  83  D0  25  B9 
 15  E9  BD  2C  86  74  02  A7 
 09  1E  89  61  95  8E 
[D][nuki.cpp:83] encrypt_payload(): mlen : 46 
[D][nuki.cpp:84] encrypt_payload(): n : 
 02  54  1A  5A  65  84  E8  FB 
 74  B8  FE  E6  7D  23  FA  9E 
 8A  A4  83  A5  A8  1E  0D  36 
[D][nuki.cpp:86] encrypt_payload(): k : 
 03  EC  16  97  98  7A  16  FA 
 54  8C  5B  B0  20  F4  E0  B2 
 3C  F9  AC  51  59  19  64  68 
 F1  C0  06  2E  AD  86  99  D2 
[D][nuki.cpp:351] processMessage(): client sends 92 bytes:
 02  54  1A  5A  65  84  E8  FB 
 74  B8  FE  E6  7D  23  FA  9E 
 8A  A4  83  A5  A8  1E  0D  36 
 9B  5D  34  00  3E  00  B4  E3 
 94  0A  0B  9B  4C  4D  90  27 
 FA  5B  7D  B4  21  B6  02  FB 
 4E  44  F4  5B  DC  5E  07  21 
 D3  26  68  AF  4C  20  69  16 
 46  53  39  73  E9  E3  1F  D1 
 0A  80  7C  4C  DA  AC  0D  B7 
 36  77  3E  D0  F3  BA  47  D0 
 CE  C2  67  C9 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 92
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3ffe92c0), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3ffe92c0), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_DISCONNECT_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_DISCONNECT_EVT
[E][BLEClient.cpp:193] gattClientEventHandler(): disconnect event, reason: 19, connId: 0, my connId: 0, my IF: 4, gattc_if: 4
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CLOSE_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CLOSE_EVT
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_DISCONNECT_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_DISCONNECT_EVT
[E][BLEClient.cpp:193] gattClientEventHandler(): disconnect event, reason: 19, connId: 0, my connId: 0, my IF: 5, gattc_if: 5
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_CLOSE_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 5] ... ESP_GATTC_CLOSE_EVT

I don’t know why that happens

Thank you in advance

Regards,
Javier Suárez

ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13

Connection terminate by peer user

Hi Javier,

The messages you’re sending all seem to be correct.

Do you receive the disconnect immediately or within a few seconds?
Is there a failed lock action entry stored in the activity log of the smart lock?

regards,
Marc

Hi Marc,

I receive the disconnect inmediately when I write the last command and in the activity log of smart lock there isn’t any log

I have spent a lot of time integrating with your bluetooth lock and I still do not get it and I do not know what to do

regards,
Javier

Hi Javier,

Can you please send me the whole communication from pairing till the unlock request.
I’ll try to replicate this with the same commands then.
Also please tell me the firmware version that is currently installed on your smart lock. I’ll use the same one then.

regards,
Marc

Hi Marc,

After long time without trying again now I can not even pairi to NUKI SL without making any changes to my code. I do not understand anything.

The firmware version is: 2.4.5

[1/2]

[D][nuki.cpp:10] pairing(): Start Pairing: CL sends 6 bytes.
 01  00  03  00  27  A7 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 6
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message PUBLIC_KEY_IND
 03  00  76  1C  C8  9F  F8  A8 
 EA  96  63  A6  41  3E  81  D3 
 41  D4  EB  39 
[D][nuki.cpp:413] get_commandId(): Command Id: PUBLIC_KEY.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message PUBLIC_KEY_IND
 27  8E  01  BF  FC  DD  DC  8A 
 40  E6  2F  FB  D8  58  16  9F 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:314] processMessage(): Received Public Key
[D][nuki.cpp:216] create_write_public_key_payload(): client is sending client public key...
[D][nuki.cpp:316] processMessage(): client sends 36 bytes:
 03  00  1E  95  FF  CB  5F  71 
 41  B9  35  D6  D3  62  E7  D2 
 D7  37  26  35  CC  09  63  2C 
 F0  42  22  D1  AA  2E  8A  D7 
 4D  68  E4  1E 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 36
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHENTICATION_IND
 04  00  FE  97  EE  5E  1A  33 
 C4  53  E4  53  BA  69  8D  BA 
 70  6E  1A  12 
[D][nuki.cpp:413] get_commandId(): Command Id: CHALLENGE.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHENTICATION_IND
 53  7F  B7  2D  7F  F3  73  B1 
 0B  6A  F8  7B  7E  45  9B  C3 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:325] processMessage(): Received challenge for authenticator
[D][nuki.cpp:228] create_authorization_authenticator_payload(): client is sending authorization authenticator...
[D][nuki.cpp:240] create_authorization_authenticator_payload(): The key derivation function kdf1 - crypto_core_hsalsa20(k,_0,s,sigma): shared secret calculated
 0D  FC  BF  36  20  20  27  9B 
 F0  EE  3A  75  31  E2  3C  5C 
 B2  55  81  C3  89  79  B6  C6 
 20  7C  BC  B1  C5  3E  43  E2 
[D][nuki.cpp:250] create_authorization_authenticator_payload(): The The authentication function h1 HMAC-SHA256: authentication calculated
 EA  06  5D  9A  24  A3  3E  FB 
 6D  61  C6  CA  64  7A  FD  2D 
 38  7F  AF  D6  8C  62  20  D3 
 5F  96  9A  EF  C9  08  05  B3 
[D][nuki.cpp:327] processMessage(): client sends 36 bytes:
 05  00  EA  06  5D  9A  24  A3 
 3E  FB  6D  61  C6  CA  64  7A 
 FD  2D  38  7F  AF  D6  8C  62 
 20  D3  5F  96  9A  EF  C9  08 
 05  B3  57  99 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 36
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHORIZATION_IND
 04  00  52  DD  E5  CE  F3  53 
 BB  BA  85  FA  36  FC  22  F1 
 28  F0  6F  F1 
[D][nuki.cpp:413] get_commandId(): Command Id: CHALLENGE.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHORIZATION_IND
 EF  8A  D7  7B  0E  80  74  DE 
 69  C4  07  15  39  68  18  50 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:336] processMessage(): Received challenge for authorization data
[D][nuki.cpp:258] create_authorization_data_payload(): cliente is sending authorization data...
[D][nuki.cpp:338] processMessage(): client sends 105 bytes:
 06  00  46  58  71  AC  58  5E 
 0E  32  03  1A  C9  CC  34  CD 
 3B  BF  E2  06  B0  C2  02  AE 
 FB  48  9E  C0  96  4F  81  1C 
 4E  76  02  2C  68  FB  13  4F 
 70  65  6E  20  4E  75  6B  69 
 20  46  6F  62  20  31  33  46 
 42  36  38  32  43  20  20  20 
 20  20  20  20  20  20  00  7E 
 C1  43  88  17  2A  65  2C  7E 
 4C  9E  7F  B5  4C  28  E8  6A 
 10  D9  F8  9B  0E  58  C7  75 
 7D  C1  81  68  51  4C  D3  6A 
 37 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 105
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
 07  00  A5  FA  E5  A3  A9  EF 
 EE  3A  93  79  2C  B3  A3  BC 
 F1  44  A4  23 
[D][nuki.cpp:413] get_commandId(): Command Id: AUTHORIZATION_ID.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
 1B  05  A8  DB  3F  B9  07  E7 
 2D  04  EB  5A  AD  4B  B8  5D 
 34  00  10  74 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 40
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
 A2  3B  7E  60  0F  58  8D  96 
 E3  94  BD  62  E2  BF  19  B0 
 60  33  FA  3B 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 60
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
 A7  D5  FD  67  26  70  3A  81 
 5A  D7  E0  57  DE  E2  BF  94 
 4D  30  A7  36 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 80
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 8

[D][nuki.cpp:303] processMessage(): client receives 8 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
 4C  B5  99  91  92  8D  16  4B 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 88
[D][nuki.cpp:347] processMessage(): Received authorization ID
[D][nuki.cpp:283] create_authorization_id_confirmation_payload(): client is sending authorization id confirmation...
[D][nuki.cpp:288] create_authorization_id_confirmation_payload(): Authorization ID 345DB8
[D][nuki.cpp:349] processMessage(): client sends 40 bytes:
 1E  00  63  B4  18  12  BE  49 
 4B  2E  34  DC  32  BB  CF  F1 
 94  70  DA  96  1F  36  C2  E5 
 4E  DD  0F  EB  92  D8  1E  61 
 EE  1D  B8  5D  34  00  4A  D1 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 40
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 9

[D][nuki.cpp:303] processMessage(): client receives 9 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message STATUS_IND
 12  00  FD  00  00  B4  18  8A 
 F9 
[E][nuki.cpp:409] get_commandId(): Command Id: ERROR_REPORT >> ERROR_BAD_CRC.

[D][nuki.cpp:310] processMessage(): size of response buffer 9
[D][nuki.cpp:370] processMessage(): Status indication

[D][nuki.cpp:169] read_status(): client is reading status indication...
[D][nuki.cpp:381] processMessage(): WHAT'S WRONG!!!!!!!!!!
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[E][myBLE.cpp:101] myBLE_link(): ERROR_CONN - Failed to connect to the server; there is nothing more we will do.
[E][noukee.cpp:136] link(): Error to link, slave device was removed

Thank you so much.

   D][nuki.cpp:10] pairing(): Start Pairing: CL sends 6 bytes.
 01  00  03  00  27  A7 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 6
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message PUBLIC_KEY_IND
 03  00  76  1C  C8  9F  F8  A8 
 EA  96  63  A6  41  3E  81  D3 
 41  D4  EB  39 
[D][nuki.cpp:413] get_commandId(): Command Id: PUBLIC_KEY.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message PUBLIC_KEY_IND
 27  8E  01  BF  FC  DD  DC  8A 
 40  E6  2F  FB  D8  58  16  9F 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:314] processMessage(): Received Public Key
[D][nuki.cpp:216] create_write_public_key_payload(): client is sending client public key...
[D][nuki.cpp:316] processMessage(): client sends 36 bytes:
 03  00  1E  95  FF  CB  5F  71 
 41  B9  35  D6  D3  62  E7  D2 
 D7  37  26  35  CC  09  63  2C 
 F0  42  22  D1  AA  2E  8A  D7 
 4D  68  E4  1E 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 36
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHENTICATION_IND
 04  00  FE  97  EE  5E  1A  33 
 C4  53  E4  53  BA  69  8D  BA 
 70  6E  1A  12 
[D][nuki.cpp:413] get_commandId(): Command Id: CHALLENGE.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHENTICATION_IND
 53  7F  B7  2D  7F  F3  73  B1 
 0B  6A  F8  7B  7E  45  9B  C3 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:325] processMessage(): Received challenge for authenticator
[D][nuki.cpp:228] create_authorization_authenticator_payload(): client is sending authorization authenticator...
[D][nuki.cpp:240] create_authorization_authenticator_payload(): The key derivation function kdf1 - crypto_core_hsalsa20(k,_0,s,sigma): shared secret calculated
 0D  FC  BF  36  20  20  27  9B 
 F0  EE  3A  75  31  E2  3C  5C 
 B2  55  81  C3  89  79  B6  C6 
 20  7C  BC  B1  C5  3E  43  E2 
[D][nuki.cpp:250] create_authorization_authenticator_payload(): The The authentication function h1 HMAC-SHA256: authentication calculated
 EA  06  5D  9A  24  A3  3E  FB 
 6D  61  C6  CA  64  7A  FD  2D 
 38  7F  AF  D6  8C  62  20  D3 
 5F  96  9A  EF  C9  08  05  B3 
[D][nuki.cpp:327] processMessage(): client sends 36 bytes:
 05  00  EA  06  5D  9A  24  A3 
 3E  FB  6D  61  C6  CA  64  7A 
 FD  2D  38  7F  AF  D6  8C  62 
 20  D3  5F  96  9A  EF  C9  08 
 05  B3  57  99 
[D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 36
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
[D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

[D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHORIZATION_IND
 04  00  52  DD  E5  CE  F3  53 
 BB  BA  85  FA  36  FC  22  F1 
 28  F0  6F  F1 
[D][nuki.cpp:413] get_commandId(): Command Id: CHALLENGE.

[D][nuki.cpp:310] processMessage(): size of response buffer 20
[D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
[D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
[D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
[D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
[D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 16

[D][nuki.cpp:303] processMessage(): client receives 16 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
[D][nuki.cpp:304] processMessage(): expected indication message CHALLENGE_AUTHORIZATION_IND
 EF  8A  D7  7B  0E  80  74  DE 
 69  C4  07  15  39  68  18  50 
[D][nuki.cpp:416] get_commandId(): multiple indication
[D][nuki.cpp:310] processMessage(): size of response buffer 36
[D][nuki.cpp:336] processMessage(): Received challenge for authorization data
[D][nuki.cpp:258] create_authorization_data_payload(): cliente is sending authorization data...

regards,
Javier

[2/2]

 [D][nuki.cpp:338] processMessage(): client sends 105 bytes:
     06  00  46  58  71  AC  58  5E 
     0E  32  03  1A  C9  CC  34  CD 
     3B  BF  E2  06  B0  C2  02  AE 
     FB  48  9E  C0  96  4F  81  1C 
     4E  76  02  2C  68  FB  13  4F 
     70  65  6E  20  4E  75  6B  69 
     20  46  6F  62  20  31  33  46 
     42  36  38  32  43  20  20  20 
     20  20  20  20  20  20  00  7E 
     C1  43  88  17  2A  65  2C  7E 
     4C  9E  7F  B5  4C  28  E8  6A 
     10  D9  F8  9B  0E  58  C7  75 
     7D  C1  81  68  51  4C  D3  6A 
     37 
    [D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 105
    [D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
    [D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
    [D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

    [D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
     07  00  A5  FA  E5  A3  A9  EF 
     EE  3A  93  79  2C  B3  A3  BC 
     F1  44  A4  23 
    [D][nuki.cpp:413] get_commandId(): Command Id: AUTHORIZATION_ID.

    [D][nuki.cpp:310] processMessage(): size of response buffer 20
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

    [D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
     1B  05  A8  DB  3F  B9  07  E7 
     2D  04  EB  5A  AD  4B  B8  5D 
     34  00  10  74 
    [D][nuki.cpp:416] get_commandId(): multiple indication
    [D][nuki.cpp:310] processMessage(): size of response buffer 40
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

    [D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
     A2  3B  7E  60  0F  58  8D  96 
     E3  94  BD  62  E2  BF  19  B0 
     60  33  FA  3B 
    [D][nuki.cpp:416] get_commandId(): multiple indication
    [D][nuki.cpp:310] processMessage(): size of response buffer 60
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 20

    [D][nuki.cpp:303] processMessage(): client receives 20 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
     A7  D5  FD  67  26  70  3A  81 
     5A  D7  E0  57  DE  E2  BF  94 
     4D  30  A7  36 
    [D][nuki.cpp:416] get_commandId(): multiple indication
    [D][nuki.cpp:310] processMessage(): size of response buffer 80
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 8

    [D][nuki.cpp:303] processMessage(): client receives 8 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message AUTHORIZATION_ID_IND
     4C  B5  99  91  92  8D  16  4B 
    [D][nuki.cpp:416] get_commandId(): multiple indication
    [D][nuki.cpp:310] processMessage(): size of response buffer 88
    [D][nuki.cpp:347] processMessage(): Received authorization ID
    [D][nuki.cpp:283] create_authorization_id_confirmation_payload(): client is sending authorization id confirmation...
    [D][nuki.cpp:288] create_authorization_id_confirmation_payload(): Authorization ID 345DB8
    [D][nuki.cpp:349] processMessage(): client sends 40 bytes:
     1E  00  63  B4  18  12  BE  49 
     4B  2E  34  DC  32  BB  CF  F1 
     94  70  DA  96  1F  36  C2  E5 
     4E  DD  0F  EB  92  D8  1E  61 
     EE  1D  B8  5D  34  00  4A  D1 
    [D][BLERemoteCharacteristic.cpp:554] writeValue(): >> writeValue(), length: 40
    [D][FreeRTOS.cpp:164] take(): Semaphore taking: name: WriteCharEvt (0x3fff8374), owner: <N/A> for writeValue
    [D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: WriteCharEvt (0x3fff8374), owner: writeValue
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_NOTIFY_EVT
    [D][BLERemoteCharacteristic.cpp:170] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: a92ee101-5501-11e4-916c-0800200c9a66, handle: 139 0x8b, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 1, auth: 0
    [D][myBLE.cpp:157] myBLE_notifyCallback(): ******************** Notify callback for characteristic 
    [D][myBLE.cpp:158] myBLE_notifyCallback(): a92ee101-5501-11e4-916c-0800200c9a66
    [D][myBLE.cpp:159] myBLE_notifyCallback():  of data length 9

    [D][nuki.cpp:303] processMessage(): client receives 9 bytes from uuid a92ee101-5501-11e4-916c-0800200c9a66
    [D][nuki.cpp:304] processMessage(): expected indication message STATUS_IND
     12  00  FD  00  00  B4  18  8A 
     F9 
    [E][nuki.cpp:409] get_commandId(): Command Id: ERROR_REPORT >> ERROR_BAD_CRC.

    [D][nuki.cpp:310] processMessage(): size of response buffer 9
    [D][nuki.cpp:370] processMessage(): Status indication

    [D][nuki.cpp:169] read_status(): client is reading status indication...
    [D][nuki.cpp:381] processMessage(): WHAT'S WRONG!!!!!!!!!!
    [D][BLEDevice.cpp:152] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
    [D][BLEClient.cpp:170] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_WRITE_CHAR_EVT
    [D][BLERemoteCharacteristic.cpp:581] writeValue(): << writeValue
    [E][myBLE.cpp:101] myBLE_link(): ERROR_CONN - Failed to connect to the server; there is nothing more we will do.
    [E][noukee.cpp:136] link(): Error to link, slave device was removed

Hi Javier,

I checked your messages and everything seems to be fine.
The ERROR_BAD_CRC you’re receiving at the end is independent from any encryption so you will only receive this error, if the CRC really is wrong.
In your case the CRC in the message you’re printing in the log is correct, so it seems, the message you’re printing is not the same you’re sending.
Is this message eventually stored in a buffer that is larger than the message itself and some additional bytes are transferred?

The CRCs on the previous messages were accepted by the smart lock. Do you change anything on the communication behaviour in the background once you’ve received the authorization ID?

Don’t know if it will help, but can send me your code via DM as well and I’ll look into it.
I won’t be able to execute it but maybe I’ll spot something in there.

regards,
Marc