I’m not entirely sure if I should be posting this issue in the Companion app for Android or iOS or neither, but hopefully it’s okay here
I have two phones:
Xiaomi Mi10TLite running Android 12 with active SIM card with mobile data
old iPhone6 with iOS 12.5.7 with expired SIM card
If I go out for a walk I switch on the 4G data connection on my Mi10TLite & use the Cloudflare AddOn to create an ArgoTunnel back to my HomeAssistant server. This all works perfectly & I have remote access to HomeAssistant (v2024.6.4).
I then use the Bluetooth Hotspot internet connection to share my Mi10TLite 4G data connection and then connect the Bluetooth on my iPhone6 to the Mi10TLite to give it a working internet connection. This works fine, albeit slowly, allowing me to access my HomeAssistant server on the iPhone6 via the shared 4G connection to my Mi10TLite over Bluetooth.
I use the device_tracker entities on both devices to update my location on a Map card. So if I go out for a walk, both devices should be independently communicating my GPS location back to my HomeAssistant server.
This works perfectly on the Mi10TLite allowing me to see my breadcrumb style track on the Map card.
Now the problem:
With the iPhone6 connected & tracking, this works for a few minutes & then the Companion app v2023.12.1 (2023.508) seems to ‘disconnect’ from my HomeAssistant server. If I swipe-down to refresh, it eventually reconnects & updates the iPhone6 device_tracker location (takes 1-2 minutes to reconnect).
At first I thought this was due to user setting of “Automatically close connection after being hidden for 5 mins” being ON, but I switched this OFF and the problem of the device_tracker connection being lost still happens.
At the time of the disconnect, the Companion app on the iPhone6 is not the foreground app (it’s running in the background).
When the iPhone6 device_tracker disconnects, it also seems to cause a problem with the Mi10TLite device_tracker. Although the Companion app on my Mi10TLite it’s still updating my GPS location to my HomeAssistant server, it seems to think the ‘previous’ location is at the point where my iPhone6 lost it’s connection. This results in a back-and-forth ‘fan tail’ of breadcrumb tracks on the Map card showing my Mi10TLite track. This continues until I take the iPhone6 out of my pocket & force it to reconnect by doing a ‘swipe-down’ to refresh the Companion app.
Everything then works for a few minutes & then the iPhone6 disconnects again and then causes the ‘fan tail’ track issue on my Mi10TLite.
I tried to resolve this problem using an Automation to update the location on my iPhone6 every 20 seconds. This works perfectly, but it doesn’t stop the iPhone6 Companion app seemingly disconnecting.
alias: iPhone 20secs » update tracker
description: ""
trigger:
- platform: time_pattern
seconds: /20
condition: []
action:
- service: notify.mobile_app_iphone6
data:
message: request_location_update
- service: homeassistant.update_entity
metadata: {}
data: {}
target:
entity_id: device_tracker.iphone6
mode: single
I have made another observation which seems relevant:
When I first open the Companion app on my iPhone6 after establishing a working Bluetooth connection between iPhone6 & Mi10TLite, very often the display is shown in ‘Light’ mode, even although I normally have it set to ‘Dark’ mode. I discovered that when it changes to Light mode, it is also resetting the “Automatically close connection after being hidden for 5 mins” back to ON. I presume there is something odd going on with the user settings when the iPhone6 Companion app connects over Bluetooth?? Perhaps something to do with tokens??
Whenever I open the iPhone6 Companion app, I now check that the “Automatically close connection…” option is OFF, but this doesn’t resolve the connection lost issue.
So basically, I want to know how to ensure the iPhone6 Companion app DOESN’T keep losing it’s connection to my HomeAssistant server when operating over a Bluetooth shared 4G data link?