Closed jcastro closed 1 year ago
+1
confirmed here as well. I wasn't using api at all before, and I decided to enable it yesterday and it kept crashing or reconnecting to wifi / mqtt every minute or so. It went ok when I disabled esp32_ble_tracker and all dependencies. I've just tried to enable api it on another esp32 => same behavior & same workaround I'll try with a test device later on, curious to know if it's really related to api
I disabled captive_portal:
part and now it still crashes but less
If I recall correctly, I also happened to encounter this issue 2 weeks ago, I was trying to have ota+mqtt+i2c(2 buses)+bme680_bsec+scd30+sps30+bh1750+esp32_ble_tracker+4ble_rssi+2xiaomi_lywsd02+xiaomi_lywsdcgq+xiaomi_lywsd03mmc on ONE esp32 (no api). I ended up splitting this on two devices because it was crashing as well. And I had to disable ble all together on the esp32 with bme/scd/sps/bh1750. I'll try to reproduce this tomorrow.
another symptom with a simpler config: it works ok but it crashes when doing ota (api not enabled)
for now I've been able to reproduce the crashes when defining xiaomi_lywsdcgq or xiaomi_lywsd03mmc sensors. But It doesn't crash with 4 ble_rssi sensors and 2 xiaomi_lywsd02 sensors.
Something is also very disturbing, as soon as esp32_ble_tracker is enabled then esphome does stop sending the mqtt homeassistant discovery, ex:
[15:50:34][V][mqtt.component:062]: 'esp32_03 safe_mode': Sending discovery...
[15:50:34][V][mqtt:406]: Publish(topic='homeassistant/switch/esp32_03/esp32_03_safe_mode/config' payload='{}' retain=1
)
Something is also very disturbing, as soon as esp32_ble_tracker is enabled then esphome does stop sending the mqtt homeassistant discovery, ex:
[15:50:34][V][mqtt.component:062]: 'esp32_03 safe_mode': Sending discovery... [15:50:34][V][mqtt:406]: Publish(topic='homeassistant/switch/esp32_03/esp32_03_safe_mode/config' payload='{}' retain=1 )
that's ok with 2022.2.5 but not with 2022.2.6 (only change: https://github.com/esphome/esphome/pull/3259) pretty sure last year I had BLE enabled on all my esp32 without any issue, for now when I need BLE I use a dedicated esp32.
working with 2021.9.3, crashing like this with 2021.10.0:
[14:40:13][V][mqtt.component:060]: 'Bang Bang Climate Controller': Sending discovery...
[14:40:13]abort() was called at PC 0x40200777 on core 1
[14:40:13]
[14:40:13]ELF file SHA256: 0000000000000000
[14:40:13]
[14:40:13]Backtrace: 0x40090658:0x3ffcd0f0 0x400908d5:0x3ffcd110 0x40200777:0x3ffcd130 0x402007be:0x3ffcd150 0x401ffe87:0x3ffcd170 0x402001be:0x3ffcd190 0x401fff25:0x3ffcd1b0 0x400e20a5:0x3ffcd1d0 0x400e20f2:0x3f
fcd200 0x400e2105:0x3ffcd220 0x400e2127:0x3ffcd240 0x400e5e76:0x3ffcd260 0x400e5eb9:0x3ffcd280 0x400e6115:0x3ffcd2a0 0x400e70d3:0x3ffcd500 0x400e74c5:0x3ffcd5c0 0x400e1fd3:0x3ffcd5e0 0x400e28ca:0x3ffcd600 0x400e4
169:0x3ffcd630 0x400e6c8b:0x3ffcd660 0x400e6d6f:0x3ffcd6b0 0x4020ae49:0x3ffcd6d0 0x400f2e35:0x3ffcd6f0 0x400f859e:0x3ffcd740 0x4010c28e:0x3ffce4f0 0x4009194a:0x3ffce510
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40090658: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
WARNING Decoded 0x400908d5: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
WARNING Decoded 0x40200777: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
WARNING Decoded 0x402007be: std::terminate() at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112
WARNING Decoded 0x401ffe87: __cxa_throw at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc:87
WARNING Decoded 0x402001be: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_op.cc:54
WARNING Decoded 0x401fff25: operator new[](unsigned int) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_opv.cc:32
WARNING Decoded 0x400e20a5: esphome::json::VectorJsonBuffer::reserve(unsigned int) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e20f2: esphome::json::VectorJsonBuffer::resize(unsigned int) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e2105: esphome::json::VectorJsonBuffer::do_alloc(unsigned int) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e2127: esphome::json::VectorJsonBuffer::alloc(unsigned int) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e5e76: char const* ArduinoJson::Internals::StdStringTraits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::duplicate<ArduinoJson::JsonBuffer>(std::__cxx11::
basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ArduinoJson::JsonBuffer*) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Deserialization/../Stri
ngTraits/StdString.hpp:28
WARNING Decoded 0x400e5eb9: bool ArduinoJson::Internals::ValueSaver<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void>::save<ArduinoJson::JsonVariant>(ArduinoJson::JsonB
uffer*, ArduinoJson::JsonVariant&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/
Data/ValueSaver.hpp:31
(inlined by) bool ArduinoJson::JsonObject::set_impl<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(char const*, std::__cxx11::basic_string<char, std::char_tr
aits<char>, std::allocator<char> > const&) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/JsonObject.hpp:298
(inlined by) bool ArduinoJson::JsonObject::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const>(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, s
td::allocator<char> > const&) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/JsonObject.hpp:114
WARNING Decoded 0x400e6115: ArduinoJson::Internals::EnableIf<!ArduinoJson::Internals::IsArray<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::value, ArduinoJson::Internals::Json
ObjectSubscript<char const*>&>::type ArduinoJson::Internals::JsonObjectSubscript<char const*>::operator=<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_strin
g<char, std::char_traits<char>, std::allocator<char> > const&) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/JsonObjectSubscript.hpp:41
(inlined by) esphome::mqtt::MQTTClimateComponent::send_discovery(ArduinoJson::JsonObject&, esphome::mqtt::SendDiscoveryConfig&) at /home/l2/esphome/esp32_05/src/esphome/components/mqtt/mqtt_climate.cpp:48
WARNING Decoded 0x400e70d3: esphome::mqtt::MQTTComponent::send_discovery_()::{lambda(ArduinoJson::JsonObject&)#1}::operator()(ArduinoJson::JsonObject&) const at /home/l2/esphome/esp32_05/src/esphome/components/mq
tt/mqtt_component.cpp:155
WARNING Decoded 0x400e74c5: std::_Function_handler<void (ArduinoJson::JsonObject&), esphome::mqtt::MQTTComponent::send_discovery_()::{lambda(ArduinoJson::JsonObject&)#1}>::_M_invoke(std::_Any_data const&, Arduino
Json::JsonObject&) at /home/l2/esphome/esp32_05/src/esphome/components/mqtt/mqtt_component.cpp:155
WARNING Decoded 0x400e1fd3: std::function<void (ArduinoJson::JsonObject&)>::operator()(ArduinoJson::JsonObject&) const at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson/Dese
rialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e28ca: esphome::json::build_json(std::function<void (ArduinoJson::JsonObject&)> const&, unsigned int*) at /home/l2/esphome/esp32_05/.piolibdeps/esp32_05/ArduinoJson-esphomelib/src/ArduinoJson
/Deserialization/JsonParserImpl.hpp:166
WARNING Decoded 0x400e4169: esphome::mqtt::MQTTClientComponent::publish_json(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (ArduinoJson::JsonObject&)>
const&, unsigned char, bool) at /home/l2/esphome/esp32_05/src/esphome/components/mqtt/mqtt_client.cpp:497
WARNING Decoded 0x400e6c8b: esphome::mqtt::MQTTComponent::send_discovery_() at /home/l2/esphome/esp32_05/src/esphome/components/mqtt/mqtt_component.cpp:155
WARNING Decoded 0x400e6d6f: esphome::mqtt::MQTTComponent::call_setup() at /home/l2/esphome/esp32_05/src/esphome/components/mqtt/mqtt_component.cpp:155
WARNING Decoded 0x4020ae49: esphome::Component::call() at /home/l2/esphome/esp32_05/src/esphome/core/component.cpp:88
WARNING Decoded 0x400f2e35: esphome::Application::setup() at /home/l2/esphome/esp32_05/src/esphome/core/application.cpp:38
WARNING Decoded 0x400f859e: setup() at /home/l2/esphome/esp32_05/src/esphome/core/gpio.h:62
WARNING Decoded 0x4010c28e: loopTask(void*) at /home/l2/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:18
WARNING Decoded 0x4009194a: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
FWIW, I have one esp32 that was crashing every 15min, on the dot, and my original esp32 seems to have been crashing every 4 ish hrs, often causing long periods of downtime.
The problem
The ESP32 module seems to be reseting from 5 to 15 minutes after booting
Which version of ESPHome has the issue?
2022.1.4 and also tried beta 2022.2.0b1
What type of installation are you using?
pip
Which version of Home Assistant has the issue?
2022.2.6
What platform are you using?
ESP32
Board
wemos d1 mini esp32
Component causing the issue
esp32_ble_tracker
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
Using code from https://github.com/dalehumby/ESPHome-Apple-Watch-detection