OwnTracks configuration in OpenHab2


I’m having some troubles to get the OwnTracks messages that is published via MQTT to get picked up by OpenHab2 (2.0.0-SNAPSHOT Build #701). Have just started using OpenHab so bear with me that I’m a novice in the area. :slight_smile:

I have a separate MQTT-service that handles the location messages, called mqttloc.

Using MQTT-Spy I can see that the messages are infact published from the phone as expected using the same credentials and host:port as in the services/mqtt.cfg. So the OwnTracks and the MQTT server seems to be working as expected. However OpenHab 2 and the OwnTracks Binding (binding-mqttitude1 - 1.9.0.SNAPSHOT) doesn’t seem to pick up the published messages in the message queue.

At first I didn’t configure home in the mqttitude.cfg since I thought that the Regions and Waypoints in OwnTracks would be sufficent. After some reading in the forum I also configured a home i services/mqttitude.cfg (provided below). In the configuration below I don’t use the configured home location but instead I try to use a Waypoint/Region from the OwnTracks configured on the phone.

So all together I have tried the following:

  1. No home configuration in services/mqttitude.cfg
  2. A home configuration in services/mqttitude.cfg but using a WayPoint/Region from OwnTracks (the item confiuration specifies the name of the WayPoint)
  3. Using the home configuration in the services/mqttitude.cfg (the item configuration was altered - see the commented line below in items/XYZ.items)

The configuration below reflects the 2 configuration option.

Any thoughts on how I can resolve the issue or enhance the logging in order to detect what’s happening in OpenHab?

One odd thing, for me, is that when the binding is activated it first registers and activates. After that it picks up the services/addons.cfg and then unregisters the consumer and then re-registers it. Is that a normal behavior for OpenHab2 services and bindings?

I would have expected that the configuration was read first, validated and then the bindings were instantiated, registered and started.

Configuration files

The relevant configuration as far as I know.


binding = mqtt1,mqttitude1






Switch  Presence_Fredrik_PhoneHome   "Fredrik" <present>  { mqttitude="mqttloc:owntracks/<id>/<device-id>/event:hemma" }
//Switch  Presence_Fredrik_PhoneHome   "Fredrik" <present>  { mqttitude="mqttloc:owntracks/<id>/<device-id>/event:home" }


I have removed all unrelated log messages and redacted topics and coordinates

09:26:36.794 [DEBUG] [org.openhab.binding.mqttitude       ] - BundleEvent STARTING - org.openhab.binding.mqttitude
09:26:36.803 [DEBUG] [qttitude.internal.MqttitudeActivator] - Mqttitude binding has been started.
09:26:42.474 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Registering Mqttitude consumer for owntracks/<id>/<devide-id>/event (on mqttloc)
09:26:42.536 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Activating Mqttitude binding
09:26:42.539 [DEBUG] [org.openhab.binding.mqttitude       ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.mqttitude, component.name=org.openhab.binding.mqttitude, component.id=177, service.id=318, service.bundleid=214, service.scope=bundle} - org.openhab.binding.mqttitude
09:26:42.543 [DEBUG] [org.openhab.binding.mqttitude       ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqttitude.MqttitudeBindingProvider}={component.name=org.openhab.binding.mqttitude.genericbindingprovider, component.id=178, service.id=316, service.bundleid=214, service.scope=bundle} - org.openhab.binding.mqttitude
09:26:42.544 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Mqttitude binding configuration updated, 'home' location specified (Lat: XX.XXXXXXXXX, Long: YY.YYYYYYYYY) with a geofence of 15.0m.
09:26:42.546 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Unregistering Mqttitude consumer for owntracks/<id>/<devide-id>/event (on mqttloc)
09:26:42.548 [DEBUG] [org.openhab.binding.mqttitude       ] - BundleEvent STARTED - org.openhab.binding.mqttitude
09:26:42.602 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Registering Mqttitude consumer for owntracks/<id>/<devide-id>/event (on mqttloc)


The bundles installed according to the Karaf console is:

207 | Active   |  80 |    | openHAB MQTT Binding
208 | Active   |  80 |    | openHAB MQTT Transport Bundle
214 | Active   |  80 |    | openHAB Mqttitude Binding
215 | Active   |  80 |    | openHAB Mqtt Action

Would love to help… but have the same problem with 1.8.3… I suspect the issue has been carried over to 1.9.0… however, not sure.

I finally managed to get mqttitude working.

I discovered that the mqttitude.conf must be cached somewhere since even if I removed the file and restarted OpenHab it was discovered and used to configure the home location and radius.

So I readded the configuration file and replaced keys with empty values. When I did that mqttitude did reconfigure properly.

It logged the following message that confirms the reconfiguration:

17:03:39.623 [DEBUG] [.mqttitude.internal.MqttitudeBinding] - Mqttitude binding configuration updated, no 'home' location specified. All item bindings must be configured with a <region>.

Maybe @Max_G should give it a try if it can help out with regards to https://community.openhab.org/t/oh1-owntracks-not-getting-anywhere/20450/12

1 Like

I have a similar battle. Not getting the OwnTracks binding to run.
Here my mqtt.cfg:

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883

# Optional. User id to authenticate with the broker.

# Optional. Password to authenticate with the broker.


# Optional. The latitude/longitude coordinates of 'home'. 
# Optional. The geofence radius.

installed bundles:

bundle:list | grep MQ
201 | Active   |  80 | 1.9.0                 | openHAB MQTT Binding
209 | Active   |  80 | 1.9.0                 | openHAB MQTT Transport Bundle
218 | Active   |  80 | 1.9.0                 | openHAB Mqttitude Binding

but I cannot see any Mqttitude related entires in my openhab.log:

cat /var/log/openhab2/openhab.log | grep Mqtt
2017-04-21 08:37:24.278 [DEBUG] [ient.mqttv3.internal.CommsTokenStore] - openhab.1492755736591: key=Ping token=org.eclipse.paho.client.mqttv3.MqttToken@7fbb2a47
2017-04-21 08:37:24.278 [DEBUG] [qttv3.internal.wire.MqttOutputStream] - null: 500
2017-04-21 08:37:24.278 [DEBUG] [mqttv3.internal.wire.MqttInputStream] - null: 501
2017-04-21 08:37:24.278 [DEBUG] [o.client.mqttv3.internal.ClientState] - openhab.1492755736591: received key=0 token=org.eclipse.paho.client.mqttv3.MqttToken@7fbb2a47 message=PINGRESP msgId 0
2017-04-21 08:38:24.278 [DEBUG] [ient.mqttv3.internal.CommsTokenStore] - openhab.1492755736591: key=Ping token=org.eclipse.paho.client.mqttv3.MqttToken@6e0c82d2
2017-04-21 08:38:24.278 [DEBUG] [qttv3.internal.wire.MqttOutputStream] - null: 500
2017-04-21 08:38:24.279 [DEBUG] [mqttv3.internal.wire.MqttInputStream] - null: 501
2017-04-21 08:38:24.279 [DEBUG] [o.client.mqttv3.internal.ClientState] - openhab.1492755736591: received key=0 token=org.eclipse.paho.client.mqttv3.MqttToken@6e0c82d2 message=PINGRESP msgId 0

Although openhab is connecting to mosquito:

cat /var/log/mosquitto/mosquitto.log
1492752382: mosquitto version 1.4.11 (build date Mon, 20 Feb 2017 22:49:47 +0000) starting
1492752382: Config loaded from /etc/mosquitto/mosquitto.conf.
1492752382: Opening ipv4 listen socket on port 1883.
1492752382: Opening ipv4 listen socket on port 8883.
1492752382: Opening ipv6 listen socket on port 8883.
1492752385: New connection from on port 1883.
1492752385: New client connected from as openhab.1492695939661 (c1, k60, u'openHAB').
1492752385: Sending CONNACK to openhab.1492695939661 (0, 0)
1492752385: Received SUBSCRIBE from openhab.1492695939661
1492752385: 	owntracks/Matthias/iPhone/event (QoS 0)
1492752385: openhab.1492695939661 0 owntracks/Matthias/iPhone/event
1492752385: Sending SUBACK to openhab.1492695939661
1492752445: Received PINGREQ from openhab.1492695939661
1492752445: Sending PINGRESP to openhab.1492695939661
1492752505: Received PINGREQ from openhab.1492695939661
1492752505: Sending PINGRESP to openhab.1492695939661

Any ideas?

You need to subscribe to that topic through an item:

Switch PresenceBen_PhoneMqttHome "Ben @ Home" { mqttitude="mosquitto:owntracks/ben/event:home" }


I have - sorry, forgot to add:

// OwnTracks
Switch  PresenceM_PhoneMqttWork   "Matthias @ Work"   { mqttitude="mosquitto:owntracks/Matthias/iPhone/event:Work_AMS" }
Switch  PresenceM_PhoneMqttHaarlem   "Matthias in Haarlem"   { mqttitude="mosquitto:owntracks/Matthias/iPhone/event:Haarlem" }
Switch  PresenceM_PhoneMqttHome   "Matthias @ Home"   { mqttitude="mosquitto:owntracks/Matthias/iPhone/event:Home" }

Cannot find any errors in your config … Unfortunately I’m not using it anymore so can not deeper investigate …

Hello matzR,

did you solve your problem? I have the same issue here any help would be appriciated.

Shouldn’t it be:

{ mqttitude=<["mosquitto:owntracks/Matthias/iPhone/event:Work_AMS"] }

at least in OH1 it is.

[Sorry, my stance is incorrect.]

Not if the example in the docs is correct: :sunglasses:

{ mqttitude="<broker_id>:<mqtt_topic>/event:<region_description>" }


1 Like

But I’m currently not sure my mosquitto broker is working properly. It seems the events don’t actually come through.

Btw, can anybody tell me how I can test this using the mosquitto_sub?
I try with mosquitto_sub -h localhost -t owntracks/Matthias/iPhone which returns me with location changes. But I don’t seem to see any updates when entering or leaving a region. The phone does alert for these though.

Wondering if anyone else has gotten any further. I seem to be having similar issues. I am using cloudmqtt as the mqtt broker.

  • I see openhab mqtt binding is connecting fine to the mqtt broker, i see the established connection on the server
  • It’s a little bit hidden in the binding notes, but if you are using “Region” mode, you need to select “Share” in owntracks to ensure the region is published in the topic name. I have done this.
  • I have setup mosquito_sub and confirm I am getting the messages
  • I set logging to DEBUG for org.openhab.binding.mqtt & org.openhab.binding.mqttitude. I don’t see any log messages for mqttitutde, however I get the following for org.openhab.binding.mqtt. But then nothing when the messages arrive
2017-09-21 00:45:20.224 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTING - org.openhab.binding.mqtt
2017-09-21 00:45:20.239 [DEBUG] [org.openhab.binding.mqtt            ] - BundleEvent STARTED - org.openhab.binding.mqtt
2017-09-21 00:45:20.256 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=199, service.id=331, service.bundleid=199, service.scope=bundle} - org.openhab.binding.mqtt
2017-09-21 00:45:20.264 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/*, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=200, service.id=333, service.bundleid=199, service.scope=bundle} - org.openhab.binding.mqtt
2017-09-21 00:45:20.269 [DEBUG] [org.openhab.binding.mqtt            ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=201, service.id=334, service.bundleid=199, service.scope=bundle} - org.openhab.binding.mqtt
  • the bindings are starting fine
openhab> bundle:list|grep -i MQ
197 | Active   |  80 | 1.10.0                 | openHAB Mqttitude Binding
198 | Active   |  80 | 1.10.0                 | openHAB MQTT Transport Bundle
199 | Active   |  80 | 1.10.0                 | openHAB MQTT Binding
  • I am using openhab 2.1.0 Release

Anyone have any ideas of next troubleshooting steps? I’ll have to start digging into the code otherwise, but would be nice if someone knows what I might be doing wrong. I’m surprised even with debug enabled mqtt binding isn’t printing out all the messages it receives, so wondering if maybe it’s not actually receiving the messages?


  • mqtt.cfg
  • owntrack.items
Switch  otrack_home      "otrack @ Home"   { mqttitude="otrack_mqtt:owntracks/libqqq/s8/event:home" }

Do you have any mqttitude.cfg ?

While home is not used in new-style event config, I (VERY) vaguely remember I still needed to set the home location in there for the thing to work. Just try.

And try to increase the log level to TRACE.

thanks, I did end up getting it to work, I was testing with the wrong topic. I think in the end it was the “share” flag on the region within the app that made it work. I do now see the messages under TRACE, thanks for your help. Seems to work fairly well.

Hi, I’m new to OH2 and I need help. I can not integrate owntracks in OH2. Could you please tell me where I get the data " id and device_id". I’ve been trying to configure it for two days. Thank you

That is the topic you have subsribed to on your mqtt broker.





If you are new to openHAB start with the simple stuff, this one is quite complex :sunglasses: