[SOLVED] Mqtt items not publishing to the broker

i am using openhab on a raspberry pi
i just upgraded the system and suddenly the mqtt items stopped working i read on some threads that a fresh install will help but it still does not work

my esp8266 is able to publish messages to the broker but openhab is not able to publish

i did sudo nano /etc/openhab2/services/mqtt.cfg after i installed the mqtt binding but the file was empty so i copied the content from a github page


# 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


# Optional. Client id (max 23 chars) to use when connecting to the broker.

# If not provided a default one is generated.


# Optional. User id to authenticate with the broker.


# Optional. Password to authenticate with the broker.


# Optional. Set the quality of service level for sending messages to this broker.

# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2

# (Deliver exactly once). Defaults to 0.


# Optional. True or false. Defines if the broker should retain the messages sent to

# it. Defaults to false.


# Optional. True or false. Defines if messages are published asynchronously or

# synchronously. Defaults to true.


# Optional. Defines the last will and testament that is sent when this client goes offline

# Format: topic:message:qos:retained <br/>

#<broker>.lwt=<last will definition>

But no luck i have no idea what is going wrong here

my items file


DateTime Time "Time [%1$tH:%1$tM]" <time> { channel="ntp:ntp:demo:dateTime" }

DateTime Date "Date [%1$tA, %1$td.%1$tm.%1$tY]" <calendar> { channel="ntp:ntp:demo:dateTime" }



Switch roomlight "Room Light" <light> [ "Lighting" ]{mqtt=">[broker:Sam_Room/lights/main/roomlight:command:ON:1],>[broker:sam_room/lights/main/roomlight:command:OFF:0]"}

Switch test "Test" <light>



Switch roomfan "Fan" <fan_ceiling> [ "Switchable" ] {mqtt=">[broker:Sam_Room/fans/roomfan:command:ON:1],>[broker:sam_room/fans/roomfan:command:OFF:0]"}



Number Temperature "Room temperature [%.1f °C]" <temperature> {mqtt="<[broker:sam_room/temperature:state:default]"}

Number Humidity "Humidity [%.1f%%]" <humidity> {mqtt="<[broker:sam_room/humidity:state:default]"}

//RGB LED Strip Control


Group roomledrgbGroup "Light RGB" (All)

//Room LED Strip

Color roomledrgbColor "Light RGB" <colorpicker> (roomledrgbGroup) ["Lighting"]

String roomledrgbString (roomledrgbGroup) {mqtt=">[broker:sam_room/lights/rgb/roomledrgb:command:*:default]"}

am i missing something or did i do something wrong please guide me

A quick search on the forum would have turned up lots of answers
First one being:


1 Like

I can sympathise.

I also had MQTT up and running. As beginner I found the available information confusing but somehow I got it working, wrote few notes and then forgot about it. It ran fine for many months until I had to resinstall everything from scratch. Then I found my notes were not all that great!

The fresh openhabian image and subsequent quite complex set up went very well and I was very pleased with myself, that is until I got to the MQTT stuff; which now frustratingly refused to work anymore despite appearing to be quite simple to set up. I spent nearly a day trying to fix this last little problem with my fresh install.

Then at some point I realised that there are two versions and these are quite different to set up. What made it worse for my confusion is that v1 is still quite popular and there are many posts relating to v1 which appear very high in google searches. v2 doesn’t come up as much. >>>> ha ha moment.

So now I knew what to look for in the various posts. Is it v1 or v2 they are talking about.

I actually had orginally installed v1 (items and cfg) but in the fresh install PaperUI v2 binding was the easier to find. So I ended up with v2 binding installed but with v1 items definitions. To get v1 you have to first select legacy binding option in PaperUI system settings. Doh!!! It didn’t help that no error messages in the log warned me about the mix up. My v1 style items just appeared dead and lifeless.

FYI I also found v1 and v2 can run alongside each other so you can play around with v2 while keeping the old v1 stuff up and running.

So, I will at some point move my now working v1 setup over to v2 ( Things with channels and items config files) and will post a short beginners guide to the key differences. Hopefully its easy to find and features high in a google search :slight_smile:
For items in the items file

channel =

… is v2 style and

mqtt =

…is v1 style

v1 uses a MQTT.cfg and items file

v2 uses Things, Channels and linked items.

My first noob impression was that v1 seems easier to get going with.


@vzorglub really sorry man i found no solutions on the forum maybe i did not search properly i will definitely look at the forums properly the next time before opening a new issue. @m4rk Thank you soo much i really appreciate it you are a lifesaver