Android - Geofence not working

Are you sure it's not there? The firmware should be the same regardless of the provider.

It's there on my wife's s21 phone too.

1 Like

They seem to gave changed the wording to lock app,

I was failing at geofencing for the longest time, I've heard that life 360 is supposed to be a working solution, but, after I discovered modes in Hubitat I Scraped Geofencing Because Modes Is Awesome! - YouTube I couldn't care less I don't have geofencing. I had enough smart devices installed to easily get modes to do exactly what I wanted.

The only time this might ever be an issue is if you have really extreme temperature changes from home to away.

Same here. Brand new phone with Android 13, latest Snapdragon processor and planty of RAM. I thought it would make the mobile app a beast of precision. No it is worst than ever before.

-No battery optimization
-Running in background enabled
-Running at startup enabled
-Hi precision geolocation enabled

I've got a rule that sends me notifications on presence change. The time it takes to run is absolutely random. I took more than 12 hours to change my status for coming back home last night.

Phone: OnePlus 11 5G
Android 13
App version: 1.6.12 build 136

I'm not going to defend and mobile GeoFencing solution, which should not be entirely landed at HE's feet.... That aside.... I still need to do some more work on this myself, but I would suggest looking at investing in some contact and/or motion sensors to have as a backup detection of someone arriving home. You could also look at detecting this using other indicators, like are suggested in various topics, like WiFi membership etc.....

For what it's worth, I implemented geofencing in my dashboard app to see if I could make presence more reliable. It's been running on my device for months now and I can't think of a single time it hasn't worked. I get a notification when my Hub goes into 'away' mode and I hear that notification sound within a few seconds of leaving my geofence area.

I put a guide together on setting it up here

1 Like

Also, as a daily user of HD+ (android only) geofence I have not had a single time it has not worked either. I no longer use the Hubitat App version and all my automations run off the presence value from Joe's app.

I don't understand why Joe's app works and the Hubitat one doesn't! Maybe they should contact him to see what he has working so well. BTW: I read the HD+ thread every day and can't recall any users that uses it report any problem.

This is not a slam on the Hubitat App or the hard-working people there. I think they contract the phone app out to some company. Software development on multiple devices is no easy task. My apologies if I the words appear offending when I don't mean it that way. I just know how frustrating I was using the built-in geofence feature.

1 Like

Discovered that my GeoFencing wasn't working and had some time to look into it.

I'm running the beta version of the Hubitat C-7 and the Android App. Using a Samsung S21 with Android 13 and One UI 5.1

Last activity received from the device was on 2023-02-10.

I've tried -

  • Logging out of the device and logging back on.
  • Rebooting the Samsung S21
  • Updating the Hubitat C-7

What I've noticed is that when I send a Geo Event, the app does send the correct GPS position when looking at the "show debug information" but when I look at the GeoFence tab, it shows me in a different location.

So during a recent app update, it seems that even though the Hubitat app can read the GPS location without issue, it isn't updating the location within the app to trigger GeoFence alerts.

I then jumped into the settings -> apps -> hubitat -> storage and cleared the cache and data.

Re-opened the app and logged back into Hubitat.

When it offered the device to select which Mobile Device App, the Samsung device was showing it as (SamsungS21) when previously it was just SamsungS21.

Once I select the device, it registers it correctly, Geofence starts reporting correctly and all the associated rules start working as expected.

1 Like

Hi Jeff!
I have your great app installed on a Samsung S8, and it works great
EXCEPT....
When I restore a saved backup, the geofencing is disabled, and I get a brief popup stating this.
Is this normal?
When setting HD+ up for geofencing, do I select the device that I want to operate (in my case a virtual switch that runs rules to lock doors, set thermostats, etc.)?

When trying it today for the first time, about every 2 minutes I received a notification on my phone that I was out of geofence, but my hub did not report all these events. In fact NONE of the departed events happened!

Is HD+ trying to send the geofence event to my hub, using cell data, and not being able to send, making multiple retries?

That's so weird! It's been like this for minutes until I changed de radius.

That's the same thing I noticed when I first started this thread -- Android - Geofence not working

I have a pretty good idea why this is happening though. The native Hubitat app is registering a geofence with the OS and waiting for it to notify when the device ENTER's or EXIT's this geofence. The ENTER event either hasn't arrived or maybe it was sent but not received by the app and processed fully.

However, the screenshot you posted is an embedded Google Map. The app adds a 'pin' of your geofence and radius but the Google Map adds the little blue dot showing your location. It's separate from the whole geofence flow which Hubitat is relying on to mark your device as IN or OUT of the geofence.

What Hubitat should do is also detect the users location on this screen and compare it to the geofenced area and use that to mark the device as IN/OUT.

I've learned from several weeks of testing this in my own app what needs to be done to make presence detection reliable.

That said, your best bet if you haven't done it already is to make sure these settings are enabled in your device:
App Info -> Battery -> Unrestricted
App Info -> Permissions -> Location -> Allow all the time

I'm not sure what that popup is -- but you have a good point. I checked and I don't save any of the geofencing info (lat/lng/radius/device) to a backup file. I'll get this fixed!

When setting HD+ up for geofencing, do I select the device that I want to operate (in my case a virtual switch that runs rules to lock doors, set thermostats, etc.)?

Yes, that's the 'device' in the dialog below. It can be any switch (on/off), any device that supports the 'arrived' command, or a 'mobile device' type -- which is what the native Hubitat app creates when you first setup a Geofence through it. That's what I use - I setup a geofence through the native Hubitat app once and then added that device "S20" to MakerAPI so HD+ can access it. Then, I disabled Geofence on the native Hubitat app.

When trying it today for the first time, about every 2 minutes I received a notification on my phone that I was out of geofence, but my hub did not report all these events. In fact NONE of the departed events happened!

It sounds like that's from the "Show Notifications" setting. I wanted that option for testing but once things are working reliably you can disable it. It basically will notify you when the app (HD+) detects that you're IN or OUT of the geofence area.

But, the real end-to-end test that you'll likely want is to select a device on the Hub to notify -- and then to ensure that this device is marked 'home' or 'away' accordingly.

Thank you Jeff for the quick response!
I played around with it and used my "I am here" switch, but the "logic" is inverted ie...
when I am here, the switch turns OFF, and when I am gone, the switch turns ON... opposite of what I need.
Is there a way to specify the state of a switch when present?

Also, a while back I asked if in the thermostat tile there was a way to change the step increment from 1 degree to 0.5 degrees.
This is off this subject but I thought I would throw that into your HUGE pile-o-things!

Overall... LOVING this app!!!! I have it on my phone and 5 tablets (4 are fire hd10's)!
SUPER handy!!!!
And
SUPER support!!!

1 Like

my name's Joe :slight_smile:

I played around with it and used my "I am here" switch, but the "logic" is inverted ie...
when I am here, the switch turns OFF, and when I am gone, the switch turns ON... opposite of what I need.

This was a tricky one for me. In the app I treat 'on' and 'open' the same as 'away' -- the idea being that when looking at the dashboard I want to know at a glance if any lights were left on - or any doors unlocked.. the same with a device being away or not present.

Also, a while back I asked if in the thermostat tile there was a way to change the step increment from 1 degree to 0.5 degrees.

I checked and my Nest thermostat only accepts whole degrees. Is that because it's displaying F and not Celsius? If there's a way to know if the thermostat accepts .5 degrees I can make the UP/DOWN button use .5 instead. In fact I checked the code and if the setpoint is < 40 I am using .5 degrees step increments (the hope was that any value < 40 would be Celsius).. maybe there's better logic to use?

OOHHH so SORRY Joe!
I confused you with another great developer here... sorry! :woozy_face: :upside_down_face:

I am controlling the HE thermostat app and not my stat directly, so I can go as fine as 0.1 deg steps in the HE dashboard (not your HD+ dashboard).
I use deg F.
Here is a HE dashboard screenshot. Note the heating setpoint is 71.9 . I temporarily change the increment to 0.1 degrees for the dashboard tile.

stat

So the HE thermostat controller app can do 0.1 deg F, but that is not what is sent to the physical stat. I have the Honeywell T6 pro, and I THINK it can do 0.5, but that is not what I am controlling with my dashboards.

Hope this helps? If you need more info, I would be happy to provide it!

Well I can go through and change the logic in my rules that use the "I am here" switch, and also just rename it to "I am gone".

Just another note about the virtual switch....

I was using the "virtual presence with switch" driver, which has the INVERTED logic....

I changed the driver to "virtual switch" which works as well, but the HD+ tile NOW displays PRESENT/NOT PRESENT correctly.
I also changed the few rules that I was using that this switch was triggering, so they work properly now.
Not a big deal for me!

I still get that "geofence removed" popup when I restore my saved backup of the HD+ dashboard, and have to set it up from "scratch"... location/device/turn off notifications.
I am on 1.0.1935 . Don't know if you have been able to chase this but wanted to let you know...

Hey JOE @jpage4500... just wanted to let you know that the presence detection WORKS GREAT!!!!!
As far as I can tell, my "I am gone" switch (not presence with switch), turns off/on within a minute of me arriving/leaving the geofence!
I have only tried it once so far, but all the other methods that I have tried didn't work AT ALL! I have a Samsung S8 so this could be the problem with the other apps, but as long as one works reliably, that is all I want!

I still get the popup when I restore a backup "geofence removed".
Here are the steps that I go through...

  1. When I backup HD+, close HD+, re-open HD+ geofence is enabled.

1A) Then I restore the backup and get the popup "geofence removed" and sure enough the geofence has been disabled.....Strange!

2)I even tried closing HD+ by swiping up, and restarting and geofence is still enabled.

  1. SO I tried closing HD+ and restarting the phone and re-opening HD+ and geofence is still enabled.

It appears that restoring from a backup, removes geofence.... strange!!!

I am running version 1.0.1935

I noticed I don't backup the geofence details (lat/lng/radius). So, when you do a restore from backup, it clears any previous settings (including your previous geofence) and then restores everything from the backup file -- but there's no geofence in there.

I'm going to get that fixed