-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Airthings-ble still unable to read after 2024.5.1 update #116770
Comments
Hey there @vincegio, @LaStrada, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) airthings_ble documentation |
@jaydeethree: Are you seeing any issues after updating to 2024.5.1? |
I haven't updated to 2024.5.1 yet. I should have time to update and test this in the next few days. |
|
After the update, I haven't had any instances of values becoming "unknown" or breaks in the data on the data graph in the last ~22 hours. Monitoring with DEBUG enabled continues HA Yellow with CM4 w/ on-board BT Note: a typical connection occurs every five minutes and takes 3.5 to 6.5 seconds, 95% about 4.5 seconds I've seen one instance where retries recovered initial connection failure I've seen five instances where retries recovered from unexpected disconnect I've seen three instances of the following with no apparent impact on connectivity |
I recommend a user-settable number of retries as users are effectively doing the same thing with automation hacks. This will allow users with a lot of interference to try to compensate. A user-settable timeout may also be useful The current default settings worked for me but other situations may require more adjustability |
@bdraco Have you followed the steps for reducing interference https://www.home-assistant.io/integrations/bluetooth/#simple-actions-that-should-improve-most-bluetooth-setups-and-common-root-causes-of-interference? - Yes Do you have your Bluetooth adapter on an extension cable or it it plugged directly into your device? - Integrated on Raspberry Pi 4 How far away is the airthings device away from the Bluetooth adapter? - Approx 20 feet I caught 2 gaps at 7:56 AM and 1:30 PM (full log attached):
|
I agree, user configurable values would be great. Current settings work most of the time, but my hunch is one extra retry would make it work 99.99% of the time. |
Generally we don't add configuration options to change timeouts or retries as that is something the integration would handle. That type of change would be rejected in code review with a request to fix it in the integration instead. Increasing to 3 retries is probably a reasonable path forward. If we do that we should only do one retry on startup and than do the extra retries only after successful setup so we don't end up delaying startup. |
While the drivers have improved over time, the internal RPIi adapters in these devices are not so great so its expected that you will get connection drops and since they are close to the USB ports that generate interference, the board design doesn't help. The problem will likely completely go away if you disable the internal adapter and replace with an ESPHome Bluetooth proxy or an external adapter on the high performance list. |
Since the scan interval is 300 seconds, we can even go to 5 attempts before declaring failure since the maximum connection time is 60s |
Thanks for increasing number of retry attempts! Ideally this issue is fixed for everyone with an RPi, but as a last resort I do have an esp32 set up as Bluetooth proxy waiting to be plugged in. Thank you again for supporting us with sub-optimal setups! |
Wouldn't 5 retries in 300 seconds be too much since next scan would immediately happen? Max 4 retries? |
It would mean it would have to timeout connecting every time which isn't the problem here. If we start hitting that timeout, the device is likely truly unreachable. The data exchange timeout is much lower so it shouldn't be a problem Also it can't miss the refresh as it always schedules the next one once the current one finishes
The risk of setting it too high would mean it would take a long time to notice the device is unavailable |
After 48 hours I've not had any data dropouts. For me, it looks like the retries have fixed the problem. BTW, I have other BT devices even farther away (25 ft vs 5 ft for Airthings) that never experience data dropouts which casts some doubt on the USB interference theory. If you can't measure it, it's just a WAG (Wild Ass Guess). It may be that the Airthings BT chip or device interface code is the problem. An engineer with the appropriate BT expertise and equipment can monitor/measure and get to the root cause. But if that never happens hopefully the retry fix holds up over the long term. Time will tell and I'll be back if the problem reoccurs. |
I don't know which other Bluetooth devices you are referring to, but that may be because Airthings devices need a GATT connection to update. Many other Bluetooth sensors use advertisements which do not have the overhead of two-way connection establishment, which also means they usually have a much longer range. Bluetooth advertisements are generally limited to 31 bytes of data. Hence, some vendors use GATT instead or some combination of advertisements and GATT connections to update data that changes infrequently, like battery %. Most vendors that use GATT connections have a stated range of 20ft. I'm not sure what Airthings specifies, though. |
I haven't had any drop-outs since updating to 2024.5.1 and switching back to the built-in airthings_ble integration, so it seems like the recent changes fixed everything for me :) Thanks so much @bdraco ! |
I'm not sure if this adds any info to the ongoing issues, but last night I got annoyed and just decided to start over. Backed up the database, deleted both Airthings devices, deleted both Airthings apps on my phone, readded the devices in rhe Airthings BLE integration, and renamed the entities so they pointed back to the original entity names. I have no idea if it was deleting the apps that helped or if it was deleting the integrations, but since then I haven't had any dropouts that weren't fixed by reloading the AT BLE integration. I'm still on 2024.5.1 and was only getting maybe one or two reading a day from one of my devices. I had an automation that would reload airthings BLE after ten minutes of unavailable then after another ten minutes would reload the Bluetooth integration then the AT BLE. im wondering if the apps were somehow taking priority over the HA connection or if it was something else entirely. But I'm going to wait to update to 5.2 to see if I start having dropouts after a day or two. |
@dxmnkd316 - I have both Airthings apps installed on my phone (iphone), so I don't think that has any impact. Thank you again @bdraco for all your help! |
So I might just have a bad connection in the original location. Which is odd, because there are other Bluetooth devices on the far side of that room that connect fine. Anyways, I started to see dropouts again later in the evening. So I moved the device two feet from the bedroom to the hallway, towards the raspberry pi. I haven't had a drop since. Perhaps more testing on my part is due. But unsurprisingly it seems like bdraco and lastrada were onto something about the flakey connection and the timeouts. I might have found the edge of the range. |
@dxmnkd316 Upgrade to 2024.5.2 and see if your issue is resolved. The extra retries seem to have resolved my issue without moving either RPi or Airthings Wave+ (approx 20 feet apart). I had no drop outs in last ~19 hours since I've upgraded to 2024.5.2 |
Since 2024.5.1 I've had no dropouts. I'm on 2024.5.2 since release |
The problem
2024.5.1 update implemented retries for pulling data from airthings-ble sensor. This has provided major improvement for the connection, however I am still seeing an occasional disconnect.
From log:
2024-05-03 22:56:22.462 ERROR (MainThread) [homeassistant.components.airthings_ble] Error fetching airthings_ble data: Unable to fetch data: Disconnected from FC:A8:9B:F2:CA:CD
2024-05-03 23:43:08.505 ERROR (MainThread) [homeassistant.components.airthings_ble] Error fetching airthings_ble data: Unable to fetch data: Disconnected from FC:A8:9B:F2:CA:CD
I just now, I have enabled debug for bluetooth and airthings-ble hopefully I can catch additional details.
What version of Home Assistant Core has the issue?
2024.5.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
airthings-ble
Link to integration documentation on our website
https://www.home-assistant.io/integrations/airthings_ble/
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: