Geofence events trigger to external app

Riccardo 7 years ago

Hello, i easily installed traccar few months ago on my synology and i am very happy, i have a tracker in my car and i can see it without any problem. Db is a MariaDb running on the same synology. Even if i am not really familiar with Java i could handle very easily all the process thanks to the documentation.
I am now struggling to understand which is the best strategy to connect the in/out geofence events to another application (still running on the same server): i would like to inform my openhab system about presence of the device in a specific geofence area.
Openhab is quite flexible, i could call a rest api to switch the status (somethink like "curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://127.0.0.1:8080/rest/items/mycar/state" ") or i could set an MQTT item to link to mycar state.
What do you suggest? Which is the best strategy to study to create this link?
Thank you

Anton Tananaev 7 years ago

You can write your own event notification handler:

https://www.traccar.org/documentation/notificators/

JP Mens 7 years ago

In additio to the official documentation Anton links to, you may find some usable bits of information at https://jpmens.net/2018/09/14/position-and-event-forwarding-from-traccar/

Riccardo 7 years ago

Hello, thanks for your sharing.
I implemented easily an event forward to a php script which decode the json content and in case the device id and geofence id are matching, call the rest api PUT in openhab.
Thank you again

p33 5 years ago

Could you share your solution?

nanna 5 years ago

Hi Riccardo

Can you please share your Traccar - Openhab solution?

Best Nanna