core icon indicating copy to clipboard operation
core copied to clipboard

Airthings BLE STILL dropping connection

Open slikone27 opened this issue 1 year ago • 8 comments

The problem

There seems to be issues opened here:

https://github.com/home-assistant/core/issues/100123

https://github.com/home-assistant/core/issues/109499

That were closed or pointed to other issues that have been closed or locked... but this is STILL an issue and is happening every 30 mins or so. There seems to be suggestions to roll back to an older Airthings BLE version that "fix" the issue. Can someone that can edit the integration fix it by implementing the changes?!?! and not just close the issue?

AirthingsBLE

What version of Home Assistant Core has the issue?

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

No response

Link to integration documentation on our website

No response

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

slikone27 avatar Aug 10 '24 20:08 slikone27

Feel free to open a pull request to fix it if you think it is easy..

elupus avatar Aug 10 '24 21:08 elupus

Hey there @vincegio, @lastrada, mind taking a look at this issue as it has been labeled with an integration (airthings_ble) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of airthings_ble can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign airthings_ble Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


airthings_ble documentation airthings_ble source (message by IssueLinks)

home-assistant[bot] avatar Aug 10 '24 21:08 home-assistant[bot]

Feel free to open a pull request to fix it if you think it is easy..

I don't think its easy at all and def didn't say that... I just said it looks like someone fixed it by copying the old code and rolling back to a previous version... so its a code change between the older version and the newest that broke it. so why not just roll back at least if the new version is an issue still... And then the issues keep getting closed w/ no fix. that's all i was saying. sorry wasn't trying to put anyone down.

slikone27 avatar Aug 11 '24 18:08 slikone27

any updates on this?

slikone27 avatar Aug 22 '24 02:08 slikone27

Bumping for info regarding this. Seeing dropouts of the Airthings integration every 5-7 minutes, running a ESP32 bluetooth proxy on ESPHome 2024.8.3. I'm only seeing these dropouts on the Airthings BLE integration.

Friend-Or-F0H avatar Sep 13 '24 20:09 Friend-Or-F0H

Seeing 12 Wave Plus devices drop out at once after working fine across a few Esp32 proxies is pretty frustrating. From a logging perspective, it just points out that the devices can no longer be found.

singlepane-io avatar Sep 30 '24 04:09 singlepane-io

Made it three days with 17 devices before everything became unreachable.

singlepane-io avatar Oct 04 '24 15:10 singlepane-io

Is there anything I can do to assist in trouble shooting this issue as I too have this issue. I Currently have an Airthings BLE that is connected from my home assistant over a USB Bluetooth adapter with no other Bluetooth devices connected to HA. Experience the same issue with the connectivity of the device.

akagalford avatar Oct 09 '24 05:10 akagalford

I managed to get 5 hours with a cluster of six bluetooth proxies handling 17 Airthings Wave+ and a couple dozen Xiaomi MiFlora BLE sensors. The Xiaomi sensors never disconnect until the proxies are rebooted.

singlepane-io avatar Oct 24 '24 15:10 singlepane-io

I have the same issue with Airthings Wave Radon. I'm very eager to get this to work again. Worked fine with older versions. I thought it was my bluetooth adapter on the server that was the issue so I tested with a esp32 bluetooth proxy, seems to be the same issue.

The hass log says this when it fails:

ERROR (MainThread) [homeassistant.components.airthings_ble] Error fetching airthings_ble data:
 Unable to fetch data: Failed to connect after 9 attempt(s): No backend with an available connection
 slot that can reach address F3:61:77:70:02:0A was found: The proxy/adapter is out of connection slots
 or the device is no longer reachable; Add additional proxies (https://esphome.github.io/bluetooth-proxies/) near this 
device

Lallassu avatar Nov 06 '24 19:11 Lallassu

Same issue here, I had it running, it stopped working, then I deleted the device and now trying to re-add it, I get timeout error and that's it. Airthings Wave+. I've played around quite a bit with deleting core.entity_registry, bluetooth remote etc but no dice.

knows-cloud avatar Nov 30 '24 20:11 knows-cloud

I have been having the same issue with 5 Airthings devices and a number of bluetooth proxies. In the past it used to work better but I can remember a time when it worked reliably. I am willing to help pull logs or do any other test if that helps.

mnaz avatar Dec 03 '24 14:12 mnaz

Please post debug logs and diagnostics https://www.home-assistant.io/docs/configuration/troubleshooting/#debug-logs-and-diagnostics. Please be sure to include them for airthings-ble, and either the Bluetooth integration, or ESPHome integration if you are using a proxy.

If its able to connect and than goes unavailable, its usually a range or interference issue (or you are using a Realtek RTL8761BU adapter that may require a power down, restart to start working again.). If you are using on board Bluetooth, you may only get 10ft of range. External adapters are usually much better but can be subject to USB port interference so keeping them on an extension cable can also help.

If its not able to connect at all and you are

  • using an ESPHome proxy, make sure you are running the latest firmware.
  • using a local Bluetooth adapter, make sure its on the high performance list https://www.home-assistant.io/integrations/bluetooth/#known-working-high-performance-adapters and try powering off the system and powering it back on

It it works sometimes, and you can't improve the RF situation, you might try manually modifying the max retries from 5 to 10. https://github.com/home-assistant/core/blob/861d9b334160c865255c43d77787ccfaac43f5cd/homeassistant/components/airthings_ble/const.py#L11

bdraco avatar Dec 21 '24 02:12 bdraco

So I didn’t have interference on my radar before and have tested based on the assumption that I need to get interference down. That seems to have helped, I with one AP on Channel 4 and the other on 9. It also stabilized the WiFi connection for the remote BLE (Shelly Blu WiFi Gateway) so that might be the another factor. On the Shelly, I have ensured the setup is according to the Home Assistant documentation. For now it’s looking good again.

knows-cloud avatar Jan 01 '25 11:01 knows-cloud

I spoke too soon. A tad after, it stopped working again with no changes to the environment that I am aware of. I have since installed Home Assistant from scratch on a Mac Mini. This one is using only remote scanners (2x Shelly BLU Gateway and 3x Shelly 1PM in-wall) through which I've connected Shelly door/window/motion sensors as well as Switchbot temperature/humidity sensors. The only thing that refuses to show up despite everything I've tried is the Airthings Wave Plus. In the debug log I can see it in the BLE scan results of the Blu GW close to it, but the integration claims that no Airthings devices have been discovered. I've got a Bluetooth adapter on the way to check if it works with a directly connected adapter attached to the Mac as they're in the same room anyway.

knows-cloud avatar Jan 07 '25 08:01 knows-cloud

Airthings devices need an active connection. Shelly proxies do not have support for making active connections to third party devices. You'll need an ESPHome proxy or local adapter for that. Check the Bluetooth integration docs for what each proxy type provides

bdraco avatar Jan 07 '25 17:01 bdraco

https://www.home-assistant.io/integrations/bluetooth/#remote-adapters-bluetooth-proxies

bdraco avatar Jan 07 '25 19:01 bdraco

Got it. I think that part should be on the documentation page for the Airthings BLE integration - requiring an active connection that is. Maybe it's obvious to someone more familiar with Bluetooth workings (and I did have a suspicion based on the fact that Bluetooth is listed as a requirement), for me it was confusion to figure out between active scanning/passive scanning vs. active connections and differentiating between remote and local adapter capabilities / how they work. Can confirm it started working perfectly fine as soon as I plugged in a supported high performance adapter from the Bluetooth integration page.

https://www.home-assistant.io/integrations/airthings_ble/

knows-cloud avatar Jan 08 '25 09:01 knows-cloud

That would be a nice addition if you are up to edit the docs https://github.com/home-assistant/home-assistant.io/blob/current/source/_integrations/airthings_ble.markdown

bdraco avatar Jan 08 '25 22:01 bdraco

I have the same issue, tried to delete it and add it back but always got the connection failed prompt. Also tried to disable and enable all devices, no help ;( Now it has been disconnected for over 2 months...

kaimindeng avatar Jan 14 '25 04:01 kaimindeng

In my case it was autosuspend usb from the OS.

this solves it

echo -1 | tee /sys/module/usbcore/parameters/autosuspend

but it needs to be persistent, probably on grub.

rudiservo avatar Feb 08 '25 19:02 rudiservo

I had several connection errors and "Unable to fetch data:" messages in the log each day for some time now. My two Wave+ reconnect after a couple of minutes or immediately after reloading the integration, so it seems to be a temporary issue. I modified the airthings_ble integration by adding a simple retry mechanism that just waits 5 seconds after an error and retries to fetch data up to 10 times. Of course this is just a workaround but it seems to fix the issue for me, at least I did not see any connection errors or gaps in the history graph for about a day now. I uploaded the custom integration here in case anyone wants to give it a try.

jchme avatar Mar 27 '25 18:03 jchme

In my case it was autosuspend usb from the OS.

this solves it

echo -1 | tee /sys/module/usbcore/parameters/autosuspend

but it needs to be persistent, probably on grub.

This worked well for me! It has been running fine for the past one month, thank you!

kaimindeng avatar Mar 27 '25 18:03 kaimindeng

I have had an issue with my 5 Airthings and 3 BT Proxies but have noticed HA has gotten better although still having issues.

My hack was to do the following;

  1. add a restart switch to each BLE Proxy yaml configuration
  2. create an automation that runs each night and check if any Airthing entity is unavailable. If so turn on each BLE Proxy reset switch.

My automation does not have to hit reset every night, but after each BLE Proxy restarts things seem to work.

I know this is a hack but for now that is all the time I had to devote to this issue and resetting the Proxies seemed to work.

Does this sound off base?

mnaz avatar Mar 28 '25 01:03 mnaz

FYI; I created an dedicated esp32 Bluetooth proxy for my Airthings Radon and now it has actually been stable for several months.

Lallassu avatar Mar 28 '25 09:03 Lallassu

FYI; I created an dedicated esp32 Bluetooth proxy for my Airthings Radon and now it has actually been stable for several months.

How'd you do that? If you could share, that'd be awesome!

FutureGUIs avatar Mar 30 '25 20:03 FutureGUIs

FYI; I created an dedicated esp32 Bluetooth proxy for my Airthings Radon and now it has actually been stable for several months.

How'd you do that? If you could share, that'd be awesome!

I use a esp32 (search on amazon.com and you'll see, it's about $5/piece), then I flash it with esphome Bluetooth proxy. https://esphome.io/components/bluetooth_proxy.html

I flash using a docker container (docker run --rm --privileged -v "${PWD}":/config --device=/dev/ttyUSB0 -it ghcr.io/esphome/esphome run proxy.yaml), where the proxy.yaml contains my esp32 config with airthings from https://gist.github.com/kevin-david/f86a46147ef49b3c4d09205436adc7c2

Lallassu avatar Mar 31 '25 09:03 Lallassu

Yes, still a problem also for me. Running HA on Raspi 4 and the wave directly connected to the raspberry. Does somebody know where the problem might lie? I am keen to investigate but it is super hard to start.

Sirofjelly avatar Jul 09 '25 19:07 Sirofjelly

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Still having problems with this... I have an automation that resets the POE on my bluetooth extenders, so its workable, but as mentioned before, it was better at different times so definitely seems to be something code related...

FutureGUIs avatar Oct 08 '25 21:10 FutureGUIs