I have 2 Pixel 6A phones. I have set the location permission to Allowed all the time. But it does not seem to work unless I have the Hubitat application open. Any suggestions on how to fix this? Thanks
Check the app settings, make sure battery optimization is disabled so the app isn't being put to sleep when running in the background.
I checked and the battery usage is set to unrestricted.
So, the best work around for Samsung phones doesn't appear to be available on Pixel. I lock the app to always on in the recents.
Aside from battery optimization on the app itself, you might check for global settings. Not sure where that would be in a Pixel, but on Samsung, there is a setting in Device Care -> More Battery Settings -> Adaptive Battery. I have to go in and disable it after every update as they REALLY want to push this for some reason. On the same More Battery Settings page, there is also Performance Profile. I have mine set to standard. Then, backing up a page, under background usage limits, I had to turn off "Put Unused Apps to Sleep".
That fixed 95% of my problem.
Since you have Android, you might also look at using Tasker Geolocation to push your presence changes to Hubitat in case it lags.
I did my own version of this Tasker+Autolocation Presence Setup [Android Only]. My version updates a virtual presence (Actually from "combined presence" app which is the one I use for modes. So, if Hubitat is lagging, Tasker changes my virtual and Hubitat is almost always within 5 minutes of Tasker when it misses. Between the two working together, I have an issue maybe once every couple of months, if that. Usually, it is after an update or my phone compass getting out of calibration (this is Google Play Service's fault for tying compass to GPS), or because of where I live, spotty cell coverage that doesn't update HE when I change location.
@tray_e has some good advice.
I have used MacroDroid for my Geofence for a while and it has been pretty reliable.
MacroDroid also is an easy to use phone automation app that works well.
Once you set the Geofence you create a macro to tell Hubitat if you are home or away, etc.
What I have found is that the app on my phones must be running to accurately detect presence in near real-time. Not sure how to make this happen all the time. I do have the location setting set to all the time, not just when the app is running.
If you have a Samsung, you can do this by pinning it to the recents tab. For non-samsung phones, I do not believe you can pin an app to recents. But, you can make sure that the usage limits are set to not close it in the background. In that case, Skip to where I start with "for battery optimization"
Pin To Recents
To do this, open the app. Then hit your home button to go to the home screen.
Next, open the recent apps (Not sure if you are using swipe, but if you have the buttons on bottom, it will be the 3 vertical lines - III)
Once that is done, you will see a lock at the bottom of the app. This usually stays effective through reboots but has to be redone sometimes when updates are run.
You will also want to verify that the app is excluded from battery optimization in settings and better yet, that put unused apps to sleep is turned off.
For battery optimization,
Go to Settings -> Battery and Device Care -> Battery - Background Usage Limits
Once there, ensure that "Put unused apps to sleep" is toggled off. Then tap on "Never Sleeping Apps". Hit the "+" in the upper right, then scroll down to find hubitat. Select it and then "Add" at the bottom. NOTE: If Hubitat is not listed to be able to be added, you have likely set it to unrestricted as shown at the bottom. This removes the app from being able to be selected. I like to do the battery optimization step BEFORE setting it to unrestricted. Not sure if it is necessary though
For memory optimization, Go to Settings -> Battery and Device Care -> Memory and tap that section.
If Hubitat isn't listed, then click the plus, scroll down to hubitat, select it and click add at the bottom
Finally, go to the Hubitat Icon in your apps launcher, long press till you see the pop up with the "i". Tap the "i" to open the app menu NOTE: If you did this first, you will NOT be able to add it to Never sleeping apps in the previous steps. This last step will hide it from that menu for some reason
Tap the i
Make sure that unrestricted is selected
Lastly, anytime an update to your phone is run, you will want to verify that the app is still locked to recents, hubitat is excluded from memory optimization, and that the usage is set to unrestricted. It will not show in never sleeping apps once usage is unrestricted. So, you cannot really verify that.
Thanks for the suggestions. I have a Pixel 6A and that does not have all the options that you have. The battery optimization is set to unrestricted.
You should also be able to turn off adaptive battery (The same as Battery Optimization on Samsung). This is an android setting not exclusive to Samsung
Pixel 6A's here. My wife and I have had good luck with the app geofencing so I thought I would share all of our settings. Many may not have any bearing on reliability.
Settings-> Apps-> Hubitat
Camera- Allow only while using the app
Location - Allow all the time
Notifications- All Hubitat notifications
Physical activity- Allow
Pause app activity if unused- Toggled off
Mobile data & Wi-Fi
Background data- toggled on
Unrestricted data usage- toggled on
App battery usage
Open by default
Open supported links- toggled on
Pause app activity if unused
Hubitat app advanced settings
Let me know I've omitted anything.
I don't have these settings available on mine. There is no Advanced Presence Options for me.
Under the settings tab in the Habitat mobile app, do you not see the advanced option under the presence section? It might be only a beta feature, but I thought the Android app had been on a stable general release for some time.
That's good. We have the same options. Hopefully the settings that have worked for me will work for you.
I did turn off adaptive charging.
@jhmosow @bjcowles You probably will want to turn OFF "Pause app activity if unused" since, if you don't open the Hubitat app often enough it will eventually lose its permission to access your location (GPS) and your Hubitat presence sensing will silently fail.
That is true. If you click on the "+" sign next to "Pause app activity if unused" you'll see I have it toggled off. It's a good reminder though, as I've had that setting bite me in the butt with other apps.
Thanks for the suggestion. I do not have that enabled. Still trying to figure out what is a reliable solution for this.