Open lanrat opened 3 years ago
esp32_ble_tracker source esp32_ble_tracker issues esp32_ble_tracker recent changes (message by IssueLinks)
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.
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.
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.
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 !
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.
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.
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.
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.
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.
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.
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.
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.
power_save_mode: none is nog compatible with esp_ble_tracker....
power_save_mode: none is nog compatible with esp_ble_tracker....
Yeah, it was compatible on 1.18 but it was removed on 1.19, like mentioned in the issue I’ve linked
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 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.
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.
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.
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.
Also with esphome version 2022.4.0 the problem is not solved. When ESP32-BLE-TRACKER: is added, the esp32 stops working.
a miracle? I've been running a copy for a few hours.. with the xiaomi-flower.. to be continued
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.
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...
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
I ended up using openmqttgateway and it works great https://docs.openmqttgateway.com/
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!
Have the same issue as described here. Anybody found a workaround?
Update to HA 2022.5.0 and ESPHome version: 2022.4.0 does not fix the problem.
Have the same issue as described here. Anybody found a workaround?
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.
After the update to ESPHome version: 2022.5.0 I can no longer reproduce the problems. HHCCJCY01 MiFlora works as before.
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.
yes, here it works!
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.
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:
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?
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:
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.
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
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
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.
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
withweb
andfastled_clockless
, however it does not seem to be specific to any component other thanesp32_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:
Logs (if applicable):
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
.