esp32-snippets: Unable to get sensible sensor data from Xiaomi Flower Care

Thanks for this library - a huge step forwards in making BLE usable on the ESP32 - THANKS!!

I’ve created a sample based on your Client example to retrieve data from the Xiaomi Flower Care device. I can get the battery level & firmware info just fine but the characteristic that should return sensor data (moisture, light, fertility) is returning junk though the amount of data returned (16 bytes) is sensible. There are multiple simple Python & JS examples around to get data from this device which I have followed carefully to no avail.

http://forum.espruino.com/conversations/303598/ https://wiki.hackerspace.pl/projects:xiaomi-flora

Sample data (depending on sensor readings) should look something like “207, 0, 0, 209, 12, 0, 0, 24, 124, 1, 2, 60, 0, 251, 52, 155” - but I’m getting “170 187 204 221 238 255 153 136 119 102 0 0 0 0 0 0” - not even close!

f7 | 00 | 10 | 13 | 00 | 00 | 00 | 25 | f5 | 04 | 02 | 1c | 40 | fb | 34 | 9b
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
Temp    | ?? | Light             | %  |Fertility| ?? | ?? | ?? | ?? | ?? | ??
                                 Moisture

As I said, other data (battery, firmware) from another characteristic is fine. There are no descriptors for the characteristic used to turn on real time reporting which results in

[E][BLERemoteCharacteristic.cpp:307] retrieveDescriptors(): esp_ble_gattc_get_all_descr: ESP_GATT_NOT_FOUND

Would that be an issue?

BLE_client_ino.txt

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 104

Most upvoted comments

Maybe try to read from this characteristic first and see whats happened, and/or add small delay before write.

I will think about test code to see how to fix it, but in meantime. Can you read proper values with nRF connect? Also can you tell me UUIDs for service and characteristics from nRF?

PS are you working with esp-idf or arduino-ide?