I am playing around with the additional distance channel.
The documentation says: When this calculated distance is less than the defined geofence radius the binding also fires event on Region Trigger channel.
But I don’t get it.
I have defined a distance to work with position, radius, threshold and channel id.
the channel itself is a number item channel.
So WHICH regionTrigger will be triggered?
Goal would be to define the regions in OH only and not in the owntracks app.
And according to the documentation of GPSTracker this seems to be possible.
I have some locations for testing. For example:
home
home_owntracks
work
work_owntracks
home is defined inside openhab only and home_owntracks is defined inside owntracks. Bothe with same position and same radius. It seems, that i get the same resulst. Sometimes the openhab-item is faster, sometimes time i get the notification on the same time.
distance channel only wokrs with the openhab-items, where i have configured the position inside the things-file. The owntracks-item is only defined inside the items-file - no entry in the things-file.
My places are only configured with a radius of 50m - so i don´t know, which distance is shown, but i think it is the distance to the configured point - without any radius.
I think it will trigger the region of the position, which you have defined inside the things file? Every defined position has a region around it.
Is it mandatory to put the distance channel (OH only) in the .things file or can I also put it in by PaperUI
Would you please share your things file?
My general question is (for no regions on the OT device): If the position of the owntracks device is within the region (distance measurement within the OH binding), there is a switch which should be triggered, right), but which? I canot define a switch to link to the region (enter / leave).
I don’t see the channel type of regionTrigger in PaperUI.
Is this maybe a string returning the trigger (e.g. home / work) ??
//tracker definition with extra distance channel
Thing gpstracker:tracker:phone1 "person_1 tracker" [trackerId="phone1"] {
Channels:
Type regionDistance : homeDistance "Distance from Home" [
regionName="Home",
regionCenterLocation="44.33333,12.54321",
regionRadius=100,
accuracyThreshold=30
]
Type regionDistance : workDistance "Distance from Work" [
regionName="Work",
regionCenterLocation="44.44444,12.34567",
regionRadius=100,
accuracyThreshold=30
]
}
And my items-file:
Group gGPS_Tracker
//items for basic channels
Location GPS_phone1_location "Location" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:lastLocation"}
DateTime GPS_phoen1_lastSeen "Last seen" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:lastReport"}
Number GPS_phone1_battery "Battery level" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:batteryLevel"}
Number:Length GPS_phone1_accuracy "GPS Accuracy [%d m]" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:gpsAccuracy"}
// -------------defined in openhab ------------------------
//linking switch item to regionTrigger channel. assuming the Home distance channel is defined in the binding config (see above)
Switch GPS_phone1_atHome "Home presence phone1" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:regionTrigger" [profile="gpstracker:trigger-geofence", regionName="Home"]}
Number:Length GPS_phone1_Distance_fromHome "Distance from Home [%.1f km]" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:distanceSystem"}
Number:Length GPS_phone1_Distance_fromHome_2 "Distance from Home2 [%.1f km]" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:homeDistance"}
//another switch for work region. assuming the Work is defined in OwnTracks application (no distance channel is needed like for Home)
Switch GPS_phone1_atWork "Work presence phone1" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:regionTrigger" [profile="gpstracker:trigger-geofence", regionName="Work"]}
Number:Length GPS_phone1_Distance_fromWork "Distance from Work [%.1f km]" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:workDistance"}
// -------------defined in owntracks ------------------------
//another switch for work region. assuming the Work is defined in OwnTracks application (no distance channel is needed like for Home)
Switch GPS_phone1_atHome_owntracks "Home_OT presence phone1" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:regionTrigger" [profile="gpstracker:trigger-geofence", regionName="Home_OT"]}
//another switch for work region. assuming the Work is defined in OwnTracks application (no distance channel is needed like for Home)
Switch GPS_phone1_atWork_owntracks "Work_OT presence phone1" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:regionTrigger" [profile="gpstracker:trigger-geofence", regionName="Work_OT"]}
//another switch for work region. assuming the Work is defined in OwnTracks application (no distance channel is needed like for Home)
Switch GPS_phone1_atXYZ "XYZ owntracks presence phone1" (gGPS_Tracker) {channel="gpstracker:tracker:phone1:regionTrigger" [profile="gpstracker:trigger-geofence", regionName="XYZ"]}
I only use manual configuration, no paper ui.
You can see my number:lenght items, there is one more for the home channel because of some testing, but i get the same values. The first one is most time faster, but after some time, i get the same value on both. No idea, what´s the difference between them…
The switch for the region-trigger is defined only in the items file, not in the things-file.
thank you very much for the quick response and your config.
I will check it out and see, if I can make it work on my side.
I think I got it now, that the regionTrigger Channel is very powerful…
Again - thanks!
How did you get the new APK? It’s not available. Neither on Android store, nor on GitHub.
I’m currently trying both apps. Yesterday I had the complete identical message from OwnTracks. I could resolve the problem by changing my myopenhab.org password. Could you please try that?
Thanks, mine are placed in the items file as well.
I did not get a trigger on the regionTrigger channel yet, but I’ll keep on trying.
Distances are logged (DEBUG mde) obviously.
Is it possible that it’s not meter, like in the PaperUI description, but km instead?
Hi,
it works with GPSLogger (with the v99_milestone-apk) for me.
20:21:46 DEBUG Networks.getKnownServersStore:52 - Getting local truststore - /storage/emulated/0/Android/data/com.mendhak.gpslogger/files/knownservers.bks
20:21:46 DEBUG LocalX509TrustManager.isKnownServer:144 - Checking for certificate - HashCode: 502180181, Subject: CN=home.myopenhab.org, in keystore: false
20:21:48 DEBUG CustomUrlJob.onRun:82 - Success - response code Response{protocol=http/1.1, code=200, message=OK, url=https://home.myopenhab.org/gpstracker/gpslogger}
20:21:48 DEBUG AppSettings$1.d:92 - safeRunResult for com.mendhak.gpslogger.loggers.customurl.CustomUrlJob@9f8e07 : true. re run:false. cancelled: false
For me, GPSLogger is more powerful, everything can be adjusted…
My usecase: An old android within my car, logging the gpx’s to my Dropbox and also sends the actual position to openhab from now on!
Thanks to gbicskei!
Ok, I found the problem. My password contained a “#”. That crashed the send process. I created an issue for that.
I hope that GPSLogger is less power hungry than OwnTracks. However, I have security concerns. The MyOpenHab password is stored there in plain text. So I have to continue with OwnTracks as long as this issue isn’t fixed.
First of all, thank you very much for this binding. Was desperately searching for a solution to get away from unreliable IFTTT location service.
Here’s my issue…
I’m using OH 2.4 and the offline built jar file in the addons folder (No Paper UI addon installed). I get all the channels including the accuracy, but doesn’t seems like OT send me the region transition message (yes I have defined regions in the OT mobile app). See my log below:
2019-02-07 23:32:39.114 [DEBUG] [cker.internal.handler.TrackerHandler] - Update base channels for tracker ac from message: org.openhab.binding.gpstracker.internal.message.LocationMessage@ae9be8
2019-02-07 23:32:39.119 [TRACE] [cker.internal.handler.TrackerHandler] - batteryLevel -> 62
2019-02-07 23:32:39.128 [TRACE] [cker.internal.handler.TrackerHandler] - lastLocation -> 6.xxxxx,79.xxxxx
2019-02-07 23:32:39.139 [TRACE] [cker.internal.handler.TrackerHandler] - lastReport -> 2019-02-07T23:32:38.000+0530
2019-02-07 23:32:39.148 [TRACE] [cker.internal.handler.TrackerHandler] - gpsAccuracy -> 23
2019-02-07 23:32:39.153 [DEBUG] [cker.internal.handler.TrackerHandler] - Updating distance channels tracker ac
2019-02-07 23:32:39.162 [TRACE] [cker.internal.handler.TrackerHandler] - Region System center distance from tracker location 6.xxxxx,79.xxxxx is 6.725917239320571m
2019-02-07 23:32:39.168 [TRACE] [cker.internal.handler.TrackerHandler] - System uses SI measurement units. No conversion is needed.
In the app I have 100m as the fence for my region and tried moving in and out but no luck. Am I missing anything?
Make sure that all the regions in your OT app are shared (this is a flag at region settings in OT). Without this the app will not send transition messages.