Github Boards Devices Community Docs Blog

[SOLVED] OMG ZgatewayBT fatal error NimBLEAdvertisedDevice.h in ESP32

Hello,

My board is ESP32-DevKitC V4 with ESP32-WROOM-32U. I’m trying to build OMG 0.9.4 with Arduino IDE 1.8.3 on Debian 10 Buster. The only changes have been to User_config.h as follows:

#  define OMG_VERSION "0.9.4"
#define ZgatewayBT     "BT"       //ESP8266, ESP32
#define ZmqttDiscovery "HADiscovery"//ESP8266, Arduino, ESP32, Sonoff RF Bridge

When building/uploading the following error is displayed:

Arduino: 1.8.13 (Linux), Board: "ESP32 Dev Module, Disabled, Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None"

Multiple libraries were found for "WiFi.h"
 Used: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /home/myuser/Downloads/arduino/arduino-1.8.13/libraries/WiFi
ZgatewayBT:39:40: fatal error: NimBLEAdvertisedDevice.h: No such file or directory
compilation terminated.
exit status 1
NimBLEAdvertisedDevice.h: No such file or directory

Actually, a more verbose output shows:

/home/myuser/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-g++ -DESP_PLATFORM "-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"" -DHAVE_CONFIG_H -DGCC_NOT_5_2_0=0 -DWITH_POSIX -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/config -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/app_trace -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/app_update -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/asio -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/bootloader_support -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/bt -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/coap -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/console -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/driver -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp-tls -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp32 -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_adc_cal -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_event -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_http_client -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_http_server -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_https_ota -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp_ringbuf -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/ethernet -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/expat -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/fatfs -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/freemodbus -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/freertos -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/heap -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/idf_test -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/jsmn -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/json -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/libsodium -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/log -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/lwip -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/mbedtls -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/mdns -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/micro-ecc -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/mqtt -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/newlib -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/nghttp -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/nvs_flash -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/openssl -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/protobuf-c -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/protocomm -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/pthread -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/sdmmc -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/smartconfig_ack -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/soc -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/spi_flash -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/spiffs -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/tcp_transport -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/tcpip_adapter -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/ulp -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/vfs -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/wear_levelling -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/wifi_provisioning -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/wpa_supplicant -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/xtensa-debug-module -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp-face -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp32-camera -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/esp-face -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/fb_gfx -std=gnu++11 -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -w -Wno-error=maybe-uninitialized -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-missing-field-initializers -Wno-sign-compare -fno-rtti -c -w -x c++ -E -CC -DF_CPU=240000000L -DARDUINO=10813 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DESP32 -DCORE_DEBUG_LEVEL=0 -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/cores/esp32 -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/variants/esp32 -I/home/myuser/Arduino/libraries/ArduinoJson_ID64/src -I/home/myuser/Arduino/libraries/ArduinoLog -I/home/myuser/Arduino/libraries/PubSubClient_ID89/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/ArduinoOTA/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Update/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/FS/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/SPIFFS/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Preferences/src -I/home/myuser/Arduino/libraries/WifiManager -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WebServer/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/DNSServer/src -I/home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/BLE/src /tmp/arduino_build_795485/sketch/main.ino.cpp -o /dev/null -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for NimBLEAdvertisedDevice.h: []ZgatewayBT:39:40: fatal error: NimBLEAdvertisedDevice.h: No such file or directory

ResolveLibrary(NimBLEAdvertisedDevice.h)
compilation terminated.
  -> candidates: []
Multiple libraries were found for "WiFi.h"
 Used: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi
 Not used: /home/myuser/Descargas/arduino/arduino-1.8.13/libraries/WiFi
Using library ArduinoJson_ID64 at version 5.13.4 in folder: /home/myuser/Arduino/libraries/ArduinoJson_ID64 
Using library ArduinoLog at version 1.0.3 in folder: /home/myuser/Arduino/libraries/ArduinoLog 
Using library PubSubClient_ID89 at version 2.8 in folder: /home/myuser/Arduino/libraries/PubSubClient_ID89 
Using library ArduinoOTA at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/ArduinoOTA 
Using library WiFi at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi 
Using library Update at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Update 
Using library FS at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/FS 
Using library SPIFFS at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/SPIFFS 
Using library Preferences at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/Preferences 
Using library WifiManager at version 1.0.0 in folder: /home/myuser/Arduino/libraries/WifiManager 
Using library WebServer at version 1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WebServer 
Using library DNSServer at version 1.1.0 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/DNSServer 
Using library BLE at version 1.0.1 in folder: /home/myuser/.arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/BLE 
exit status 1
NimBLEAdvertisedDevice.h: No such file or directory

I have installed libraries via:
https://dl.espressif.com/dl/package_esp32_index.json
https://arduino.esp8266.com/stable/package_esp8266com_index.json

image

I have searched for this error message in the forum and in the Internet but cannot find either a topic that has previously discussed it or a possible solution. So any piece of advice is much appreciated in advance.

Regards,

Hi @mixpc ,

You should download this library and unzip it in your sketchbook folder/libraries.

This should solve your issue.

Note that this is not related to v0.9.4. The issue comes from the fact that you are taking the development branch with the Arduino IDE environment. Indeed platformio retrieves automaticaly the appropriate libraries but not the Arduino IDE.
For whom who wans to test or develop from the development branch with the Arduino IDE the best things to do is to retrieve the libraries pointed in platformio.ini.

Regards

Excellent! Merci for the link and clarification. I will add [SOLVED] to title. Always helpful.

Just one additional doubt:

Mijia Thermohygrometer 2 LYWSD03MMC is OpenMQTTGateway friendly as listed in
OpenMQTTGateway reference sheet compatible devices, parts, functions list, pinout

Mijia Thermohygrometer 2 is linked to Xiaomi Home Android app, showing temperature and humidity, and Mijia Thermohygrometer 2 firmware is updated to latest version 1.0.0_0109, hardware version being B1.4

OMG is integrated into HomeAssistant and sensors are created for the Mijia Thermohygrometer 2:

mosquitto_sub -h 192.168.1.10 -p 1883 -t '#' -v

home/OpenMQTTGateway/LWT online
home/OpenMQTTGateway/version 0.9.4

[...]

homeassistant/sensor/6F9D4T5AC1A5-LYWSD03MMC-batt/config {"stat_t":"home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5","name":"LYWSD03MMC-batt","uniq_id":"6F9D4T5AC1A5-LYWSD03MMC-batt","dev_cla":"battery","val_tpl":"{{ value_json.batt | is_defined }}","unit_of_meas":"%"}
homeassistant/sensor/6F9D4T5AC1A5-LYWSD03MMC-volt/config {"stat_t":"home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5","name":"LYWSD03MMC-volt","uniq_id":"6F9D4T5AC1A5-LYWSD03MMC-volt","dev_cla":"voltage","val_tpl":"{{ value_json.volt | is_defined }}","unit_of_meas":"V"}
homeassistant/sensor/6F9D4T5AC1A5-LYWSD03MMC-tempc/config {"stat_t":"home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5","name":"LYWSD03MMC-tempc","uniq_id":"6F9D4T5AC1A5-LYWSD03MMC-tempc","dev_cla":"temperature","val_tpl":"{{ value_json.tempc | is_defined }}","unit_of_meas":"C"}
homeassistant/sensor/6F9D4T5AC1A5-LYWSD03MMC-tempf/config {"stat_t":"home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5","name":"LYWSD03MMC-tempf","uniq_id":"6F9D4T5AC1A5-LYWSD03MMC-tempf","dev_cla":"temperature","val_tpl":"{{ value_json.tempf | is_defined }}","unit_of_meas":"F"}
homeassistant/sensor/6F9D4T5AC1A5-LYWSD03MMC-hum/config {"stat_t":"home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5","name":"LYWSD03MMC-hum","uniq_id":"6F9D4T5AC1A5-LYWSD03MMC-hum","dev_cla":"humidity","val_tpl":"{{ value_json.hum | is_defined }}","unit_of_meas":"%"}

[...]

home/OpenMQTTGateway/SYStoMQTT {"uptime":2632,"version":"0.9.4","freemem":173548,"rssi":-41,"SSID":"ROUTER","ip":"192.168.1.10","mac":"42:BC:DA:01:15:44","wifiprt":0,"lowpowermode":0,"interval":55555,"scanbcnct":10,"modules":"BTHADiscovery"}

[...]

For some reason LYWSD03MMC-volt is not showing as a sensor but that’s ok.

However, there are no readings from the Mijia Thermohygrometer 2 being published. The only reading that OMG is receiving is:

home/home_presence/OpenMQTTGateway {"id":"6F:9D:4T:5A:C1:A5","name":"LYWSD03MMC","rssi":-91,"distance":25.51913}
home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5 {"id":"6F:9D:4T:5A:C1:A5","name":"LYWSD03MMC","rssi":-91,"distance":0.127026,"servicedata":"30585b057d986f5238c1a408"}

Distance between ESP32 board and Mijia Thermohygrometer 2 is 1 meter, no walls, for testing purposes, notice distance values 0.12 and 0.08

If I force readings, since “interval”:55555

mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"interval":0}'

This is the data obtained:

home/home_presence/OpenMQTTGateway {"id":"23:H6:13:8M:3D:8C","manufacturerdata":"e0000207ca3c78a9","rssi":-77,"distance":7.119795}
home/OpenMQTTGateway/BTtoMQTT/443B64B80E76 {"id":"23:H6:13:8M:3D:8C","rssi":-77,"distance":7.119795}
home/home_presence/OpenMQTTGateway {"id":"43:AH:4F:21:3E:7B","manufacturerdata":"e000026aca8a7c26","rssi":-69,"distance":3.119501}
home/OpenMQTTGateway/BTtoMQTT/505A7F1194C7 {"id":"43:AH:4F:21:3E:7B","rssi":-69,"distance":3.119501}
home/home_presence/OpenMQTTGateway {"id":"6F:9D:4T:5A:C1:A5","name":"LYWSD03MMC","rssi":-46,"distance":0.082996}
home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5 {"id":"6F:9D:4T:5A:C1:A5","name":"LYWSD03MMC","rssi":-46,"distance":0.082996,"servicedata":"30585b0583986f5238c1a408"}

Could you please suggest any step I may have missed? Or any configuration I should tweak? Glad to do as much testing as needed.

Thank you and regards!

Hi,

You should disconnect it from your phone, so as to enable the OMG connection.
The values of the LYWSD03MMC are retrieved every 10 min approximatively so you may have to wait a little bit before seeing them.

Maybe @francisp could help us on this point?

Regards

Thank you once more for your support. Restarted HA, resetted ESP32, wait and voilà!

home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5 {"model":"LYWSD03MMC","id":"6F:9D:4T:5A:C1:A5","tempc":12.31,"tempf":54.158,"hum":67,"volt":2.976,"batt":87.6}

and 10min later approx.

home/OpenMQTTGateway/BTtoMQTT/6F9D4T5AC1A5 {"model":"LYWSD03MMC","id":"6F:9D:4T:5A:C1:A5","tempc":12.36,"tempf":54.248,"hum":67,"volt":2.976,"batt":87.6}

Merci beaucoup!

For reference, please, note sensors detected in HA:

Regards,

Great, happy that you got it working :slight_smile: