Mqtt 2.x Vs Mqtt 1

After few years of perfect work, today I tried to migrate my old MQTT configuration to the new 2.5.1 mqtt binding.
I found it very complicated, more than the 1.x version!
After few hours of work, everything is fine. But, with my great surprise, MQTT is VERY SLOW.
With 1.x immediatly after the command, the message was sent,
With 2.5.1 the message is sent after like 1.5 seconds. Not acceptable.
Fortunately after this test I brought back my precious backup.
I just tried that because with the future update of openhab 3 the compatibility with the 1.x bindings will be lost. I don’t know why and I think I will never update it!

1 Like

Is 2.5.2 any better?

With the information provided we don’t know why either. I’ve neither experienced myself nor seen reported on this forum any similar reports of MQTT 2 being slow.

If it is slow for sone reason for you and it’s the binding, it needs to be fixed. If it’s slow for you for some other reason, it’s likely going to be a problem with other bindings too.

Never tried the 1x mqtt binding.

But did exprience some slowness with mqtt 2x.

I only used openhab for the echocontrol binding (send strings to my homeseer installation) . Can’t say for sure if it was a dns issue… but maybe this is very similar to the issue I had ? Openhab in Docker vs Manual installation

Thanks for your reply, how can I give all the information needed to know if it is a binding problem? I don’t think that can be an hardware problem, because with Mqtt 1 everything is going fine with super fast response.
I have openhab installed on a Raspberry pi3, all updated to the last releases.
The hardware of the items are Esp8266 with relays (sonoff like, with my custom firmware)

Just as a reference, I see no slower behavior…

I recently migrated to OH2.5 on a Synology VMM (not the fastet machine) and I see no slower behavior of MQTT than with the 1.0v of the binding.
=> But I agree that the setup is complicated and if you have 100+ MQTT devices, I am unsure if the migration is worth it. With v1.0 I can change the config in a flat file , while for the 2.5.x version I need to do it one by one in the gui

Why don’t you keep v1.0 ? The only difference is that with V1.0 you can not create any THINGS but you are much more flexible in all other areas.

Things to test
Are you sure that it is a problem of the MQTT binding or of the MQTT server? Did you try to install a plain Mosquito instead of the integrated MQTT server?
=> I would first try to figure out where the problem lies.

1 Like

You could also configure your MQTT topics as things with channels in a .things file …

Ah many thanks… I will have a look into that then! I assume you mean with the 2.5.x version, because with v1.0 I was told this is not possible (please could you advice how, if you were able to do that?)

V1.x does not know anything about things and channels, soe yes, I was referring to 2.x.
If you search the forum for MQTT 2.5 things, you will find many examples how to do.
Unfortunately, I won’t be able to post my examples until toorrow, as I don’t have access to my server atm…

1 Like

I will try to again to migrate tomorrow, without uninstalling mosquitto and keep using it, instead installing moquette.

That product has been abandoned. Most everybody here using MQTT uses mosquitto.

Indeed, the embedded broker has problems and we don’t recommend its use. Try Mosquitto and see if the problem persists.

In addition to .things files, you can use the REST API to make this much simpler.

  1. Create 1 Thing using the GUI. This ensures you get the syntax right and everything is configured as needed.
  2. Using the REST API Docs query for that Thing. You will get back some JSON.
  3. Copy that JSON into Notepad or something and edit it to match what is needed for the other similar Things (e.g. usually just the topics and maybe the transformation). Make sure to change the Thing ID.
  4. Using the REST API Docs submit the edited JSON as a new Thing.

I did about 20 Things in about five minutes this way when I migrated.

This is a good approach for those who don’t want to use .things files, the syntax for which can be tricky to get right.

V1 bindings will not longer be supported in OH 3. V1 bindings do not support automatic discovery (the V2 binding will automatically discover devices that follow the Homie or Home Assistant topic standards). The V2 binding has a whole lot more flexibility in terms of transformation of the messages both before publishing and on subscription.

1 Like

OK guys, test completed successfully, with mosquitto everything works fast and good.
Thanks for all your replies and help.

P.s. maybe I’m not good at searching in google, but there isn’t any tutorial that explain how to migrate correctly, the only one I found was with the moquette broker

Here is one. There are several others on the forum.


Many thanks for this tipp. I was not aware about the REST API and was just about to write all by hand.
=> Will will try that and I am sure it is much more effective!

Sorry to ask, you do have not per chance still your REST API at hand, which you used to query? I am in the documentation now and try to find it out, but maybe you kept it and have it at hand?
(for the others, as soon I found it out, how to do, I will paste it here for the others)

Install the REST API Docs (UIs tab in PaperUI). You want to get a Thing. So go down to “things” and click on it. Then click on the line that says “Gets a thing by UID.” Put the UID into the field and click “Try it out!”. That will give you the result and tell you the equivalent curl command.

The whole point of the REST API Docs is you shouldn’t have to ask this question. It’s all right there in front of you.

1 Like

Well the rest api, I did install and I did read the doc, but finding the syntax is try and error as the few examples do not really help. Finding the UID took me a while.

For those having the same issues (but I probably will stick to mqtt 1.0 till this is better solved)

  1. install the REST api under UI tab of your OH installation
  2. go:
    => now you search for the device you want to copy… you will find it several times
    => search for the UID, it looks like: mqtt:topic:aa295d8d
  3. then you do something like :

Next steps are not yet tested…
=> now it seems that you need to copy the JSON to a text editor and change it. Then you send it back as POST command to the REST.

But the JSON looks huge…


I personally will go try how to make a .things file and items file with MQTT.
=> I can not imagine that is much more complicated, than changing 100+ times this JSON file and then send a POST command. This might work for small installations
=> Once done I can save the flat files and if I have to migrate again, I just copy the files in (assuming that I do not want to restore a backup)

I might be mistaken and you need only a smaller JSON file, but creating a .thing for mqtt 2.5 seems to me better explained, than this path.

2 and 3 can be replaced with “browse to or search for the Thing in the Things menu of PaperUI. The Thing ID is right under the friendly name you gave the Thing.”


JSON always looks huge, but it come back better formatted than that and when you preserve the formatting it’s pretty obvious what you need to change.

  "statusInfo": {
    "status": "ONLINE",
    "statusDetail": "NONE"
  "editable": true,
  "label": "Back Door",
  "bridgeUID": "mqtt:broker:broker",
  "configuration": {},
  "properties": {},
  "UID": "mqtt:topic:backdoor",
  "thingTypeUID": "mqtt:topic",
  "channels": [
      "linkedItems": [
      "uid": "mqtt:topic:backdoor:state",
      "id": "state",
      "channelTypeUID": "mqtt:contact",
      "itemType": "Contact",
      "kind": "STATE",
      "label": "State",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "stateTopic": "entry_sensors/main/back_door"
  "location": "Family Room"

Given the above JSON, if I wanted to create a similar Thing for the front door I would change:

  • “label” - “Front Door”
  • “UID” - “mqtt:topic:frontdoor”
  • “stateTopic” - “entry_sensors/main/front_door”
  • “location” - “Entryway”

Everything else will either be ignored (e.g. Linked Items) or doesn’t need to be changed.

Copy the edits and paste them into the REST API docs:

Given the massive amounts of time spent by me and others on this forum helping users with simple syntax errors with their MQTT .things file syntax I disagree.

1 Like