Skip to content

BLE Advertising stops when HA app is in foreground for particular iOS 18.3+ devices #3583

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

Open
agittins opened this issue May 4, 2025 · 7 comments

Comments

@agittins
Copy link

agittins commented May 4, 2025

iOS device model, version and app version

Person @oneseventhree @jksmurf @DAB-LABS @rccoleman
Model Name: iPhone 15 Pro iPad Air (3rd Gen) ?? 18.6 (a dev version)
Software Version: 18.4.1 (22E252) 18.4.1 18.?? 18.??
App version: 2025.04 (??) 2025.3 (??) ?? (??) 2025.4 (2025.1251)
HA Core 2025.4.4 2025.4.3 2025.4.4 ??

Home Assistant Core Version
Noted in table above.

Describe the bug

When opening the HA Companion app on these devices, all BLE advertising with the known IRK appears to cease. This is observed via the Bermuda custom integration (of which I'm the author), which receives BLE advertisements via local bluetooth adaptors and ESPHome or Shelly Bluetooth proxies. The MAC addresses of the devices are validated by the Private BLE Device integration in HA-core.

@jksmurf finds that their iPhone13 does not have the issue, but their iPad Air Gen3 does. Both devices have the same versions of iOS and HA Companion app installed, and both appear to have equivalent settings (see agittins/bermuda#544 for screenshots etc).

To Reproduce

Observe (via a separate device) the tracking entities in Homeassistant / Bermuda (Area, Distance sensors) showing active updates while the iOS device is in screen-off or unlocked-screen-on states, providing the App is not open in the foreground.

Open the HA App on the device.

Wait 30 seconds (this is an internal timeout in Bermuda) and observe the Area and Distance sensors for the device switch to Unknown, indicating no advertisements have been observed in the last 30 seconds.

Go to the home screen or switch to another app on the device.

Observe that the entities in Bermuda immediately start reflecting Distance and Area states, indicating that BLE advertising using the known IRK has resumed.

Expected behavior

It is expected that BLE advertisements are regularly (in the order of 200ms to 4s) received, which can be matched against the known IRK and will cause entity updates for the Bermuda Distance and Area entities, regardless of the HA companion app's state.

Additional context

This observed behaviour is documented by the above-mentioned users at agittins/bermuda#544

There is a larger issue of devices running iOS 18.3 (and later) going for extended periods without any apparent BLE advertising. This is currently thought to be due to power saving, and definitely occurs during screen-off time, and no relationship between that issue and the HA App is suspected. Research is on-going to try and identify if there is other BLE traffic being sent during these outages that some part of the iOS -> Proxy -> HA -> PBLED -> Bermuda chain is somehow failing to identify. That issue has further information at agittins/bermuda#375 on the Bermuda issue queue and a related bug report on the Private BLE Device core integration at home-assistant/core#123036

Again, this issue being reported on the App appears distinct from the issues related to the ones mentioned in the previous paragraph, but there is definitely a cross-over of users due to the commonalities, so it is important to qualify reports that they are experiencing the BLE outage exclusively when the HA App is in the foreground.

I don't personally have access to any iOS 18+ capable devices, except from occasional visits from a family member, and their device does not have HA installed on it. I am hopeful that the accounts mentioned above (which have been carefully qualified on Bermuda issue 544) will join this issue and provide any further details and testing required.

I took a look through the recent changes in the HA App and couldn't see anything likely to cause this sort of problem (the improv changes didn't look likely), so I'm guessing this might be some esoteric iOS quirk. I hope the above and linked issues are helpful, for what they're worth.

@oneseventhree
Copy link

iPhone 15 pro for me:

Image

@agittins
Copy link
Author

agittins commented May 5, 2025

FYI @jksmurf found that their iPad Air 3 had the Location Services permission on their HA app set to "While Using", but changing it to "Always" did not have any affect on the observed behaviour. They have observed that their iPad Air 3 does also exhibit the behaviour of intermittent advertising while off or not in HA app, but the reliable advertising-stops-when-opening-ha-app persists.

@oneseventhree thanks, I have updated the table in the original post.

@bgoncal
Copy link
Member

bgoncal commented May 6, 2025

Have you tried disabling HA bluetooth permission? The app only uses bluetooth related features in "Devices & services" screen while looking for Improv devices, besides that there is no BT interaction. Let mw know what could cause the advertisement to stop, as far as I know this is handled by the system and can't be overridden by an App

@oneseventhree
Copy link

Have you tried disabling HA bluetooth permission? The app only uses bluetooth related features in "Devices & services" screen while looking for Improv devices, besides that there is no BT interaction. Let mw know what could cause the advertisement to stop, as far as I know this is handled by the system and can't be overridden by an App

I did and still I get the problem:

Image

@DAB-LABS
Copy link

DAB-LABS commented May 6, 2025

Hi All!

Thanks for starting this thread.

Its been frustrating tracking down this issue...

Seems as though the app causes the iPhone to go 'unknown' in Bermuda and can be replicated.

What can I look for in any logs?

  • iPhone 14 Pro Max
  • iOS 18.4.1
  • HA app 2025.3
  • HA Core 2025.3.4

Cheers!

EDIT: Here's what it looks like 30 seconds(ish) after opening the HA iOS app. Then immediately closing the app once I notice the unknown state. I didnt notice any other activity or errors in debug logging.

2025-05-06 10:34:01.242 DEBUG (MainThread) [custom_components.bermuda] Finished fetching bermuda data in 0.007 seconds (success: True)
2025-05-06 10:34:02.242 DEBUG (MainThread) [custom_components.bermuda] Device David's iPhone 15 was in 'Office', now 'None'
2025-05-06 10:34:02.242 DEBUG (MainThread) [custom_components.bermuda] Finished fetching bermuda data in 0.007 seconds (success: True)

2025-05-06 10:34:21.248 DEBUG (MainThread) [custom_components.bermuda] Finished fetching bermuda data in 0.007 seconds (success: True)
2025-05-06 10:34:22.262 DEBUG (MainThread) [custom_components.bermuda] Device David's iPhone 15 was in 'None', now 'Office'
2025-05-06 10:34:22.262 DEBUG (MainThread) [custom_components.bermuda] Finished fetching bermuda data in 0.009 seconds (success: True)

@DAB-LABS
Copy link

DAB-LABS commented May 6, 2025

Have you tried disabling HA bluetooth permission? The app only uses bluetooth related features in "Devices & services" screen while looking for Improv devices, besides that there is no BT interaction. Let mw know what could cause the advertisement to stop, as far as I know this is handled by the system and can't be overridden by an App

Yes. Removing Bluetooth permissions does not seem to have any affect. The device still goes unknown...

@jksmurf
Copy link

jksmurf commented May 9, 2025

Tried v0.8.2-beta1 of Bermuda. For my iOS devices same result as reported in first issue.

  • If I wander around with iPAD plus iPhone with HACA open on iPhone only, both devices are reported quickly and accurately with my 5 Wifi and 3 Ethernet ESP32 BT Proxies.
  • If I wander around iPAD plus iPhone with HACA open on iPAD only, iPhone location is reported quickly and accurately but iPAD goes unknown very quickly (as before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants