MQTT Location

So I finally got MQTT and owntracks installed, but can’t seem to get the Switch to turn on/off when I am home or away.

I have Mosquitto installed and owntracks working. I have both the MQTT binding and myttitude binding in my addons folder and have configured the config file. And I’m seeing no errrors in my log file.

My phones name/topic is "owntracks/pmuldoon/s6edgeplus

and My Item files looks like the below

Switch  PresencePaul_PhoneMqttHome   "Paul @ Home"   { mqttitude="mosquitto:owntracks/pmuldoon/event:Home" }
Switch  PresencePaul_PhoneMqttWork   "Paul @ Work"   { mqttitude="mosquitto:owntracks/pmuldoon//event:Work" }

And I do have a Home and Work Region setup in Owntracks as well. I think i’ve done it all correct and I’m sitting here at work, but OH continues to show me both switched as Off?

Hey Paul,

Best advice would be to open up a terminal and subscribe to owntracks/# and then take your phone out for a drive to see what is getting published on what topics.

I am guessing you are missing the device name in your binding topics;

mosquitto:owntracks/pmuldoon/**phone**/event:Home

Also, your Work binding has an extra / in there.

@ben_jones12

Thanks Ben for the help.

I’m still struggling to get OH1 to show the home/away status. I did correct the item to show the username/device id. I think I had that way earlier as well, but it still not showing.

What I’m not certain of is the event of home or work needs to be defined in the mqttitude binding, in owntracks, or in both. I do have the it shown in both with the same long and lat.

Whats strange Is I don’t see any errors in my log either.

Since you are using the region mode, you only have to setup your lat/lon in the owntracks app. You don’t need to put anything in the openhab.cfg.

And all the parameters are case sensitive, so change your “Home” and “Work” to “home” and “work”.

And: don’t forget to “share” your regions in your app! (see wiki)

As I said before, subscribe to owntracks/# and have a look at what is being published when you enter/leave the region. Until you see these pubs coming from the Owntracks app you won’t have any luck getting OH to recognise them.

@ben_jones12

Yeah, I’m not sure if the regions info is being published or not. All I see on the server side is the phone clients connecting and disconnecting showing the username/deviceid when updating.

And I see my wife and I updating on the owntracks map as well.

Should I be seeing something of event/region showing?

EDIT. Success!!! Not sure, but I think you perhaps you must need to use all lowercase in naming your regions/waypoints in the owntrack app?

Can someone confirm if you can also set the regions strictly within the myqttitude config versus the app? ie, have 1 central place versus having to setup regions on each phone/device separately?

If you are using the region stuff in the Owntracks apps then you need to set them up on each device. IMO this is a much better way to operate, as opposed to having static regions configured in the Mqttitude binding, since the device OS handles the geofence enter/leave events and tends to be more accurate than just relying on device location pubs which openHAB then has to check are within the static regions.

It is possible to push configuration to the Owntracks apps but this is getting pretty advanced.