Closed eos1d3 closed 5 years ago
Hello,
You can use ble arduino library from the lib folder of OMG repo and remove the BLE one from esp32 environment (this is detailled into the wiki) . I'm using the fork of @fguiet https://github.com/nkolban/ESP32_BLE_Arduino/pull/24
Hi,
Many thanks for your help. I am able to read the raw data from Mi Jia now. Never expect ESP32 BLE library does not work.
After using @fguiet fork for a while, everything works except one strange bug.
I have LYWSD02 and also MJ_HT_V1. When using ESP Arduino library and their scan example code, I can see both device names using:
Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
After switching to fguiet library and its scan example, I can only see MJ_HT_V1 device name. LYWSD02 name is always empty, advertisedDevice.toString()
does not have its name, and advertisedDevice.haveName()
is always false.
It is not a big issue, but is this normal?
Hi @1technophile
@fguiet repository is based on old ESP32 library which causes these problem:
getServiceDataCount
returns 1But his PR is just perfect. I use ESP32 recent BLE library and change with his PR, now all these problems are fixed.
The update version is here: https://github.com/eos1d3/ESP32_BLE
Tested with LYWSD02 and MJ_HT_V1. All work fine.
Nice ! Thanks for the lib. I will refer yours on next release.
with platformio integration I have added the link to the modified library in platformio.ini
I think you also need to add the link to the modified library in section [env:ttgo-lora32-v1]. I had the same compile error until I did that.
Are you using ble with LORA, maybe this is why you had the error?
I am trying to use ESP32 with PlatformIO (using Platform Espressif 32, 1.9.0) to scan Mi Jia.
But from ZgatewayBT.ino, I find there is
advertisedDevice.getServiceDataCount()
andadvertisedDevice.getServiceData(j)
This means there are more than just one data in the callback. But the current ESP32 library does not have these, with only advertisedDevice.getServiceData().That is why I can get UUID 0000180f-0000-1000-8000-00805f9b34fb data only. But no sensor data.
And would you please tell me which ESP library are you using? And how to read those data?
Thanks!
I am using example code to scan:
And I get only this:
Advertised Device: Name: MJ_HT_V1, Address: 58:2d:34:34:0f:a1, serviceUUID: 0000180f-0000-1000-8000-00805f9b34fb