By using a tool like mosquitto_sub (command line) or one of the many UI tools (mqttspy etc).
I tried mosquitto_sub already (see above) and get the messages on the mosquitto server.
playing around yesterday I managed to get some information into my openhab with the current item:
Switch Loc_Home_Enzio "Home" (G_Debug, G_Location) { mqttitude="mosquitto:owntracks/mosquitto/NCOs_iPhone/event:Home" }
But according to the log generated by mosquitto_sub (I write into a file) I obviously get âenterâ events switching on my items, but no âleaveâ events:
owntracks/mosquitto/NCOs_iPhone/event {"t":"c","tst":1447084967,"acc":65,"_type":"transition","event":"enter","lon":xxxx,"lat":xxxx,"wtst":1446458751,"tid":"ES","desc":"Home"}
Accordingly the switch items for the respective Regions will not switch off after leaving.
Is this how it supposed to be?
Additionally I got messages for waypoints I donât quite understand:
{"_type":"waypoint","tst":1446826767,"lat":xxxx,"lon":xxxx,"rad":200,"desc":"Loc_1"}
This location is setup as a general Region, so what makes a Region to popup as a waypoint?
Not sure why you would see enter events, but not leave.
And as for the Loc_1
waypoint, I can only assume you set this up in your Owntracks app, or you have another device using the same device id?
Loc_1 is only a replacement for my real location name to hide it from the NSA
It is setup in my iPhone (no other phone used yet) the same way like all the other Regions.
So how do I know, if a Region will be handled like a âRegionâ (in/out) or a âwaypointâ (no information about enter / leave in the message of type âwaypointâ)?
Because both are setup the same, but have a different topic, there is not reliable item config possible.
Waypoint pubs are sent when a waypoint is created or edited. The transition pubs are sent when the phone enters or leaves a waypoint. The Mqttitude binding will look for transition events only, and match on the desc
field. It will ignore the waypoint events.
you are right.
After I did not get a signal (enter/leave) passing through a region, I adjusted itâs radius. This triggered the âwaypointâ message.
I will check on my way home, if I get the triggers (enter / leave) today.
In general the setup seems to be ok:
item:
Switch Loc_City "City" (G_Location) { mqttitude="mosquitto:owntracks/mosquitto/NCOs_iPhone/event:City" }
But itâs not reliable, because some enter / leave events are not received by mosquitto or not sent by iPhone.
Actually the events on the phone are deleted shortly after they have been triggered.
Is this normal or maybe the root cause?
A history of the events would be helpful.
Because the location switches keep staying âONâ in some cases (no leave message), I try to compensate this by rules:
rule âLocation Cityâ
when
Item Loc_City changed from OFF to ON
then
postUpdate(Loc_BSL, OFF)
postUpdate(Loc_Home, OFF)
postUpdate(Loc_Kita, OFF)
postUpdate(Ort, âin der Cityâ)
end
But this is not how it supposed to be - or is the reliablility of receiving / sending region events a known issue?
Hi
Iâm not sure about the exact topic and the current state of this thread, but for your last postâŠ
In fact there seems to be a problem with the current version of the IOS OwnTracks app with sending the notifications. To control it, you can have a look on the app about the identified region (Region: red is active, blue is inactive, or the other way round) and the sent notifications at least for an hour. For me that part works fine, if the notification was sent it will be handled by openhab⊠Only problem is that it is quite often not sent To solve this problem I have a similar rule than you but hope for an update. Otherwise I might switch over to IFTTTâŠ
Regards
Dieter
Hi Dieter,
thanks for your response.
Thatâs my impression as well, that sometimes Owntracks just donât send the transition message (it will not appear in the messaging section in owntracks accordingly).
But what do you mean by[quote=âDieterL, post:28, topic:3744â]
and the sent notifications at least for an hour
[/quote]
Is there any setting to tell Owntracks to send the message more than once if it failed?
Best regards,
Enzio
I have just been speaking to the Owntracks iOS developer and he has a new version on its way which should resolve the missing waypoint transition events.
Hi
@ben_jones12: Great to hearâŠ
@NCO: The most obvious thing with â1 hourâ is that they are removed from the list after that time. So you canât check all events of the day when going to bed. Whether or not there are other (practical) issues I canât say. Here is just my guess from what I know about other MQ Implementations: Usually topics were removed from the queue after a certain time (here 3600 sec => ttl attribute displayed in the messages in the app). The reason is to prevent a queue overrun. So if you didnât get the message within this time, it is not available anymore (shouldnât be a big problem here). It might well be that this tab does not display messages that were sent by the phone, but messages that were currently available in the queue, problably filtered by some attributesâŠ
Regards
Dieter
I am experiencing similar issues with the Owntracks application on Android. I get status updates, including my phone battery and Location. But, the switch is not triggered when I enter, or leave the geofence. I use the new syntax.
Any idea how to solve this?
Hi Dominic
For me, this works fine again but Iâm using the IOS app and do not know the Android version. If it behaves similar you should see the geofence status in the region tab of the app, as well as the messages (see my last post). If this happens you might check the events on the server by using the commandline subscriber (mosquitto-sub?) and redirect the output to a file to see whether or not the events were published (in my installation they donât appear in the MQTT persistance database). If this all works there might be a problem with openhab so check the logfile for successful subscribtion or provide more infos here (e.g. your Item to receive the events).
Regards
Dieter
Hey Dieter,
i like MQTT due to enhanced privacy, therefore i wonât switch back to openpaths.
This is my running configuration:
openhab.cfg:
(Hint: the Openpaths service was just uncommented by a hashkey)
mqtt:mosquitto.url=tcp://127.0.0.1:1883
mqtt:mosquitto.clientId=openhab
mqtt:mosquitto.user=mosquitto
mqtt:mosquitto.pwd=your_password
mqtt:mosquitto.qos=2
mqtt:mosquitto.retain=false
mqtt:mosquitto.async=true
mqttitude:home.lat=51.123456
mqttitude:home.lon=6.123456
mqttitude:work.lat=51.123456
mqttitude:work.long=6.123456
mqttitude:geofence=400
default.items:
Switch User1PresenceHome "Handy @Home" {mqttitude="mosquitto:owntracks/mosquitto/LGG4/event:home"}
Switch User1PresenceWork "Handy @Work" {mqttitude="mosquitto:owntracks/mosquitto/LGG4/event:work"}
Switch User2PresenceHome "Tablet @Home" {mqttitude="mosquitto:owntracks/mosquitto/GalaxyTABS2/event:home"}
Switch User2PresenceWork "Tablet @Work" {mqttitude="mosquitto:owntracks/mosquitto/GalaxyTABS2/event:work"}
But i do not get the geofence item within the owntracks (also nown as mqttitude) application
Hi Dominic Are you sure you use the new Syntax for your system?I have defined the regions within the owntracks app. For your configuration, as far as I can see, you ask openhab for the calculation not your phone to send the events. So there are none available.You might try this as well and see what will happen (owntrack, not openpath)
[quote=âsptzdmnc, post:32, topic:3744, full:trueâ]
Any idea how to solve this?[/quote]
You get your phone locations and status updates, so it looks like your setup is good to go.
Maybe you should read this part of the wiki about region mode and switch to this mode from your manual mode.
This is a far more powerful mode and gives greater flexibility. It
also stops the issue of location publishes happening just before you get
close enough to âhomeâ and thus being considered outside the geofence,
and then no further updates being sent because you donât move far enough
to trigger one.
In âRegion Modeâ the OwnTracks apps detects when you cross a geofence
boundary and ALWAYS sends a location update (either enter or leave),
meaning openHAB should never lose track of your position.
This works without any problems in my case, all enter and leave events are published.
Edit: but donât forget to set your locations in the owntracks app to âshareâ.
Ah okay. But why do I need to configure the geofence twice, in the
openhab.cfg and in the Owntracks UI? That makes no sense for meâŠ
In region mode you donât configure the location in openhab.cfg, only in the owntracks app, see the wiki.
Thanks for your advice. Now my Geofence is working.
But, there is still one problem.
If i restart my Openhab instance the states for geofence are undefined.
I set them to OFF on start. Also, if i enter one of my three geofences, the other two were set to OFF.
But this is only a troubleshoot.
Any hints regarding this startup behaviour?
Btw: If i start my phone, or if i got a weak internet connection (Even if i connect again) the MQTT is and stays marked as disconnected.
I have to go to settings and apply the settings again, this also occurs to my waypoints.
If the device is in standby mode, i wonât get any status update. Is there any way to sync the device at least each hour, if its on AC Power maybe each 15 MinutesâŠ
I am using an Android device with the latest software.
If you set up persistence and apply the restoreOnStartup strategy, what ever values they were before OH stopped will be restored automatically.