home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.23k stars 623 forks source link

Location being accessed constantly when Home Wi-Fi networks in settings #4384

Closed Rudd-O closed 4 months ago

Rudd-O commented 4 months ago

Home Assistant Android app version(s):

Android version(s):

2024.4-minimal (F-Droid) GrapheneOS (latest)

Device model(s):

Pixel 6 Pro

Home Assistant version:

2024.4.1

Last working Home Assistant release (if known):

?

Description of problem, include YAML if issue is related to notifications:

I was experiencing literally constant (at least every minute) location polling from the app. I wondered if the culprit was the Wi-Fi sensors, so I turned them all off.

Nothing. Constant location polling, still.

Then I went into the server settings, and I realized I had turned on the setting to use local URL when on certain Wi-Fi networks.

I deleted the Wi-Fi networks from there. Like magic, the insane battery-draining location polling stopped.

There ought to be a way to have that setting enabled but poll only with the frequency that the Wi-Fi connection sensor uses (which seems reasonable to me).

It appears that the Wi-Fi connection sensor only polls for location when Wi-Fi connectivity changes for real, while the setting to use local URL on certain Wi-Fi networks polls location rather than like a crack-addled maniac.

I hope this is fixed because the local URL connection setting is close to useless under these circumstances (I have turned it off completely now).

dshokouhi commented 4 months ago

anytime wifi SSID is read a location request is made, that is an android thing. The Wifi connection not only listens to the intent but also gets called during the sensor update and anytime any other sensor gets updated. Just about all the times the local URL is tried. The same API is used to read it. Closing as this is not a valid issue, this is the way android works.

Rudd-O commented 3 months ago

I am familiar with how android does things. what I was wondering was whether it would be possible to make the code only read SSID (and therefore trigger location permission) when the network actually changes, rather than repeatedly and frequently in a way that prevents the phone from saving battery on this thing.

Other apps such as Syncthing do exactly this, so I know this has to be possible.