MQTTitude & Hosted Owntracks


I am struggling with the config for Hosted Owntracks. The Owntracks app on my iPhone sends push notifications when I leave and enter my home but Openhab never receives them. I have included a part of my openhab.cfg, a part of my items file and relevant log file entries.

items between <> have been replaced

config file:

items file:
{ mqttitude="owntracks:owntracks/<account>/<device>/event:<regiononiphone>" }

log file:
2015-12-14 15:46:07.562 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection ‘owntracks’
2015-12-14 15:46:07.564 [DEBUG] [o.i.t.m.i.MqttBrokerConnection] - Creating new client for ‘ssl://’ using id ‘root.1450104367564’ and file store ‘/tmp/owntracks’

2015-12-14 15:46:39.275 [DEBUG] [.m.internal.MqttitudeActivator] - Mqttitude binding has been started.
2015-12-14 15:46:39.307 [DEBUG] [i.internal.GenericItemProvider] - Start processing binding configuration of Item ‘at_home_ot (Type=SwitchItem, State=Uninitialized)’ with ‘MqttitudeGenericBindingProvider’ reader.
2015-12-14 15:46:39.324 [DEBUG] [.b.m.internal.MqttitudeBinding] - Registering Mqttitude consumer for owntracks/< account>/< device>/event (on owntracks)
2015-12-14 15:46:39.326 [DEBUG] [o.i.t.m.i.MqttBrokerConnection] - Starting message consumer for broker ‘owntracks’ on topic ‘owntracks/< account>/< device>/event’
2015-12-14 15:46:39.416 [DEBUG] [.b.m.internal.MqttitudeBinding] - Activating Mqttitude binding

Just to confirm, you need to use your account token for authentication, not your Owntracks hosted account password. Can you try subscribing to the Owntracks hosted broker using mosquitto_sub just to ensure you are successfully able to connect and receive messages?

Hi Ben,
Yes I use the token, but I can’t get mosquitto_sub working.

Ok - so if I were you I would focus on getting something simple like mosquitto_sub working before worrying too much about openHAB. What error do you get when trying to connect using mosquitto_sub?

Hi Ben,
There was an old mqtt client on my openhab server (with lousy tls support), I managed to update it and now mosquitto_sub works, how to I add the tls/certificate file to the openhab config or is that not necessary ?

I typically configure mosquitto to only require TLS certificates for external connections (i.e. port 8883). And since openHAB is a local connection it doesn’t require any certificate. Otherwise check the MQTT binding WIKI page for details on how to set this up.

That is the problem Ben, I am using hosted owntracks (remotely) at and they require 8883 and tls, nothing to be found on the binding page about certificates.

Ah I see, sorry Vincent I got a little lost there. Yep I don’t believe the MQTT binding supports TLS certificates. But I think you should be able to connect to Owntracks hosted without? Although I am not certain.

Die you geht this to Run?
I’m having the same question…

Nope :sleepy:

What is the use of hosted if we can’t use it right ? Will look further soon, if you find something let me know, I will do the same.


FYI - hosted is there for OwnTracks app users - maintained by the OwnTracks guys. The Mqttitude binding for openHAB was written (by me) to allow openHAB to using the OwnTracks app for presence detection. It was written well before the hosted stuff was setup and in the beginning was designed to be run on a local MQTT broker (for your own privacy).

Feel free to make changes to the Mqttitude binding to add support for TLS etc.

[quote=“ben_jones12, post:11, topic:5075, full:true”]
… was designed to be run on a local MQTT broker (for your own privacy).[/quote]

And this works great. Use mosquitto as your broker, you can even install it on the same machine as openhab.

don’t get me wrong - I’m not complaining. It is more the question if I’m to stupid to get it working :wink:
If hosted opwntracks is not supported at the moment then I know that I’m not doing something wrong…

Ben a BIG thankyou for the work on the Mqttitude binding, just got it working with a couple of geofences and it is fantastic!

I thought about running it in the hosted mode but it didn’t (wasn’t) seem that hard to set it up on a local version of mosquitto with dynamic dns on the router and port forwarded.

Whats even better is I can use the mosquitto install for a heap of other ideas that have just sprang to mind.


Yep running your own MQTT broker opens up a world of possibilities! Check out mqttwarn, it is a wonderful script that works really well with openHAB and allows you to decouple all your notifications from your rules. You just create a set of items for different notification levels, I.e. trace, info, warn, alarm, and bind them to individual MQTT topics. Then set mqttwarn to monitor these and let it handle all your notifications, e.g. email, syslog, pushover, xbmc, slack, whatever you like.

Makes it very easy if you want to add or remove a device from notifications, or add a new notification channel, you just update mqttwarn instead of a load of openhab rules.

Hi @ben_jones12, i’ve posted in other post ( but still no luck at all. Maybe you could help me out…

I’m having trouble with OpenHAB to update an item in the Sitemap; i defined a Switch to do that.
Should i set in mosquitto every single “location” as i set my “home” location?
I would like to use it as “Region Mode” as it says in the Wiki, but:

  • if i don’t set the “home” location there are Log Errors (see my other post)
  • mosquitto receives updates OK from the OwnTracks app (Android)
  • the App seems to do a Location update when i unlock the phone, or enter the App…and seems different in Ios than Android…not fully convinced with it
  • i believe the app OwnTracks doesn’t make updates when i’m moving, i’m missing events (enter, leave)…i suppose that is because the phone stays “sleeping”…?
  • mosquitto and openhab in the same computer


2016-03-11 10:59:41.397 [TRACE] [b.m.internal.MqttitudeConsumer] - Checking item LG_work...
2016-03-11 10:59:41.398 [TRACE] [b.m.internal.MqttitudeConsumer] - Not a location enter/leave event, ignoring
2016-03-11 10:59:41.398 [TRACE] [b.m.internal.MqttitudeConsumer] - Checking item LG_work2...
2016-03-11 10:59:41.399 [TRACE] [b.m.internal.MqttitudeConsumer] - Location received for LG_work2: Lat: -XX.XXX03, Long: -XX.XXX033
2016-03-11 10:59:41.399 [DEBUG] [b.m.internal.MqttitudeConsumer] - LG_work2 is outside the 'home' geofence (4628.492730344677m)
2016-03-11 10:59:41.400 [TRACE] [b.m.internal.MqttitudeConsumer] - Checking item LG_home...
2016-03-11 10:59:41.400 [TRACE] [b.m.internal.MqttitudeConsumer] - Not a location enter/leave event, ignoring


ITEMS (testing):

Switch Maxiofi      "Maxi ofi"    (gofi)
Switch LG_work      "Maxi Tra"       (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG:work" }
Switch LG_work2     "Maxi CelLG topic CelLG"        (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG" }
Switch LG_work3     "Maxi Tra3 Eventter"  (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG/event:enter" }
Switch LG_work4     "Maxi Tra4 Event Leave"  (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG/event:leave" }
Switch LG_home      "Maxi Casa"          (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG:casa" }


                Switch item=LG_work
                Switch item=LG_work2
                Switch item=LG_work3
                Switch item=LG_work4
                Switch item=LG_home

Have you read the WIKI?

When using region mode the region_description must match the region name in the Owntracks app. Unless you have regions named enter and leave your items LG_work3 and LG_work4 will never fire.

Of course you are right :wink: and i read it yes, maybe faster than i should and did so much tests i messed up

Right now, i redefined items 3 and 4:

Switch LG_3     "Maxi Event Home"       (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG/event:home" }
Switch LG_4     "Maxi Event Work"       (All)   { mqttitude="mosquitto:owntracks/maxi_OT/CelLG/event:work" }

If i want LG_4 switching: should i define the “work” in openhab.cfg as i did with “home”?
(remember i’m testing, i don’t need to execute nothing at my house when i reach “work”)

I suppose i don’t have to, but also defining “home” says it is optional, and i was getting errors until i defined it in openhab.cfg

my other Test items are:

Switch LG_0     "Maxi Home"   (All) { mqttitude="mosquitto:owntracks/maxi_OT/CelLG:home" }
Switch LG_1     "Maxi Work"   (All) { mqttitude="mosquitto:owntracks/maxi_OT/CelLG:work" }
Switch LG_2     "Maxi CelLG"  (All) { mqttitude="mosquitto:owntracks/maxi_OT/CelLG" }

The few Transitions i saw were published to topic owntracks/maxi_OT/CelLG/event
so i suppose the only Item firing up will be LG_3 when leaving or entering “home”…? i think i will test that with an email Rule…

And also i see many messages to topic owntracks/maxi_OT/CelLG (type location)

thanks for your feedback!!!