miky_italy
(Michele Canteri)
April 26, 2023, 2:56pm
1
Hi everyone,
I have 2 ESP devices, hardware the same (ESP WROOM 32 with a BH1750 lux sensor), and configuration almost the same (one retrieves data from my MiScale) and I see that they keep rebooting from time to time and I am trying to understand if it is my fault (bad configuration probably or not use of the best/correct SDK) or it is something we should make peace with
By the way, both work well, they do Bluetooth proxy (for this purpose I know there are better frameworks to use), they send lux data and one sends the scale data.
Here the code:
esphome:
name: Two
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging VERY_VERBOSE
logger:
#level: VERBOSE
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: !secret hotspot2_ssid
password: !secret hotspot_password
captive_portal:
# Example configuration entry for finding
esp32_ble_tracker:
scan_parameters:
duration: 2min
interval: 1100ms
window: 1100ms
active: true
# Bluetooth Proxy
bluetooth_proxy:
active: true
i2c:
sda: 18
scl: 5
scan: true
id: bus_a
sensor:
- platform: bh1750
name: "Esp2 Light Sensor"
address: 0x23
update_interval: 30s
- platform: uptime
name: Uptime Sensor Two
Thank you all in advance for any advice
Michele
miky_italy:
esp32_ble_tracker:
I’ve had stability issues using this alongside other sensors, like this issue.
So you could try disabling/comment out either the ble or other sensors and see if stability improves to help confirm if this is the cause.
I now run my ble scanners as dedicated devices and don’t load them up any more. My understanding is the ble library is resource intensive.
opened 03:29PM - 09 Jun 21 UTC
integration: esp32_ble_tracker
<!-- Thanks for reporting a bug for this project. READ THIS FIRST:
- Provide … as many details as possible. Simply saying "X gives bug" or "X gives error" is not enough!
- Paste logs, configuration sample and code into the backticks (```).
- Read through the template carefully and fill out all missing details.
- Please also search for similar issues in this issue tracker first and read through the ESPHome FAQ.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->
**Operating environment/Installation (Hass.io/Docker/pip/etc.):**
<!--
Please provide details about your environment below this line. -->
pip
**ESP (ESP32/ESP8266, Board/Sonoff):**
<!--
Please provide details about which ESP you're using below.
-->
ESP32
**ESPHome version (latest production, beta, dev branch)**
<!--
ESPHome version like v1.14 or 1.15-dev
-->
1.18.0
**Affected component:**
<!--
Please add the link to the documentation at https://esphome.io/index.html of the component in question.
-->
esp32_ble_tracker
https://esphome.io/components/esp32_ble_tracker.html
**Description of problem:**
When enabling `esp32_ble_tracker` in addition to some other components, the ESP becomes unstable and crashes/reboots constantly. Sometimes it never finishes booting and gets stuck in a boot loop. It appears to be reproducible ~ 8/10 times.
I've encountered this issue when combining `esp32_ble_tracker` with `web` and `fastled_clockless`, however it does not seem to be specific to any component other than `esp32_ble_tracker`
Running `esp32_ble_tracker` on its own with no other sensors enabled at the same time seems to be stable.
**Problem-relevant YAML-configuration entries:**
```yaml
esphome:
name: ble-test
platform: ESP32
board: nodemcu-32s
logger:
logs:
esp32_ble_tracker: INFO
esp32_ble_tracker:
sensor:
- platform: ble_rssi
mac_address: "A4:C1:38:XX:XX:XX"
name: "Kitchen BLE RSSI"
- platform: atc_mithermometer
mac_address: "A4:C1:38:XX:XX:XX"
temperature:
name: "Kitchen Temperature"
humidity:
name: "Kitchen Humidity"
battery_level:
name: "Kitchen LYWSD03MMC Battery Level"
battery_voltage:
name: "Kitchen LYWSD03MMC Battery Voltage"
- platform: ble_rssi
mac_address: "A4:C1:38:XX:XX:XX"
name: "Bathroom BLE RSSI"
- platform: atc_mithermometer
mac_address: "A4:C1:38:XX:XX:XX"
temperature:
name: "Bathroom Temperature"
humidity:
name: "Bathroom Humidity"
battery_level:
name: "Bathroom LYWSD03MMC Battery Level"
battery_voltage:
name: "Bathroom LYWSD03MMC Battery Voltage"
- platform: ble_rssi
mac_address: "A4:C1:38:XX:XX:XX"
name: "Office BLE RSSI"
- platform: atc_mithermometer
mac_address: "A4:C1:38:XX:XX:XX"
temperature:
name: "Office Temperature"
humidity:
name: "Office Humidity"
battery_level:
name: "Office LYWSD03MMC Battery Level"
battery_voltage:
name: "Office LYWSD03MMC Battery Voltage"
- platform: ble_rssi
mac_address: "A4:C1:38:XX:XX:XX"
name: "Fridge BLE RSSI"
- platform: atc_mithermometer
mac_address: "A4:C1:38:XX:XX:XX"
temperature:
unit_of_measurement: "°C"
name: "Fridge Temperature"
humidity:
name: "Fridge Humidity"
battery_level:
name: "Fridge LYWSD03MMC Battery Level"
battery_voltage:
name: "Fridge LYWSD03MMC Battery Voltage"
- platform: wifi_signal
name: ble-test WiFi Signal
update_interval: 60s
- platform: uptime
name: ble-test_uptime
id: uptime_sensor
update_interval: 60s
wifi:
power_save_mode: NONE
ap:
ssid: ble-test_AP
password: !secret 'hotspot_password'
networks:
- ssid: !secret 'wifi_name'
password: !secret 'wifi_password'
time:
- platform: homeassistant
api:
password: !secret 'ota_password'
ota:
password: !secret 'ota_password'
web_server:
text_sensor:
- platform: version
name: ble-test_version
light:
- platform: fastled_clockless
chipset: WS2812B
pin: 32
num_leds: 300
rgb_order: GRB
name: Kitchen LED Strip
restore_mode: ALWAYS_OFF
```
**Logs (if applicable):**
<!--
Please copy the debug log here. If possible, also connect to the ESP over USB and copy those logs into the backticks.
-->
```
[08:11:46][I][logger:170]: Log initialized
[08:11:46][C][ota:366]: There have been 1 suspected unsuccessful boot attempts.
[08:11:46][I][app:029]: Running through setup()...
[08:11:46][C][fastled:010]: Setting up FastLED light...
[08:11:46][C][light:097]: Setting up light 'Kitchen LED Strip'...
[08:11:46][D][light:265]: 'Kitchen LED Strip' Setting:
[08:11:46][D][light:278]: Brightness: 100%
[08:11:46][D][light:287]: Red=100%, Green=100%, Blue=100%
[08:11:47][D][text_sensor:015]: 'ble-test_version': Sending state '1.18.0 Jun 9 2021, 07:58:34'
[08:11:47][C][wifi:033]: Setting up WiFi...
[08:11:47][D][wifi:324]: Starting scan...
[08:11:47][D][sensor:099]: 'ble-test_uptime': Sending state 0.80300 s with 0 decimals of accuracy
[08:11:49][D][wifi:339]: Found networks:
[08:11:49][I][wifi:385]: - 'Sprinkles' (D4:68:4D:XX:XX:XX) ▂▄▆█
[08:11:49][D][wifi:386]: Channel: 3
[08:11:49][D][wifi:387]: RSSI: -35 dB
<SNIP>
[08:11:49][I][wifi:194]: WiFi Connecting to 'Sprinkles'...
[08:11:50][D][sensor:099]: 'Fridge BLE RSSI': Sending state -79.00000 dB with 0 decimals of accuracy
[08:11:50][D][atc_mithermometer:116]: Got ATC MiThermometer (A4:C1:38:XX:XX:XX):
[08:11:50][D][atc_mithermometer:119]: Temperature: 3.3 °C
[08:11:50][D][atc_mithermometer:122]: Humidity: 21 %
[08:11:50][D][atc_mithermometer:125]: Battery Level: 71 %
[08:11:50][D][atc_mithermometer:128]: Battery Voltage: 2.846 V
[08:11:50][D][sensor:099]: 'Fridge Temperature': Sending state 3.30000 °C with 1 decimals of accuracy
[08:11:50][D][sensor:099]: 'Fridge Humidity': Sending state 21.00000 % with 0 decimals of accuracy
[08:11:50][D][sensor:099]: 'Fridge LYWSD03MMC Battery Level': Sending state 71.00000 % with 0 decimals of accuracy
[08:11:50][D][sensor:099]: 'Fridge LYWSD03MMC Battery Voltage': Sending state 2.84600 V with 3 decimals of accuracy
[08:11:51][I][wifi:457]: WiFi Connected!
[08:11:51][C][wifi:303]: SSID: 'Sprinkles'
[08:11:51][C][wifi:304]: IP Address: 192.168.2.177
[08:11:51][C][wifi:306]: BSSID: D4:68:4D:XX:XX:XX
[08:11:51][C][wifi:307]: Hostname: 'ble-test'
[08:11:51][C][wifi:311]: Signal strength: -36 dB ▂▄▆█
[08:11:51][C][wifi:315]: Channel: 3
[08:11:51][C][wifi:316]: Subnet: 255.255.255.0
[08:11:51][C][wifi:317]: Gateway: 192.168.2.1
[08:11:51][C][wifi:318]: DNS1: 192.168.2.1
[08:11:51][C][wifi:319]: DNS2: 0.0.0.0
[08:11:51][D][wifi:466]: Disabling AP...
[08:11:51][C][web_server:073]: Setting up web server...
[08:11:51][C][ota:029]: Over-The-Air Updates:
[08:11:51][C][ota:030]: Address: ble-test.local:3232
[08:11:51][C][ota:032]: Using Password.
[08:11:51][C][api:022]: Setting up Home Assistant API server...
[08:11:51][E][AsyncTCP.cpp:1296] begin(): _pcb == NULL
[08:11:51][I][app:059]: setup() finished successfully!
[08:11:51][D][sensor:099]: 'ble-test WiFi Signal': Sending state -36.00000 dBm with 0 decimals of accuracy
[08:11:51]abort() was called at PC 0x401d36c3 on core 1
[08:11:51]
[08:11:51]Backtrace: 0x40092630:0x3ffce680 0x40092861:0x3ffce6a0 0x401d36c3:0x3ffce6c0 0x401d370a:0x3ffce6e0 0x401d3025:0x3ffce700 0x401d30fc:0x3ffce720 0x401d2e71:0x3ffce740 0x400da011:0x3ffce760 0x400da05d:0x3ffce790 0x400da071:0x3ffce7b0 0x400da093:0x3ffce7d0 0x400d9eb9:0x3ffce7f0 0x400d9ee1:0x3ffce810 0x400da821:0x3ffce830 0x400da879:0x3ffce860 0x400dfb7b:0x3ffce890 0x400dfbc7:0x3ffce8d0 0x401f01c1:0x3ffce910 0x400de6bd:0x3ffce930 0x400de749:0x3ffce960 0x400de7ad:0x3ffce9c0 0x400e4271:0x3ffce9f0 0x400e4281:0x3ffcea10 0x401f00d9:0x3ffcea30 0x40081152:0x3ffcea50 0x400e43bd:0x3ffceaa0 0x400e6bfe:0x3ffcead0 0x400f4f15:0x3ffceaf0 0x4008ed79:0x3ffceb10
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40092630: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707
WARNING Decoded 0x40092861: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:707
WARNING Decoded 0x401d36c3: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
WARNING Decoded 0x401d370a: std::terminate() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
WARNING Decoded 0x401d3025: __cxa_allocate_exception at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_alloc.cc:313
WARNING Decoded 0x401d30fc: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_op.cc:54
WARNING Decoded 0x401d2e71: operator new[](unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_opv.cc:32
WARNING Decoded 0x400da011: esphome::json::VectorJsonBuffer::reserve(unsigned int) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400da05d: esphome::json::VectorJsonBuffer::resize(unsigned int) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400da071: esphome::json::VectorJsonBuffer::do_alloc(unsigned int) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400da093: esphome::json::VectorJsonBuffer::alloc(unsigned int) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400d9eb9: ArduinoJson::Internals::JsonBufferAllocated::operator new(unsigned int, ArduinoJson::JsonBuffer*) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400d9ee1: ArduinoJson::JsonBuffer::createObject() at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400da821: esphome::json::build_json(std::function<void (ArduinoJson::JsonObject&)> const&, unsigned int*) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400da879: esphome::json::build_json[abi:cxx11](std::function<void (ArduinoJson::JsonObject&)> const&) at /home/lanrat/code/esphome/test/ble-test/.piolibdeps/ble-test/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400dfb7b: esphome::web_server::WebServer::sensor_json[abi:cxx11](esphome::sensor::Sensor*, float) at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/web_server/web_server.cpp:68
WARNING Decoded 0x400dfbc7: esphome::web_server::WebServer::on_sensor_update(esphome::sensor::Sensor*, float) at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/web_server/web_server.cpp:68
WARNING Decoded 0x401f01c1: std::_Function_handler<void (float), esphome::Controller::setup_controller()::{lambda(float)#2}>::_M_invoke(std::_Any_data const&, float&&) at /home/lanrat/code/esphome/test/ble-test/src/esphome/core/controller.cpp:29
(inlined by) _M_invoke at /home/lanrat/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/functional:1871
WARNING Decoded 0x400de6bd: std::function<void (float)>::operator()(float) const at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/sensor/sensor.cpp:92
WARNING Decoded 0x400de749: esphome::CallbackManager<void (float)>::call(float) at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/sensor/sensor.cpp:92
(inlined by) esphome::sensor::Sensor::internal_send_state_to_frontend(float) at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/sensor/sensor.cpp:100
WARNING Decoded 0x400de7ad: esphome::sensor::Sensor::publish_state(float) at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/sensor/sensor.cpp:92
WARNING Decoded 0x400e4271: esphome::wifi_signal::WiFiSignalSensor::update() at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/wifi_signal/wifi_signal_sensor.h:13
WARNING Decoded 0x400e4281: non-virtual thunk to esphome::wifi_signal::WiFiSignalSensor::update()
WARNING Decoded 0x401f00d9: std::_Function_handler<void (), esphome::PollingComponent::call_setup()::{lambda()#1}>::_M_invoke(std::_Any_data const&) at /home/lanrat/code/esphome/test/ble-test/src/esphome/core/component.cpp:163
(inlined by) _M_invoke at /home/lanrat/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/functional:1871
WARNING Decoded 0x40081152: std::function<void ()>::operator()() const at /home/lanrat/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_vector.h:932
(inlined by) esphome::Scheduler::call() at /home/lanrat/code/esphome/test/ble-test/src/esphome/core/scheduler.cpp:158
WARNING Decoded 0x400e43bd: esphome::Application::loop() at /home/lanrat/code/esphome/test/ble-test/src/esphome/core/application.cpp:70
WARNING Decoded 0x400e6bfe: loop() at /home/lanrat/code/esphome/test/ble-test/src/esphome/components/light/light_output.h:18
WARNING Decoded 0x400f4f15: loopTask(void*) at /home/lanrat/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:19
WARNING Decoded 0x4008ed79: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
[08:11:52]
[08:11:52]Rebooting...
[08:11:52]ets Jul 29 2019 12:21:46
```
**Additional information and things you've tried:**
I've tried multiple different ESP32 boards and all seem to have the same behavior. I've also tried adding/removing different components and the only constant to reproduce this issue seems to be `esp32_ble_tracker`.
These settings also look unconventional too. Is there a reason you’re using them? Some people misunderstand how they work and the defaults should be fine for typical use cases.
I don’t use Bluetooth proxy so not sure about that.
1 Like
miky_italy
(Michele Canteri)
April 28, 2023, 9:11pm
3
I think the solution would be to move from the arduino framework to the esp-idf as it is suggested in the man page of Bluetooth tracker, but I actually don’t know how to convert my Yaml file for the other framework.
The settings are very similar to those suggested in the documentation, so nothing special. I’ve tried to comment the esp32_ble_tracker part but leaving the bluetooth_proxy enable again the tracker, it is a requirement.
I’ll make some test disabling other services, but if anyone knows how to convert my yaml file for the esp-idf framework, I would really appreciate.
Best, M.
miky_italy
(Michele Canteri)
May 2, 2023, 4:50pm
5
The documentation is missing, or I am looking in the wrong place, the part for high-level programming, like in yaml file, as I use and posted in my previous post. I translated a part of my yaml file using ChatGPT but I still miss some parts that seem to be written in other ways than the Arduino framework.
Not sure I exactly get what you mean.
But if you want to change framework type from Arduino to esp-idf, the only thing you typically need to do is change this bit, like what I linked to above. ESPHome handles the rest for you.
miky_italy:
framework:
type: arduino
framework:
type: esp-idf
miky_italy
(Michele Canteri)
May 3, 2023, 2:07pm
7
I started from there but errors came up because the two framework doesn’t support the same elements and syntax. Anyway, now I reduced to the minimum my configuration to try to use the other framework but in the end, it doesn’t work, it fails to compile with an error that is known and there is a bug open (ESP32-IDF framework fails to compile on ARMv7 · Issue #3076 · esphome/issues · GitHub ), so now I don’t know what to do.
Following my actual configuration that fails:
esphome:
name: esp-two
esp32:
variant: ESP32
board: esp32dev
framework:
type: esp-idf
#type: arduino
# Enable logging VERY_VERBOSE
logger:
#level: VERBOSE
# Enable Home Assistant API
api:
encryption:
key: "here is my key"
ota:
password: "here is my passwd"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: !secret hotspot2_ssid
password: !secret hotspot_password
I think it is the minimum configuration but maybe it isn’t the configuration that is the problem since there is that bug open. I am on a Raspberry Pi 3b+ and with the framework Arduino the compilation and installation work well. Any suggestions are welcome
miky_italy
(Michele Canteri)
May 3, 2023, 3:18pm
8
Now I’m trying with the specific version of the libraries, as suggested in the bug report:
esphome:
name: esp-two
platformio_options:
platform_packages:
- framework-espidf @ 3.40300.0
esp32:
board: esp32dev
framework:
type: esp-idf
#type: arduino
platform_version: 3.4.0
It takes time, will see if it resolves the problem.
miky_italy
(Michele Canteri)
May 4, 2023, 8:26am
9
No, it doesn’t compile. I’ve tried to change the version of Esphome too (dev and beta) but nothing has changed. It is not possible to use the esp-idf framework, at least with my Rpi (3b+).
Anyone figure this out? I have a couple Expriessif devices that seem to keep rebooting every few minutes when on my IoT VLAN with MDNS. once I create a separate isolated vlan they are stable.