MQTT Binding can't work

Hello everyone!

I just use *.things file to config an Bridge, but it seem like i can’t create and MQTT Broker
Here my config

Bridge mqtt:broker:hivemqbroker [ host=“localhost”, secure=false ]
{
Thing topic nodemcu
{
Channels:
Type switch : fan [stateTopic=“fan/state”, on=“ON”, off=“OFF”, commandTopic=“fan/command”, on=“ON”, off=“OFF”]
Type dimmer : slide3 [ stateTopic=“pressure/state”, on=“enable”, off=“disable”, commandTopic=“pressure/command”, on=“enable”, off=“disable”]
Type number : temperature3 [ stateTopic=“temperature/state” ]
}
}

I have already created a Thing and a Broker, but its status is OFFLINE

In events.log, i got:

2020-03-24 15:37:51.739 [hingStatusInfoChangedEvent] - ‘mqtt:broker:hivemqbroker’ changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:1883
2020-03-24 15:38:49.737 [hingStatusInfoChangedEvent] - ‘mqtt:broker:hivemqbroker’ changed from OFFLINE (COMMUNICATION_ERROR): io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:1883 to OFFLINE
2020-03-24 15:38:51.747 [hingStatusInfoChangedEvent] - ‘mqtt:broker:hivemqbroker’ changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:1883
2020-03-24 15:39:49.746 [hingStatusInfoChangedEvent] - ‘mqtt:broker:hivemqbroker’ changed from OFFLINE (COMMUNICATION_ERROR): io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:1883 to OFFLINE
2020-03-24 15:39:51.756 [hingStatusInfoChangedEvent] - ‘mqtt:broker:hivemqbroker’ changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:1883

I have read all topic, but still can’t find the solution
Someone help me please

Welcome to the openHAB Community @khiemnt00 :heart:

Why do you create the bridge via. a *.thing file and not via PaperUI?
You can try adding the bridge via PaperUI and see if it works, then you know for sure there is something wrong in your *.thing file.

2 Likes

I have just created a thing via PaperUI

and i got the same error :frowning:

Message is “connection refused to localhost/127.0.0.1:1883”
I assume you did not type that as a hostname and it just displays it like that.

This would tell me your have no running mqtt broker on localhost or your user/password is wrong.

Have you actually installed an MQTT broker somewhere?
This is a completely separate service to openHAB’s MQTT binding.

1 Like

@khiemnt00 How did you install OH? If you used openhabian image then use the openhabian-config tool to install mosquitto broker. If you didn’t use then image you can still install openhabian on Linux system just follow the instructions in the link below.

2 Likes

Oh, I’ve just followed some instruction on Youtube, and they can create an internal MQTT broker without install any thing.
Hmm, It seem like i need to install and use Mosquitto broker.
Many thanks for the help !

I don’t follow much on YouTube but last I checked most videos were outdated so best to follow the official documentation and if you hit a snag ask for help here.

If following the instruction above gets your binding working then please click the square box on post that provided the solution to mark the topic as solved.

Thanks

2 Likes

I’ll try it, thank you!

I install Mosquitto and it works now !

Thanks all !