-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESPHome with bluetooth proxy and iBeacon integration #79781
Comments
Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration ( ibeacon documentation |
Hi, Having the same issue here with esphome and home assistant 2022.10.3. ble tracker is not switching reliable between nodes and aber a few minutes the status of the beacon (sent by companion app) will be recognized as unavailable by the ibeacon integration. Reloading the integration will solve the issue for the next minutes, afterwards it turns to unavailable again. The distance to Bluetooth proxy looks like this: If I can support with any kind of log, please let me know. Br, chris |
Might be fixed by #79669 but we won't know until 2022.11.x |
I'm not sure, judging from the description. The sensor from ibeacon esphome: at the same time sensor from ibeacon integration with bluetooth proxy from esp32: Same tag (HA application), same device (esp32 with esphome) but totally different data. I'm not at all sure it's about timeouts and packets from the tag. |
Tested very roughly with the dev branch 2022.11 and it seems to be much better. This is just the first impression. I will test it deeper in the next few days. Thanks for the fixes. |
But with the other beacon, the problem is just the opposite, it is always visible as home. Exactly like here - #79833 |
I also upgraded to 2022.11 and it seems to be much better as already mentioned. Nevertheless I have still "unavailable" slots even if the phone with the home assistant app (which is transmitting the ibeacon) is right next to the esp32. Is there something I can provide to debug the issue? perhaps in my case it is an issue of the App --> esp32 --> ibeacon combination? Any suggestions? |
@avbor what kind of esp32 are you using? In my case I could also imagine that it could be an issue of the board or the esphome side as well. I do not see Bluetooth devices forwarded in home assistant. Furthermore the esp32 seems to crash after some minutes. Caused by Bluetooth traffic? |
@chrisghu i have a lot of random board from aliexpress =) some work worse, some work better. |
I'm having the same experience. However, it is weird when I try to figure out the issue. The bluetooth proxy doesn't track my phone consistently, regardless of beacon app. Tried both HA integrated transmitter and 3party apps. However, they do track my radbeacons without a single drop. So it is the phone then? Nope, I installed espresense on identical hardware and now my phone is tracked without a single drop as well. So it is only the combination of btproxy and phone that doesn't work. Could it be the changing addresses that is the issue? |
This is my experience too. While using a Tile as iBeacon, it works as it should. While using android (Samsung Note 10) with HA app or third party app, it is intermittent like in the screenshot. I have checked that I did not have power saving, or any other restrictions but it still isn't consistant. |
There is a stability issue that isn't fixed in the ESP32s yet There is a branch here if you would like to try the potential fix |
@bdraco Thanks for the suggestion. I have tried the branch you mentioned in the post above but the signal is still interrupted: It seems to be better than before. Thanks for working on that topic. Can I support with some measures? |
With a Samsung Galaxy Tab S6 Lite at 10cm from the ESP32. The environment is quite noisy (Wifi, Zigbee...) but according to this post, I'm not alone. I've tried a bunch of configuration ( After filtering on my UUID, I clearly see that the ESP32 is not to blame (even though if sometimes I have no traces for 10s while the Companion application is supposed to send the frames every second). For reference, here's my ESP32 config: substitutions:
name: esp32-2
comment: "Test"
# Core information that ESPHome needs to create firmwares
esphome:
name: ${name}
name_add_mac_suffix: true
comment: ${comment}
project:
name: esphome.${name}
version: "1.0"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
# logs:
# esp32_ble_tracker: VERY_VERBOSE
# Enable Home Assistant API
api:
# encryption:
# key: !secret api_key
# Upload firmwares binaries without having to use a USB
ota:
safe_mode: true
password: !secret ota_password
# Wi-Fi connection configuration
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret domain
# Configuring Wi-Fi via USB
improv_serial:
# Buttons to add
button:
- platform: safe_mode
name: "Safe Mode Boot"
- platform: restart
name: "Restart"
# Activate webserver
web_server:
port: 80
auth:
username: !secret web_server_user
password: !secret web_server_password
dashboard_import:
package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
# Bluetooth configuration
bluetooth_proxy:
active: true
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
on_ble_advertise:
then:
- lambda: |-
if(x.get_ibeacon().has_value()) {
auto ibeacon = x.get_ibeacon().value();
if (strcmp(ibeacon.get_uuid().to_string().c_str(), "<UUID>") == 0) {
ESP_LOGD("ble_adv", "PIXEL3 found: rssi %d", x.get_rssi());
}
} I've been able though to make it work using the ESP32 Bluetooth Low Energy Tracker Hub but it involves additional configuration and I'd like to avoid having a device sensor per ESP. I've also tried to use the To be accurate, I don't have any And for reference, some similar issues: |
Can you explain what you mean by that? Are you seeing the device come over the aioesphomeapi connection every second?
|
If you turn on debug logs for aioesphomeapi you can see all the Bluetooth packets being forwarded. I'll need to get a snapshot of the actual packets over a 30m period for the ibeacon device to understand what is going wrong. |
@bdraco : here it is. Probably around an hour of log. Or do you need a pcap? |
Just a guess but it looks like it goes unavailable a bit after the source picks a new random address. It might be seeing the old random address disappear from the stack and marking the beacon unavailable.... just a guess though at this point |
Maybe it's taking so long to rotate the Mac and it never getting fresh data because it never changes and the unavailable time is the time between when the Mac is changed to a new one and the data is last called back because it hasn't changed and the filter won't send it again because it's static I think we could fix that by having the random unavailable function refetch the latest time for the address from the history |
@bdraco good news! Let me know if you need anything else |
If the problem is the MAC address, why I do have a working configuration using ESP32 Bluetooth Low Energy Tracker Hub? ...
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
binary_sensor:
- platform: ble_presence
ibeacon_uuid: !secret phone_ibeacon
name: "Phone iBeacon"
- platform: ble_presence
ibeacon_uuid: !secret tab_ibeacon
name: "Tablette iBeacon" using these parameters I do have a better accuracy: |
There is no filtering layer with the ESP32. You get the full firehose of data to the component which works fine with a low interval and only two or three components. The Bluetooth integration only calls back data when it changes (we can't send every integration the firehose or the system would melt down) and ibeacon data is static |
…ing unavailable Since we do not call back devices that do not change their advertising data we need to fetch the latest advertisment/service_info when considering if the beacon has going unavailable. fixes home-assistant#79781
…going unavailable (#82668) fixes home-assistant/core#79781
…going unavailable (#82668) fixes home-assistant/core#79781
The problem
After upgrading to 2022.10, I tried to set up iBeacon integration along with ESP32 bluetooth proxy and ran into a problem.
If I enable iBeacon in the HA app on the phone, I only get single packets through ESP (after reboot ESP or turning signal transmission on and off in the phone).
In esphome console with esp32_ble_tracker enabled I also see only single packets from the phone, although they should come every second.
At the same time, via BT stick everything works as it should.
I can not understand where the problem might be, please help me to understand.
What version of Home Assistant Core has the issue?
2022.10.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
iBeacon, ESPHome
Link to integration documentation on our website
https://www.home-assistant.io/integrations/ibeacon/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: