Strange geofence behavior after upgrade to 5.8

Victor Butlera year ago

I am experiencing a strange behavior with geofences after the 5.8 upgrade.

After the creation of a new geofence, I am getting a Geofence Enter notification for the first data record sent by the device.

Is this normal?

Anton Tananaeva year ago

Why is it not normal and what are you expecting?

Victor Butlera year ago

Before the upgrade, when creating a geofence while the device was inside the geofence area, the Geofence Enter notification was sent only after the device exits and then enters the geofence.
Now the geofence enter event is triggered even if the device haven't moved.
Basically, geofence created with the device inside -> Geofence Enter notification triggered upon receiving the next data packet.

Anton Tananaeva year ago

The new behavior sounds correct to me.

Victor Butlera year ago

Well, this is not right. It's doesn't make much sense from user perspective to receive an event with the device stationery inside the geofence.
The event should be trigged under two conditions (like it was before):

  • Device is outside and enters geofence
  • Device is inside and exists geofence

Is there a way to filter out this "redundant" event or maybe even cancel it altogether?

Anton Tananaeva year ago

No.

Victor Butlera year ago

Ok, so the server gets a data record after the geofence is activated - it sends an event.
How does it "know" not to send a second event after receiving the second data record? Because the geofenceids from the previous row in tc_positions already contains that same geofence id?
Or is the logic different?

Anton Tananaeva year ago

Yes, it checks the geofence in the last position.

Victor Butlera year ago

Well, then there needs to be an additional operation adding or removing the geofence to the last positions record at the time the geofence is added/removed. Otherwise the purpose is defied. If I remove a geofence and then receive an event "Geofence exit" 5 hours later, I am going to wonder what's wrong.

I don't think there is an API call to make changes to the positions records, am I correct?

Victor Butlera year ago

So after some more testing, it's only the geofence enter event which is generated incorrectly. Geofence exit does not generate an extra event after the geofence is removed. Just FYI in case it helps someone else to understand the new setup.

Victor Butler4 months ago

UPDATE: To remediate this issue, I've previously implemented a separate script to manually add the new geofence in the last positions record.
In this way the Geofence Event handler did not trigger an "enter" event if the vehicle was already inside the geofence.

However, after the upgrade to version 6.4, even if we manually add the geofence in the positions table, the "enter" event is triggered with the next record anyway.

May I ask you confirm the following:

  1. If we manually update the last device record in the positions table, is the cache updated at some point or not?
  2. Is it possible to customize the source code and add the geofence id in the last positions record? Or once a position is recorded in the database it's no longer editable?
  3. If possible, which file would you recommend to add such function in?
Anton Tananaev4 months ago
  1. On restart.
  2. Anything is possible by customizing the source code.
Victor Butler4 months ago

Thanks for the quick reply!

It's true the last question is a bit difficult to answer but where would be your recommendation to start from?

Anton Tananaev4 months ago

Unfortunately that's not something I can help with here on the forum.