MQTT connection error

I am getting this error
[.MqttBrokerConnectionServiceInstance] - MqttBroker connection configuration faulty: host : You need to provide a hostname/IP!

This is my mqtt.cfg. What am I doing wrong? I created this file using vi editor


Do you have MQTT binding 2.x installed or 1.x? mqtt.config can only be used in connection with the (legacy) 1.x binding. Check in PaperUI under Bindings which version you have installed.

1 Like

I have 2.4

You shouldn’t need the mqtt.cfg for the 2.x binding. BTW the cfg files are auto created when you install a binding that can be configured you should never have to create this yourself.

So use PaperUI to configure it, not a MQTT.cfg text file.

Delete the mqtt.cfg file, if you want to use text files then use the example below to create a things file. Change the names to suit your needs. The things below the Bridge are a sonoff basic with temp and humidity reading.


Bridge mqtt:broker:pibroker "pibroker" [ host="", port=1883, secure=false, username="your_name", password="your_password" ]
    // Sonoffs
    Thing topic sonoff11 "Sonoff11" @ "Living Room" {
        Type switch : power       "Power"         [ stateTopic="stat/sonoff11/POWER", commandTopic="cmnd/sonoff11/POWER" ]
        Type number : temperature "Temperature"   [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature" ]
        Type number : humidity    "Humidity"      [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity" ]

For the items file:

Switch LivingRoom_Light "Living Room Light" <light>  ["Lighting"] { channel="mqtt:topic:pibroker:sonoff11:power" }
Number LivingRoom_Light_Temp "Temperature [%.1f °F]"      <temp>             { channel="mqtt:topic:pibroker:sonoff11:temperature" }
Number LivingRoom_Light_Humidity    "Humidity [%.1f %%]"    <humidity>       { channel="mqtt:topic:pibroker:sonoff11:humidity" }

If your using something other than a sonoff or have questions about how to configure the file post what your using.

Thanks. Finally redid the entire installation and did using PaperUI and now it seems working. Thanks for the help.
Now let me start with more stuff than just a switch.
I want to do a water level monitor using ultrasonic sensor. Any useful project links?