when I force Owntracks to upload I get something like… {"_type":“location”,“tid”:“1”,“acc”:4,“batt”:21,“conn”:“w”,“lat”:52.116962,“lon”:-106.6635014,“t”:“u”,“tst”:1544681793,"_cp":true}
In Owntracks I have two regions set up, one is home and work
On the CloudMQTT website I can also see my connections from the Owntracks app, my mosquitto_sub command and the MQTT.fx applications I have running. I never see the connection Openhab.
I would like to use MQTT as I also wanted to install some other wifi door status switches that also used MQTT. Any other help or error logs I can look at?
That is unrelated. You can use MQTT for your door switches and HTTP for owntracks.
Whatever that means (you don’t expect us to know what is in there by default, do you ?). You would need to properly configure that, too.
But mqttitude binding is now deprecated - use gpstracker as I suggested instead.
I will try out GPS tracker with HTTP as suggested. Are there any free options for remote host connections? If I use my local IP, I am only going to be able to use geofencing when I am at home connected to my local network.
Respone to mqqtitude
In mqttitude.cfg file the only configuration option it gives me are for lat/lon coordination and geofence distance, I am also not using manual mode. The documentation details that the broker configuration is completed in the MQTT binding.
Broker Configuration
First you will need to install and configure the MQTT binding. This will define the connection properties for your MQTT broker and specify the broker ID which we will need when configuring the Mqttitude item bindings.
services/mqttitude.cfg Config
You only need to define these properties in your services/mqttitude.cfg configuration file if you are using one or more ‘Manual Mode’ item bindings. In this mode you need to let the binding know exactly where ‘home’ is and the size of your geofence.
Here is an example;
# Optional. The lat/lon coordinates of 'home'
home.lat=xxx.xxxxx
home.lon=xxx.xxxxx
# Optional. Distance in metres from 'home' to be considered 'present'
geofence=100
Your MQTT config (mqtt.cfg) will need to look something like below.
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
broker.url=tcp://10.0.1.14:1883 (replace with your server IP address)
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>
# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false
# Optional. User id to authenticate with the broker.
broker.user=your_user_name
# Optional. Password to authenticate with the broker.
briker.pwd=1234
I have two users set up in cloudMQTT. One is for my phone, owntracks and one is for openhab.
I can see the connection from Owntracks on cloudMQTT. I can also see the other connections on cloudMQTT if I make them. For example using MQTT.fx program or if I run the mosquitto_sub command. I never see the connection from openhab though…
Is there a way to see if openhab is opening an MQTT connection or subscription?
If you are on openHAB 2.4 snapshot or milestone:
Just to be sure: You installed the MQTT 1.x binding from the legacy repository and not the binding that calls itself MQTT?
Looks good. You don’t need to reboot. The connection should be established as soon as the configuration file changes, actually. But you haven’t looked into the logs yet have you?
Yes, you can simply use myopenHAB.org! All you need to do is to use “https://home.myopenhab.org/gpstracker/owntracks/” as the “Host” parameter in OwnTracks and obviously you need to provide your credentials in “Identification” with it. No need to setup any MQTT broker or anything.
I got it to work. My issue was with the mqtt binding setup, I had multiple mqtt brokers defined for some reason. I believe it was caused by using the paper UI to install the mqtt binding and then editing the .cfg files over and over. When I would write the mqtt.cfg file I would get multiple broker initialization as if the mqtt broker was defined multiple times. The log looked something like this.
You can test your connection by defining an string item and putting this on your sitemap. Then when you get any updates from OwnTracks you can see the whole message received in openhab. This will work for any Owntracks messages that have the same topic i.e. “owntracks/phone/colephone”.
In Items
String ColeIsHere "Cole @ home [%s]" {mqtt="<[colesbroker:owntracks/phone/colephone:state:default]" }