Bluetooth BLE devices going offline/disabled

Raspbian Bookworm
HA Core 2924.9.3
Frontend 20240909.1
Switchbot Integration (not sure how to get the version)
Pi Model 3B (yes old but perfectly suitable for running HA - apart from BLE!)

Rather frustrating this,
I have a number of Switchbot BLE Meter Plus devices that keep going offline/disabled in HA yet they are still working and can be detected by my Windows 10 PC and read using SW so the issue is Power supply, Pi hardware, Raspbian, bluetooth, HA or Switchbot integration. I have no idea where to start.

So when I power on the Pi, all is fine. After a couple of days maybe a day, the devices go “offline” in HA in that they are available but not being updated, disable, or both.

My competence is limited, but I have figured out that I can use the command line for lmited debug…

If I run hcitool -i hci0 lescan I get an inpout/output error

If I run hciconfig hci0 down then hciconfig hci up then hcitool -i hci0 lescan then I see the list of MAC addresses, some of the sensors in HA come back online although some of those are disabled and I have to reenable them in the integration. The system now works, for day or two, then I have to repeat.

Can I automate this up/down every day to reset bluetooth, or better, is it possible to work out what is going on and fix the root cause?

nobody has this issue widely reported from Pi owners on many forums ??

No I have not seen widespread BLE issues reported since September (your version) but…

(and I totally know it’s not what you want to hear)

given memory consumption patterns on versions of HA since last February - I strongly believe your statement is barely correct anymore. I’ve seen TONS of reports that can be anecdotally attributed to low memory conditions causing issues. …Like you see on ALL Pi3 and early Pi4.(basically the 1GB RAM setups)

That’s not particularly nice statement. allow me to reciprocate…

I’m reasonably competent as a software developer … written device drivers for Linux and Xwindow apps… I fully understand the operating system underneath home assistant and all the various concepts and nuances. from a strictly software context of course. I’m confident the issue is hardware … potentially interference or perhaps flaky Bluetooth chips in this particular model of pie. I guess this is what I’m looking for some anecdotal support. and I remain unconvinced this is a homeassistant or an integration issue having looked at the source code, in the context of comparisons with OS reported statistics.

Your assertion is less than barely correct! Low memory is not a problem so the TONS of reports you have read and attributed through detail analysis of course to low memory (by the way that must have took you several months and years) are not something I recognise . looking into the statistics reported in the live /sys file system I disagree with your statement.

however I’m not a hardware engineer and I guess this is what I’m trying to elicit some further comment on… but thanks anyway

For other more serious commenters I would be interested to hear about perceptions on potential 2.4 Wi-Fi band interference I’m going to use some external USB dongles or equipment.

EDIT
I ANSWER MY OWN QUESTION I DON’T THINK THIS IS HOME ASSISTANT PROBLEM …IT’S MORE OF A PI HARDWARE ISSUE

You can feel free to disagree. I’m not trying to be nice I’m trying to be honest.

Ive been on this community site every single day for four years.

Dev. Ok cool. Here’s what’s up.

Approximately last June we started seeing people put up a lot of strange issues that usually are attributed to long slow memory leaks.

What I strongly suspect is going on is.

They changed memory handling for the databases in Feb to fix a lot of long running efficiency and stability issues. Trade off is memory. There are git notes from that time about same. And this is when they made the decision to not support pi 2.anymore (note supported install doesn’t list it anymore and there’s a dev note on low mem pi on the installation page)

Same machine post Feb running a build post 2024.2 has approximately 1/3 more memory use by default.

Next enter any memory leak. Not necessarily BT any. (we never see memory leaks in HA, sarcastically he laughs…)

So what I’m more than 70% sure you’re fighting is a memory leak in an unrelated component causing memory pressure in an already compressed memory condition. If reboot clears it and it takes a few days to surface its that or you’re hitting some oddball routine once in a forever to lock it up. My money is on memory.

So start there and have fun troubleshooting, or don’t. Troubleshooting isn’t about nice it’s about following what the data is telling you and application of known conditions. You are in a low memory condition from boot.

Don’t shout.

1 Like

Do bear in mind that others can still read your deleted posts - for about 24 hours, I think. :grin: