esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

Device is unstable when esp32_ble_tracker is enabled with some other components. #2112

Open lanrat opened 3 years ago

lanrat commented 3 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

pip

ESP (ESP32/ESP8266, Board/Sonoff):

ESP32

ESPHome version (latest production, beta, dev branch)

1.18.0

Affected component:

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:

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):

[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.

probot-esphome[bot] commented 3 years ago

esp32_ble_tracker source esp32_ble_tracker issues esp32_ble_tracker recent changes (message by IssueLinks)

Fusseldieb commented 3 years ago

Afaik the ESPHome BLE is in fact unstable, it is reported on multiple threads across the Home Assistant Forum.

People were suggesting to change the interval on which the ESP scans the BLE (if I record it right). This didn't solve the issue completely, but it became better apparently.

I think the Bluetooth and Wifi stack clash onto each other and interfere with itself or something like that. Just a guess tho. Or maybe a memory issue.

etamtlosz commented 3 years ago

With 1.19 the issue persists. I don't know if it is just for me, but I have a feeling that before 1.18 things were better.

lanrat commented 3 years ago

With v1.18.0 if I combined BLE with almost any other sensor he ESP would become unstable, so I've needed to dedicate a single ESP for all my BLE sensors.

with v1.19.0 enabling BLE with nothing else causes the ESP to boot loop constantly. I've had to move my BLE ESP back to v1.18.0 so that it works.

Ideally, I'd like BLE to work on all my ESP32 nodes so that I can have the ESP closest to the sensor record the data, for now with just a single node I miss some of the BLE broadcasts.

MrAlucardDante commented 3 years ago

I have 2 ESP32 that were running fine on 1.18, I just updated to 1.19.2 and now I get the [Errno 111] Connection refused, even though I can see both connected to my wifi.

If I remove esp32_ble_tracker and all the ble sensors, the ESP32 runs fine.

Since I'm using those ESPs to connect to my bluetooth temperature sensors, they are now useless.

Maybe this is due to the fact that esp32_ble_server is now in a separate package.

Edit : I downgraded my python install of esphome to 1.18.0, recompiled and reuploaded the firmware on both ESPs and everything is back to normal, don't update to 1.19.x !

lanrat commented 3 years ago

I tried upgrading to 1.19.4, and found the BLE stack to be more stable than 1.18.

With 1.19.4 the ESP32 crashes around every 16 hours instead of boot looping in 1.19.0, but its still nowhere near as stable as 1.18.

oetelaar24 commented 2 years ago

Hi, i'm experiencing much the same trying to combine the BLE tracker and camera on a ESP32_CAM. I've found that there is a feature request for improving the memory usage of BLE, by switching to nimBLE. https://github.com/esphome/feature-requests/issues/810 However it seems like this is not really making much progress at the moment.

formatBCE commented 2 years ago

Got EspHome Home Assistant add-on 2021.8.2. BLE presence nodes, dedicated only for checking 4 BLE tags, are pretty unstable. They recover fast, but become unavailable for 1-3 seconds each minute or so. I wonder if this is the right place to track possible fix, and if the fix is actually available. I believe, that BT and WiFi are interferencing on ESP32, and this might cause instability. Also I found, that nodes with enough power (e.g. connected to 2A charger) are more stable (although I still see that gaps there), than node, connected to 500 mA USB.

formatBCE commented 2 years ago

With custom code, that does BLE scanning and sends updates to MQTT, it works flawlessly. Looks like i will have to stick with that solution instead of ESPHome, although it's not so convenient. I transferred scanning logic with same scanning interval and window to custom ESPHome sensor, but it is still unusable - ESP32 becomes unavailable often. So i guess, this is something with how ESPHome is using WiFi - i suppose, it needs consistent connection to Home Assistant API, and BLE does interrupt it.

chatziko commented 2 years ago

I'm experiencing the same issue. I tried to add esp32_ble_tracker to a board running this project that uses lots of different components, and I was getting restarts.

Something I noticed that might be helpful: when I was monitoring the logs over wifi, the restarts were easily reproducable. Triggering several of the board's components (eg the IR receiver) would lead to a restart after just a few seconds. But without monitoring the logs, the board was quite stable. Maybe the wifi activity produced by the logs is to blame.

Removing esp32_ble_tracker the board is very stable, no matter how many logs are produced.

aderusha commented 2 years ago

Confirming similar issues here. Adding esp32_ble_tracker to an otherwise-working configuration results in regular crashes. The only configuration where I can get esp32_ble_tracker to work reliably is to have it running on its own dedicated device.

RichardvanGestel commented 2 years ago

Confirming similar issues here, esp32_ble_tracker makes the esp32 unstable. I am using xiaomi_hhccjcy01. It worked fine until the winter. Somewhere in the winter it went wrong. Here the esp32 in HA will be red and unreachable. This is only due to esp32_ble track. I have tried several esp32 boards.

MrAlucardDante commented 2 years ago

Confirming similar issues here, esp32_ble_tracker makes the esp32 unstable. I am using xiaomi_hhccjcy01. It worked fine until the winter. Somewhere in the winter it went wrong. Here the esp32 in HA will be red and unreachable. This is only due to esp32_ble track. I have tried several esp32 boards.

Do you have power_save_mode: none set in your config by any chance ? After removing it, my esp32s have been very reliable.

https://github.com/esphome/issues/issues/2141

RichardvanGestel commented 2 years ago

power_save_mode: none is nog compatible with esp_ble_tracker.... Knipsel2

MrAlucardDante commented 2 years ago

power_save_mode: none is nog compatible with esp_ble_tracker.... Knipsel2

Yeah, it was compatible on 1.18 but it was removed on 1.19, like mentioned in the issue I’ve linked

mclever commented 2 years ago

i cant figure out how to get my esp32 to work with ble tracker esphome either. whenever its enabled the wifi just keeps cutting out, lasting for a few pings and then off for a few. read one article and they pointed to cheap hardware. aren't these all cheap hardware!!! going to try a different board and see if i get better luck. I use the same boards for ble using aduino https://peyanski.com/home-assistant-switchbot-mqtt-esp32-integration/ and they have worked great.

formatBCE commented 2 years ago

i cant figure out how to get my esp32 to work with ble tracker esphome either. whenever its enabled the wifi just keeps cutting out, lasting for a few pings and then off for a few. read one article and they pointed to cheap hardware. aren't these all cheap hardware!!! going to try a different board and see if i get better luck. I use the same boards for ble using aduino https://peyanski.com/home-assistant-switchbot-mqtt-esp32-integration/ and they have worked great.

I used 3 different chips. Same result. And all of them work for same purpose (BLE tracking + mqtt) successfully with custom-built sketch.

efaden commented 2 years ago

Can you post one of your sketches? I'm having the same issue as the above. Without ble everything works perfectly, once enabled the WiFi becomes totally unstable. Tried with both Arduino and IDF frameworks.

formatBCE commented 2 years ago

Can you post one of your sketches? I'm having the same issue as the above. Without ble everything works perfectly, once enabled the WiFi becomes totally unstable. Tried with both Arduino and IDF frameworks.

Unfortunately, that file was lost a week ago, when my hard drive suddenly burned to dead. I didn't consider it very important, so I don't think there's backup for it. But I will check.

formatBCE commented 2 years ago

Nah, I don't have the sketch, unfortunately. Will have to re-create it. Shouldn't be too hard, as on top of it I made BLE gateway for Chinese Airbnk smart locks - it's far more complex stuff.

RichardvanGestel commented 2 years ago

Also with esphome version 2022.4.0 the problem is not solved. When ESP32-BLE-TRACKER: is added, the esp32 stops working.

RichardvanGestel commented 2 years ago

a miracle? I've been running a copy for a few hours.. with the xiaomi-flower.. to be continued

etamtlosz commented 2 years ago

I have a feeling that it depends of the device (not ESP32) and type of data used. For example I was trying to log my OralB toothbrush usage, and every time I was brushing my teeth, the esp32 just crashed/rebooted/became unresponsive.

RichardvanGestel commented 2 years ago

The device worked fine for 15 hours. Then I turned the device off and on. The data, temperature, humidity etc. come back in... But the device is offline in HA... Error message: "WARNING Can't connect to ESPHome API for esp32-xiaomi.local: Error resolving IP address: [Errno - 2] Name or service not known" I can no longer access the device via WiFi. If I reinstall using ESPHome-Flasher it all works again...

RichardvanGestel commented 2 years ago

No, unfortunately... I can't get it stable anymore... I'm going on holiday for a few days now... are you looking for a solution in the meantime? The device keeps losing connection to HA

mclever commented 2 years ago

I ended up using openmqttgateway and it works great https://docs.openmqttgateway.com/

RichardvanGestel commented 2 years ago

I ended up using openmqttgateway and it works great https://docs.openmqttgateway.com/

Well, that's a great tip. It works perfectly! Thank you! Thank you! Thank you!

mgineer85 commented 2 years ago

Have the same issue as described here. Anybody found a workaround?

RichardvanGestel commented 2 years ago

Update to HA 2022.5.0 and ESPHome version: 2022.4.0 does not fix the problem.

RichardvanGestel commented 2 years ago

Have the same issue as described here. Anybody found a workaround?

https://docs.openmqttgateway.com/

formatBCE commented 2 years ago

Right, OpenMQTTGateway does work for me too. However, for now i still use my own firmware for it - too much to change with new firmware.

RichardvanGestel commented 2 years ago

After the update to ESPHome version: 2022.5.0 I can no longer reproduce the problems. HHCCJCY01 MiFlora works as before.

formatBCE commented 2 years ago

After the update to ESPHome version: 2022.5.0 I can no longer reproduce the problems. HHCCJCY01 MiFlora works as before.

You mean, BLE tracker works fine now? Would be really great - I'd get rid of self-written software to have homogeneous environment.

RichardvanGestel commented 2 years ago

yes, here it works!

TheHomieFox commented 2 years ago

Sorry to say it does not change anything to me. MiFlora devices work well (as before) but BLE presence turns to Unavailable and comes back randomly. Pinging the host results in lost packets quite frequently as well, so no changes at all with 2022.5.0.

formatBCE commented 2 years ago

For me, it is much more stable. I used some D1 mini and NSPanel.

However, won't be using it still - it's really unreliable as device tracker. Not only it's binary sensor, which is really hard to convert to device_tracker in HA - moreover, it's too slow.

From off to on:

rohrsh commented 1 year ago

I have similar times: maybe 5 minutes for either on to off or for off to on. Is there any sort of SLA or timeout for this?

formatBCE commented 1 year ago

I created my own integration for BLE presence. Can be set up as custom ESPHome component, or via custom firmware flashing. Works with rooms, creates proper device_tracker entities, and requires beacon MAC or UUID.

Check out:

trunneml commented 1 year ago

Having the same issue here. I have the feeling that it's an out of memory problem. When I add a lot of string based components on my NSPanel it even won't boot. If i reduce components the device is getting more stable. When I add components with a lot of string depending lambdas it dies when HA connection begins.

Also OTA crashes all the time, when ble_tracker is enabled. When I restart in safe mode OTA works.

pavelw commented 1 year ago

Esphome Version: 2023.4.3 using 2 stock xiaomi_lywsd03mmc sensors, wifi enabled

it crashed regularly after around 500 seconds.

WORKAROUND for me was to disable the logger:

logger:
  level: NONE
andrewjswan commented 11 months ago

Maybe it's really worth switching to a new BLE stack and solving all the current BT problems? Do not keep a permanent connection to the device (then we can bypass the limitation of 3 connections), but connect "on demand", well, or depending on the settings. Reduce memory consumption, improve stability? There are more and more devices, and many BLU devices require an active connection, but the current stack is more of a lottery than a stable operation. Here are some good reviews about NimBLE and apparently there is a version for both Arduino and ESP-IDF. https://github.com/esphome/feature-requests/issues/810

evoncken commented 1 week ago

The issue still persists with ESPhome 2024.6.1 - it appears to have actually regressed from 2024.5.x.

I have multiple Panasonic airco’s with an esp32 control board. Today, after updating these devices to ESPhome 2024.6.1, they became unresponsive. The only change in the sketch was the new “platform: esphome” option for “ota:”. The devices all had an uptime of approx. 14 days before the update.

Cleaned all build files, installed and the device went offline almost immediately. Had to use a usb cable to reflash (without esp32_ble_tracker). The issue is 90-100% reproducible. Sometimes it takes longer before hanging.

It really seems like something changed between ESPhome 2024.5.x and 2024.6.x that is causing severe instability.