Hi!
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.
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:
- No home configuration in
services/mqttitude.cfg
- A home configuration in
services/mqttitude.cfg
but using a WayPoint/Region from OwnTracks (the item confiuration specifies the name of the WayPoint) - Using the home configuration in the
services/mqttitude.cfg
(the item configuration was altered - see the commented line below initems/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.
services/addons.cfg
binding = mqtt1,mqttitude1
services/mqtt.cfg
mqttloc.url=tcp://XXXX.cloudmqtt.com:XYZXYZ
mqttloc.clientId=openhab
mqttloc.user=XYZXYZ
mqttloc.pwd=XYZXYZ
mqttloc.qos=1
services/mqttitude.cfg
home.lat=XX.XXXXXXXXX
home.lon=YY.YYYYYYYYY
geofence=15
items/XYZ.items
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" }
Log
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)
Bundles
The bundles installed according to the Karaf console is:
207 | Active | 80 | 1.9.0.201701160210 | openHAB MQTT Binding
208 | Active | 80 | 1.9.0.201701160210 | openHAB MQTT Transport Bundle
214 | Active | 80 | 1.9.0.201701160210 | openHAB Mqttitude Binding
215 | Active | 80 | 1.9.0.201701160210 | openHAB Mqtt Action