I’m transitioning from V1 bindings to V2 bindings, and have got the GPSLogger Binding to work with a Spare Phone and Owntracks. Following the bindings instruction I installed Owntracks on the iPhone and told it to connect to:
https://MyOpenHABServer/gpstracker/owntracks
When created a new waypoint in Owntracks and I saw this in the NGINX access log:
POST /gpstracker/owntracks HTTP/1.1" 200 5 "-" "OwnTracks/13.1.7 CFNetwork/1121.2.2 Darwin/19.3.0
According to the bindings webpage
" Discovery
If the things are not defined in .things files the first time the tracker sends a GPS log record the binding recognizes it as new tracker and inserts an entry into the Inbox as new tracker with name GPS Tracker ??"
My Inbox was empty. So I put the binding into DEBUG Mode. It only gave 3 startup messages compared to the bindings webpage which lists 9. My system logged this from the binding at startup.
2020-01-28 12:12:14.068 [DEBUG] [er.internal.GPSTrackerHandlerFactory] - Initializing callback servlets
2020-01-28 12:12:14.083 [DEBUG] [er.internal.GPSTrackerHandlerFactory] - Started GPSTracker Callback servlet on /gpstracker/owntracks
2020-01-28 12:12:14.086 [DEBUG] [er.internal.GPSTrackerHandlerFactory] - Started GPSTracker Callback servlet on /gpstracker/gpslogger
Eventually after many minutes and toggling all of the change options at the top of the map screen the phone sent an update that was recognised by the binding and I got these log entries
2020-01-28 13:07:33.913 [DEBUG] [nal.provider.AbstractCallbackServlet] - Post message received from OwnTracks tracker: {"cog":93,"batt":72,"lon":174.68167891742166,"acc":50,"p":101.67362213134766,"bs":1,"vel":0,"vac":12,"lat":-36.788778319057812,"topic":"owntracks\/MyUsername\/MyDeviceID","conn":"w","tst":1580170052,"tid":"xx","_type":"location","alt":13}
2020-01-28 13:06:31.228 [DEBUG] [nal.provider.AbstractCallbackServlet] - Post message received from OwnTracks tracker: {"_type":"waypoints","topic":"owntracks\/MyUsername\/MyDeviceID\/waypoints","waypoints":[{"_type":"waypoint","tst":1580169900,"lat":-36.791928933892002,"lon":174.68728935447001,"rad":1000,"desc":"Home2"},{"_type":"waypoint","tst":1580169706,"lat":-36.788787841797003,"lon":174.68169065209,"rad":650,"desc":"Home1"}]}
2020-01-28 13:07:33.922 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'gpstracker:tracker:MyDevice' to inbox.
2020-01-28 13:07:33.925 [DEBUG] [nal.provider.AbstractCallbackServlet] - There is no handler for tracker MyDevice. Check the inbox for the new tracker.
At this point I had something in my inbox I could add as a thing. I then discovered that linking the region to a switch using PaperUI didn’t seem to retain the region infomation when I queried the REST APi, so I put the item links in an item file. Testing it I discovered these entries in the log after I’d left 3 geofences and reentered one of them I saw this in the log
2020-01-29 13:35:00.357 [DEBUG] [ofile.GPSTrackerTriggerSwitchProfile] - Trigger switch profile created for region Home1
2020-01-29 13:35:00.359 [DEBUG] [ofile.GPSTrackerTriggerSwitchProfile] - Trigger switch profile created for region Home2
2020-01-29 13:35:00.360 [DEBUG] [ofile.GPSTrackerTriggerSwitchProfile] - Trigger switch profile created for region Home3
2020-01-29 13:35:00.365 [DEBUG] [ofile.GPSTrackerTriggerSwitchProfile] - Transition trigger Home3/enter handled for region Home3 by profile: ON
Suggesting that the Geofences had started updating, A quick reference to the bindings webpage found this:
Note :
- If the binding was restarted only the second transition update will trigger event as the binding has to know the previous state.