Mosquitto/OwnTracks and SendMail

I’m setting back up Mosquitto and Owntracks and think so far I have it all correct since I did once in the past about a year ago.

I have Mosquitto installed and running and can connect to it and see my phone posting updates to it.

Now, I’m trying to figure how (if possibly) to have OH2 send an email/notification when someone leaves a certain area, particularly either leaves home. Or leaves work.

I have MQTT and Owntracks/MQTTitude bindings installed and have their xxx.cfg configs I believe properly. No errors in my logs. And I added my home long/lat int the mqtttitude cfg as well and have also set regions for both home and work on my phone.

I think next steps is first adding item definitions to OH2. But that is both a little foggy on the right steps/syntax. And then next trying to figure out how create a rule to send mail or notification when you leave a geofence area, particularly when you leave work.

I’ll be working on this more tonight and this week. But if anyone has already done this with some sample info, that would be helpful as well.


I wanted to circle back and possible ask for a little help here. I think i have everything set up correctly, but can not get a Switch Item to toggle ON | OFF when leaving a region… to eventually work in a rule to send a an email or notification.

Mosquitto and Owntracks is working. I can see my location updating on Mosquitto and in the OwnTracks Android app.

I have the MQTT binding installed and appears to be working. No Errors in my logs.

And I also installed the Mqqtitude binding as well. In this xxx.cfg file, I have NOT set my home long and lat though.

Within the Owntracks android App, I have a a ‘home’ and ‘work’ region set. Per owntracks, my device id is: owntracks/ptmuldoon/s6edgeplus

In my Items file I have tried with both with and without the device (ie s6edgeplus) as follows. But I can not get these switches to toggle when leaving a region.

/* Mosquitto Items */
Switch  PresencePaul_PhoneMqttHome   "Paul @ Home"   { mqttitude="mosquitto:owntracks/ptmuldoon/s6edgeplus/event:home" }
Switch  PresencePaul_PhoneMqttWork   "Paul @ Work"   { mqttitude="mosquitto:owntracks/ptmuldoon/s6edgeplus/event:work" }

Switch  PresencePaul_PhoneMqttHome2   "Test2 @ Home"   { mqttitude="mosquitto:owntracks/ptmuldoon/event:home" }
Switch  PresencePaul_PhoneMqttWork2   "Test2 @ Work"   { mqttitude="mosquitto:owntracks/ptmuldoon/event:work" }

Should the switches be updating automatically? I guess i’m confused on how mosquitto is talking with Owntracks? Perhaps I need to subscribe OH2 to the mosquitto broker? But I didn’t see any steps indicating that?

Try these:

/* Mosquitto Items */
Switch  PresencePaul_PhoneMqttHome   "Paul @ Home"   { mqttitude="mosquitto:/owntracks/ptmuldoon/s6edgeplus/event:home" }
Switch  PresencePaul_PhoneMqttWork   "Paul @ Work"   { mqttitude="mosquitto:/owntracks/ptmuldoon/s6edgeplus/event:work" }
Switch  PresencePaul_PhoneMqttHome2   "Test2 @ Home"   { mqttitude="mosquitto:/owntracks/ptmuldoon/event:home" }
Switch  PresencePaul_PhoneMqttWork2   "Test2 @ Work"   { mqttitude="mosquitto:/owntracks/ptmuldoon/event:work" }

Note the leading / of the mosquitto address.