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

WearOS Location Sensor #3029

Open janstadt opened 1 year ago

janstadt commented 1 year ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like Provide sensors for gps/location for wearOS. Im particularly interested in getting it added for the galaxy 4 LTE devices.

Describe alternatives you've considered, if any N/A

Additional context

dshokouhi commented 1 year ago

So for this we definitely need sensor setting support added in the UI so users can adjust the accuracy because I am sure whatever default we decide on will not be good enough for everyone.

At what update intervals are you expecting? I don't think the values from the phone side make sense here because updates every minute will not be good for a wearable battery.

I also wonder how doze will impact this as we cannot turn off battery optimisations on the wearable.

janstadt commented 1 year ago

Id say 30 minutes or 1 hour would be sufficient. Maybe if optimization is turned on you could switch to 1 hour if the user has it set for 30? I know very little about android wear so i am open to all options.

dshokouhi commented 1 year ago

Maybe if optimization is turned on you could switch to 1 hour if the user has it set for 30? I know very little about android wear so i am open to all options.

Google has blocked the ability for apps to request to ignore battery optimizations on Wear OS so that won't be possible. Good to know that 30 min to 1 hour for the update interval will work for you. Lets see what others think on this too.

janstadt commented 1 year ago

Maybe if optimization is turned on you could switch to 1 hour if the user has it set for 30? I know very little about android wear so i am open to all options.

Google has blocked the ability for apps to request to ignore battery optimizations on Wear OS so that won't be possible. Good to know that 30 min to 1 hour for the update interval will work for you. Lets see what others think on this too.

I mean, it all depends on how the battery (which is truly terrible) handles a background service pinging HA. I'd love it to be less, but i know these things are heavily dependent on the hardware running wearOS/HA. If its possible to like disable ALL sensors except location once enabled and the battery can make it close to a day with more frequent pings, that'd be awesome.

dshokouhi commented 1 year ago

my point about battery optimizations is that while we may request 30 min or 1 hour we may be subject to doze which means the update will not get sent until some time after the interval or when the device screen comes on. There is no way around that.

Sensor updates like battery are separate from location updates too, the current schedule is fine so we don't need to touch that.

kevin-david commented 1 year ago

It's unfortunate there's no way to disable battery optimization. I was hoping I could write something to (with a time limit, think Glympse app) do "live" location tracking from the watch without being connected to the phone over LTE, given I can't find an app that exists yet.

TheFes commented 1 year ago

I'd like to have a working device_tracker for my watch as well. I have an LTE version, and will sometimes be leaving my phone home. I'd still like my location to be updated then.

seanmccabe commented 1 year ago

I'd like to have a working device_tracker for my watch as well. I have an LTE version, and will sometimes be leaving my phone home. I'd still like my location to be updated then.

Same, I'm on LTE, and was hoping with HA it would have my watch location, so even if I leave my phone home, I will be away due to the watch and can run various automations despite one device being home.

Will the location be updated say if another app updates it? Often I'm just out walking the dog, as such the Health app updates the location to track the route, can HA use this info and send on change?

dshokouhi commented 1 year ago

Will the location be updated say if another app updates it?

Yup those are considered "passive" updates we can receive those at the interval we will define, the phone app will receive passive updates every 30 seconds like when you have google maps open. Behavior wise it should be similar to the phone app with probably the exception of less frequent updates to preserve battery life. If we stick to the defaults on the phone side battery will not last as long on a wearable.

seanmccabe commented 1 year ago

I do expect it to work like the phone (since the app should work standalone), so perhaps configurable interval. Maybe times we want a more frequent update, despite the drain.

Alternative perhaps is only send update when position has changed by x meters? I used to have GPSLogger set like that, so it wasn't sending so many frequent updates and would get passive updates from Samsung Health tracking the route. I would set to 100m+ before sending an update.

seanmccabe commented 11 months ago

8 months on, just wondering if there is any progress on this?

I take my watch out without my phone so often and the companion app is great, but still have to fire so many automations manually because HA isn't seeing the watch as away, despite HA seeming to expect location data.

jegres1709 commented 10 months ago

I have also some usecases for this feature( e.g. nuki lock) It would be pretty cool to have location data delivered by the watch.

seanmccabe commented 8 months ago

@dshokouhi I notice the "yet" in the linked closed issue.

Is location tracking still planned given the app supports it and HA appears to be expecting it?

dshokouhi commented 8 months ago

Is location tracking still planned given the app supports it and HA appears to be expecting it?

I wouldnt say planned but I guess you can say "accepted? nobody I know of has started to work on this. Also its not that HA is expecting anything its just that the mobile app integration automatically adds it to any device registered. The entity is just awaiting to show updates. In reality it should be hidden however that will require HA core changes first I believe.

dreimer1986 commented 7 months ago

Regarding the power usage and some people here maybe hoping to crank the interval up to way more than every 30 min... I had a lil... Wear App problem on my phone recently. I did not even notice that it was completely dead and did not even try to open at all anymore. (Samsung Watch variant in my case). This seemed to have resulted in some funny side effects. Bluetooth connection was unused and the watch connected to HA with LTE. Notifications still showed up from time to time, so I guess the connection to the phone was realized that way, too.

Small change, but my battery lasted only about 6-8 hours that way. And this was with WIFI off. Just by using LTE, a basic phone feature all the time. GPS is nice and good, but it will eat your battery for breakfast. Try to use Google Maps on the watch and you will realize that a battery percentage easily can decrease to 0 in less than 3 hours.

Of course I came up here because I don't like the unknown result in HA, too. But don't forget to be realistic here. This thingie is a watch, in my case it has a ultra small 350 mAh battery aka compared to my phone (4926 mAh) about 1/14 of the capacity.

30 min sounds like a good default value for me. If someone really has fun recharging the watch twice a day... make it selectable. With some luck the app even wakes up often enough for some higher interval. ^^