Wear OS: Support switching between local and cloud URL
Is your feature request related to a problem? Please describe.
Being able to use the local URL while at home would mean lower latency and improved privacy.
It could even be a bit confusing today. If someone e.g. disables the HA cloud connection while everyone is home, the watch would not be able to reach HA.
Describe the solution you'd like
Ideally, the Wear OS device would automatically use the local URL whenever the "home SSID" is connected, and the cloud URL in other situations.
It's a harder problem than it may seem, because as @dshokouhi pointed out in https://github.com/home-assistant/android/issues/3523#issuecomment-1652348654, Wear OS devices are not connected to WiFi all the time.
Without having any insight into how the communication between the phone and Wear OS device works, one way could be to have the phone relay the information. Whenever the phone switches URL, it would notify the Wear OS device that it needs to switch URL too.
Describe alternatives you've considered, if any
Additional context
this request isnt feasible, a wearable doesnt stay connected on wifi forever. Try it yourself how long does your watch stay on wifi?
Try it yourself how long does your watch stay on wifi?
I haven't checked thoroughly, but not very often at all from the few times I have.
I might be misunderstanding something here, but my impression is that the Wear OS device accesses the network/internet through the bluetooth connection to the phone while it's disconnected from WiFi. Hence my alternative suggestion:
Without having any insight into how the communication between the phone and Wear OS device works, one way could be to have the phone relay the information. Whenever the phone switches URL, it would notify the Wear OS device that it needs to switch URL too.
My thinking was that if the phone can access the local URL, the Wear OS device should be able to too.
I might be misunderstanding something here, but my impression is that the Wear OS device accesses the network/internet through the bluetooth connection to the phone while it's disconnected from WiFi. Hence my alternative suggestion:
its a proxy actually
https://developer.android.com/training/wearables/data/network-access#network-access
My thinking was that if the phone can access the local URL, the Wear OS device should be able to too.
this is only the case if the watch is connected to WiFi as well, it has its own networking.
It should be possible at least to have a manual 'switch to the other network address' option. Right now, you've got one address and that's it. This does not work in my case, where the router refuses to port forward on the external address and wear os does not see the local DNS server (so split brain does not work either.
An alternative option is to use the geolocation-based solution that iOS seems to use?
I'll link my issue here, as #3852 was closed and @dshokouhi pointed me here.
I think this can a deeper problem, but no clue where this was introduced. I have been using the wearOS app without a problem so long... until some time ago (weeks, maybe a month). It can only connect with the url I logged in when setting the watch.
I tried to solve it deploying a local dns server (AdGuard home) and rewriting my external domain internally. This is, making adguard resolve the same domain I use externally, internally to the local ip address. So, I have a proxy server (nginx proxy manager) and a dns server resolving my url to that proxy.
All my devices can connect to HA using the same url, doesn't matter if I'm at home or away. All... except the wearOS app. It only works where I log in: home or away. This is:
- If I log in at home, I have to use the ip address, and it works flawlessly.
- If I log while I'm away, I have to use the url, and it works great.
But it refuses to connect while at home by using the url, while local dns works great for the rest of devices (dns server is configured in my router, no locally in my devices).
Any ideas?
Thanks!
Any ideas?
I think I saw somewhere that wear os uses Google DNS exclusively and completely ignores local DNS, which would mean it would try to connect to the external IP address of your router. This may not work, depending how your NAT is configured.
Not sure how it works, but it was working properly not so long ago, that's the weird thing.
I've seen in another issue some people got it working, but there's not a clear solution.
Will try adding dns over tls locally, as I've also read if that fails, wear os goes directly to google's dns.
Hm this DNS annoyance is really a deal breaker for me.
How is this working for everybody else? I guess Wear OS app right now only works when HA is always connecting via the internet (for example, through Nabu Casa)? It's kinda ironic that app whose whole point is local access, does not work with such local access, if you also want to access it from away.
If it's using Google DNS exclusively, you could try blackhole those IPs and see if it falls back to the local network DNS? I believe that was a suggested fix for Chromecasts at one stage.