myhomeiot / esphome-components

A collection of my ESPHome components
Other
260 stars 26 forks source link

BLE Client Request needed to then receive notification #8

Closed danps1 closed 2 years ago

danps1 commented 2 years ago

Hi @myhomeiot Firstly, thanks very much for the gateway functionality - I am using it extensively with BLE sensors and it works great! And now I am trying to use the BLE client for another device, but can't quite work out if what I'm trying to do is already possible, and I just haven't worked out how to, or if I'm in fact making a feature request! The device is a BLE swimming pool sensor called Blue Connect, and I am able to retrieve data from it using a BLE tool on my phone, but it involves the following procedure...

  1. Connect to device
  2. I "subscribe" to a particular UUID which will then be the UUID that sends the reading. (I think this is the "notify" functionality)
  3. I then need to write a boolean true / 0x01 to another UUID to request that a reading be taken
  4. The reading is taken, and about 10 seconds later it is sent to the notify UUID
  5. The "reading request" UUID is reset by the device to false
  6. Disconnect from device

IMG_6350

That is what it looks like from my phone.

UUID F3300002-FOA2-9B06-0C59-1BC4763B5C00 is the one that I write TRUE / 0x01 to and then I get the answer notified on F3300003-F0A2-9B06-0C59-1BC4763B5C00

Do you think this is possible with BLE client?

Thanks

myhomeiot commented 2 years ago

Currently this custom BLE Client allows only to read one characteristic and process the data. I already thinking how to extend this functionality and allow to read/write other characteristic but it's will requires more knowledge and probably for peoples which has this knowledge will be easier to write dedicated BLE component based for example on @dentra works.

You can also try to combine official BLE Client Binary Output in order to write TRUE / 0x01 and BLE Client Sensor in order to get the answer notified on F3300003-F0A2-9B06-0C59-1BC4763B5C00

Hope this helps you.

myhomeiot commented 2 years ago

Here you can find example using regular ble_client which poll coffee machine and read data back, you can change it for your case.