Is BLE client pairing / bonding possible?

Hi, I have a few BLE window sensors that I was hoping to use with a Sonoff DUALR3 (as it has an ESP32) to inhibit a roller shutter from closing if the window was open.

The device requires you to press on a reset button to pair the device, when I do this I can see in the logs that it is being discovered but after the 30s pairing cycle finishes it disconnects. I was hoping that enabling a BLE Client Sensor component with the notify option would pair the device but it does not. Does anyone have any advice on this?

The ESPhome docs for the BLE client say This component does not (yet) support devices that require security settings (eg connecting with a PIN). but this device doesn’t have a pin but looks like it just requires some pairing/bonding to happen.

Here is the log for when the device connects if useful?

[23:08:33][I][ble_client:083]: Attempting BLE connection to xx:xx:xx:xx:xx:xx
[23:08:34][I][ble_sensor:033]: [Notifiy] Connected successfully!
[23:08:35][I][ble_client:159]: Service UUID: 0x1800
[23:08:35][I][ble_client:160]:   start_handle: 0x1  end_handle: 0x7
[23:08:35][I][ble_client:339]:  characteristic 0x2A00, handle 0x3, properties 0x12
[23:08:35][I][ble_client:339]:  characteristic 0x2A01, handle 0x5, properties 0x2
[23:08:35][I][ble_client:339]:  characteristic 0x2A04, handle 0x7, properties 0x2
[23:08:35][I][ble_client:159]: Service UUID: 0x180A
[23:08:35][I][ble_client:160]:   start_handle: 0x8  end_handle: 0xc
[23:08:35][I][ble_client:339]:  characteristic 0x2A50, handle 0xa, properties 0x2
[23:08:35][I][ble_client:339]:  characteristic 0x2A26, handle 0xc, properties 0x2
[23:08:35][I][ble_client:159]: Service UUID: 00010203040506-0708-090A-0B0C-0D1912
[23:08:35][I][ble_client:160]:   start_handle: 0xd  end_handle: 0x10
[23:08:35][I][ble_client:339]:  characteristic 00010203040506-0708-090A-0B0C-0D2B12, handle 0xf, properties 0x6
[23:08:35][I][ble_client:159]: Service UUID: 0x1827
[23:08:35][I][ble_client:160]:   start_handle: 0x11  end_handle: 0x19
[23:08:35][I][ble_client:339]:  characteristic 0x2ADC, handle 0x13, properties 0x10
[23:08:35][I][ble_client:339]:  characteristic 0x2ADB, handle 0x17, properties 0x4
[23:08:35][I][ble_client:159]: Service UUID: 0x7FDD
[23:08:35][I][ble_client:160]:   start_handle: 0x1a  end_handle: 0x22
[23:08:35][I][ble_client:339]:  characteristic 0x2ADE, handle 0x1c, properties 0x10
[23:08:35][I][ble_client:339]:  characteristic 0x2ADD, handle 0x20, properties 0x4
[23:08:35][I][ble_client:159]: Service UUID: 00010203040506-0708-090A-0B0C-0D7FDE
[23:08:35][I][ble_client:160]:   start_handle: 0x23  end_handle: 0x26
[23:08:35][I][ble_client:339]:  characteristic 00010203040506-0708-090A-0B0C-0D7FDF, handle 0x25, properties 0x36
[23:08:35][I][ble_client:159]: Service UUID: 0x1801
[23:08:35][I][ble_client:160]:   start_handle: 0x27  end_handle: 0x2b
[23:08:35][I][ble_client:339]:  characteristic 0x2A05, handle 0x29, properties 0x20
[23:08:35][I][ble_client:159]: Service UUID: 0x1910
[23:08:35][I][ble_client:160]:   start_handle: 0x2c  end_handle: 0x34
[23:08:35][I][ble_client:339]:  characteristic 0x2B10, handle 0x2e, properties 0x10
[23:08:35][I][ble_client:339]:  characteristic 0x2B11, handle 0x32, properties 0x4

I think Service 0x1801 is the contact, but don’t think I can check until it pairs correctly.

After some further reading it would look like even tho there is no pin, pairing authentication / key exchange would need to happen. So until the component supports SMP (Security Manager Protocol) i don’t think i will be able to pair them.

FYI the contacts are from Tuya, and contain a BT5S module

Did you find another solution for this? I also have a device that needs to bond in order to send commands to it.

Unfortunately not, they are still sitting in my draw. I did come across a issue in the esphome github that if resolved might have helped with this. I will try and find it again and see if there has been any progress.

1 Like