Debug MQTT

Hello all, I what to debug MQTT, I entered the console “ssh openhab@localhost -p 8101” and executed the command log:set DEBUG org.openhab.binding.mqtt. Now I can see on the log the outbound messages to MQTT

2018-02-03 18:50:03.643 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:05.131 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:34.288 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:35.474 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:35.475 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:36.762 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to mygateway1-in/2/2/1/0/2
2018-02-03 18:50:36.763 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to mygateway1-in/2/2/1/0/2

But I cant see the inbound ones! How can I see them?

Thank You

Not sure what broker you have. I would use mosquitto_sub on your broker server:

mosquitto_sub -t home/#

This would start listening to all message at “home” and below. I don’t know what you use for a name scheme so home may not be right for you. You can sharpen your topic further such as home/livingroom/sensor1/# The “#” will take all messages at that level or below.

Lots more options for _sub in the man page:

That will show me the messages on the broker, but it dos not ensures me that is delivered to openhab.

I’m no MQTT expert but the way I understand it is you have to subscribe to get a message. So, unless you subscribe to an MQTT topic via an item, it won’t arrive at OH. If you do subscribe, you will see an item change or update event in the events log.

Point is, I would use mosquitto_sub to see if the proper messages are arriving/departing your broker and then work on why OH isn’t subscribed properly if applicable.

I have MQTT working on openhab, the problem is that some messages are not being processed, I would like to debug the inbound to try to understand if the problem is on Openhab or from other side!

OK, so you know your broker config in OH is correct. It is a question of item config or whatever sensor is sending data as it seems.

If you can confirm that the messages are at the broker with the sub client, and OH doesn’t do anything… it’s at OH… if it doesn’t show up at the broker… it’s the other side. I may be missing something about what you are doing but it seems pretty cut and dry to me.

As for better insight from OH’s side on incoming, I don’t think you are going to find anything. When you configure the broker in OH, it simply tells the addon where to point to when it subscribes or posts to a topic via items. Unless you have an item subscribed to a topic, you won’t get any traffic related to that topic at your OH broker instance as far as I understand.

Somebody else that knows it better can probably explain further. I think of it like subscribing to a mailing list. If you get your email wrong, it will never show up and since it is solicit only, your mail server never got a connection and is non the wiser that no message came. It’s not like a multicast or something… that’s more like the 3rd class fliers that come to your door… everybody gets it no matter who asked for it.