Skip to content
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

From unknown back to connected to nearest bt proxy is way too slow #369

Closed
sirhideo opened this issue Nov 9, 2024 · 6 comments
Closed
Labels
iOS Transmit Outages Issues identified as being due to iOS devices not transmitting during power-save etc.

Comments

@sirhideo
Copy link

sirhideo commented Nov 9, 2024

I am using ESP32 as the bluetooth proxy and iphone as the device tracker. When I am totally our of range, the xxxxx_area entity becomes unknown which is quite effecient. However, when I return to the BT Proxy area my phone takes like 3 minutes to get the nearest BT Proxy. I cannot use Bermuda as home/away precense detection this way. Is there any setting that can improve this issue?

@agittins
Copy link
Owner

agittins commented Nov 9, 2024

That's very strange. Arrival detection should take up to one second from Away/Unavailable to present.

My guess is that maybe your phone might not be transmitting bluetooth, perhaps you have it set to only transmit when it is connected to the home wifi? I believe there's a setting for that in the HA companion app.

Note that your phone does not do any receiving for Bermuda-related things, it just blindly transmits, and it's up to the proxies to "hear" those transmissions.

Let me know how you go checking the HA companion app settings, I think it's the most likely cause - hopefully so because it's also an easy fix! :-) Another possibility is that the phone is in some power-saving mode which we have very little control over on iphone, but if that were the case I'd expect you to have the phone showing "away" even while you were home, so I think it's more likely the HA companion app setting.

@sirhideo
Copy link
Author

sirhideo commented Nov 9, 2024

I have checked so many time on ios companion app but i do not seem to be able to find any setting related to BLE. I have suspected the same thing so I have a node-red flow that pushes me notification when the bermuda_area entity state changes to unknown, but that never happened when I am at home.

@agittins
Copy link
Owner

I'll have a look on my partner's iPhone when I can get a chance to borrow it :-)

I did notice that when we arrived home today, her iPhone took about 3 minutes longer than my phone and watch (which took under a second), so maybe I can reproduce the problem you are seeing - but it's possible she might have turned her bluetooth off on arriving home (to disconnect from car audio) and turned it back on 3 mins later (to use a speaker), so it may have been operator-caused rather than the problem you are experiencing.

I'll do more testing and see what I can find out. Here's the history page showing the gap I saw today (but again, this might not be the same thing you are seeing):
image

@agittins
Copy link
Owner

Hey, do you have another device that can run NRFConnect or similar? What might be really helpful is when your phone returns inside, but before Bermuda marks it as "home":

  • NRFConnect's data from what it sees from the phone
  • A "download diagnostics" from Bermuda at the same time

In NRFConnect, you would need to hit "Scan", then find the iPhone in the list devices (this can be tricky, you might need to look on the phone for its current MAC address), then click the "More" button. In there it should show what adverts the iPhone has been sending. Then in the three-dots in the top-right, click "Save" then "Save to file" and send me the result, along with a "download diagnostics" from Bermuda.

I know that's a fair bit of work, so completely understand if you don't have the time to do it any time soon. I've raised another issue at #375 to see if anyone else might have the tools and time to try this out too, in the hopes of generally improving iPhone detection.

Of course, what you are experiencing is, I think, unusual, since it seems to happen predictably on arriving home - so it may not be very related to the things I hope to solve in #375, but the data-gathering process would be the same, anyway.

@sirhideo
Copy link
Author

sirhideo commented Nov 13, 2024

@agittins Thank you very much for taking this issue into next level :)

Unfortunately I do not have another iphone for testing. In these couple days I intentionally turn off iphone bluetooth and turn it back on and found that it immediately connects to closest BT proxy when I just got home, not sure if this helps your investigation or not.

Thanks, I will keep watching issue #375 to see if I can be of any help in the future.

@agittins
Copy link
Owner

If turning your phone's bluetooth off and on again fixes it immediately then the issue has to be with the phone. It is interesting that it seems to do it most on arriving home, but its still outside of anything we can control via Bermuda.

I'm going to close this issue because there's really nothing more I can do without further data, but I am going to keep issue #375 open so that if we learn anything new on how to work around the problem we can let everyone know.

Thank you for raising the issue and for gathering the information.

@agittins agittins added the iOS Transmit Outages Issues identified as being due to iOS devices not transmitting during power-save etc. label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Transmit Outages Issues identified as being due to iOS devices not transmitting during power-save etc.
Projects
None yet
Development

No branches or pull requests

2 participants