owntracks / talk

Questions, talk about OwnTracks
30 stars 4 forks source link

Owntracks not correctly updating Home Assistant on restart #134

Closed derekoharrow closed 2 years ago

derekoharrow commented 2 years ago

I'm running Owntracks on IOS, using HTTP mode to talk to Home Assistant. I only have one region setup in Owntracks - an iBeacon that is setup in my office - the idea being that I use owntracks to tell me when I'm in the office or not. This works ok usually - entering or leaving the office is detected fine and HA is updated. The problem occurs when I have to restart home assistant. On restart, the device_tracker entity is initially set to unavailable, and then after a few moments, it seems that owntracks sends the GPS co-ordinates to HA, which then interprets that as being in the "Home" region. Owntracks doesn't seem to re-send the fact that it is already connected to the ibeacon so doesn't tell HA that it's using the ibeacons zone. In a nutshell, this means that every time I restart HA, it thinks i'm "home" rather than in the office. I have to basically disconnect the ibeacon, wait for owntracks to disconnect, then reconnect the beacon again to kick it back into the correct place.

Is there a way to solve this?

Thanks

derekoharrow commented 2 years ago

As an update, I've tried adding the events_only: true to the home assistant configuration so that owntracks only updates HA on a zone entry/exit. This has stopped owntracks automatically updating HA with a gps location, but that leaves HA saying the owntracks device_tracker as unavailable until I either leave/unplug the ibeacon and rejoin it again.

It's better, but still not ideal.

ckrey commented 2 years ago

@derekoharrow

I am not sure what OwnTracks could do when HA forgets state on restart.

OwnTracks does sent then enter or leave event when it happens and it sends a list of regions with each position update. We (OwnTracks) don't know if HA interprets this array at all / correctly.

Probably it is best to raise an issue with HA.

derekoharrow commented 2 years ago

What I'm wondering is that when Owntracks sends an update, does it tell HA that it is still in the beacon's region, or is it just sending a GPS update and only send a beacon update when leaving/entering? If it's the latter, then that's where the problem lies.

ckrey commented 2 years ago

and it sends a list of regions with each position update. We (OwnTracks) don't know if HA interprets this array at all / correctly.

derekoharrow commented 2 years ago

Thanks. Just so I know what to raise with them - when it pushes an HTTP update and sends the list of regions, what does it do with ibeacon regions? Does it say that "I'm in ibeacon region x", or does it just say "I'm a lat:long and have these regions setup"? As ibeacons (in my case) doesn't have a gps co-ordinate, then could this be why it doesn't update?

ckrey commented 2 years ago

It does say "I'm in region x"

Our documentation is here https://owntracks.org/booklet/tech/json/ look for inregions

We (OwnTracks) don't know if HA interprets this array at all / correctly.

derekoharrow commented 2 years ago

Thanks. For the record, I've logged this as an issue with the HA owntracks integration here