[Solved] Need HELP! OpenHab It does not receive or send data MQTT

Hello, friends!
I need your help!
My OpenAB does not want to send commands to my Mosquitto.
MQTT working - Check MQTT spy. + Arduino

Openhab also connects to mqtt without errors!

Here are the settings

################################# MQTT Transport ######################################

mqtt:mosquitto.url=tcp://<myip>:1883
eventbus:broker=mosquitto
mqtt-eventbus:commandPublishTopic=/myhome/in/${item}/command
mqtt-eventbus:statePublishTopic=/myhome/state/${item}/state
mqtt-eventbus:stateSubscribeTopic=/myhome/out/${item}/state

An example of this writing

Switch Light_My_room_Ceiling “Верхний свет” (house_My_room, Lights, Status) { mqtt=">[mosquitto:/myhome/Light_My_room_Ceiling/command:command:on:ON],>[mosquitto:/myhome/Light_My_room_Ceiling/command:command:off:OFF],<[mosquitto:/myhome/Light_My_room_Ceiling/state:state:default]" }

And the mosquitto does not receive the command!

What could be the problem?

OpenHab + Mosqitto. win8 (x86) mini pc wintel

It might not be matching against the lower case commands. Could you try the below?

Switch Light_My_room_Ceiling 	"Верхний свет" 		(house_My_room, Lights,  Status) { mqtt=">[mosquitto:/myhome/Light_My_room_Ceiling/command:command:ON:ON],>[mosquitto:/myhome/Light_My_room_Ceiling/command:command:OFF:OFF],<[mosquitto:/myhome/Light_My_room_Ceiling/state:state:default]"     }

Thanks for the answer!
But then the error on the side of openhab.
Today I wrote a arduino sketch for temperature sensors ds18b20
Opened the mosquito. cmd… bla… bla… bla… mosquitto -v
Opened MQTT spy
These are !!! Working!!!

Mosquitto shows that openhab connected. There is a ping!

A openhab no data! :frowning:

I do not understand what’s the problem !?
I’m an idiot? :smile:

Did you look at these examples? If you used Daniel’s example exactly, please consider changing it to

Switch Light_My_room_Ceiling 	"Верхний свет" 		(house_My_room, Lights,  Status) { mqtt=">[mosquitto:/myhome/Light_My_room_Ceiling/command:command:ON:on],>[mosquitto:/myhome/Light_My_room_Ceiling/command:command:OFF:off],<[mosquitto:/myhome/Light_My_room_Ceiling/state:state:default]"     }

and noting that ON is the command to match, and on is what is published in that case. Also note that you would have to publish ON or OFF from the other side so the switch can be updated properly, since you have default in the inbound item binding. Or change default to a transform.

I tried all the options!
Does not work!

Neither team of openhab mqtt does not go to mosquitto!
And do not come to openhab

For the second day I can not do anything ((((

I see you have partially set up the MQTT Event Bus binding, but unless you meant to do that, change

mqtt:mosquitto.url=tcp://<myip>:1883
eventbus:broker=mosquitto
mqtt-eventbus:commandPublishTopic=/myhome/in/${item}/command
mqtt-eventbus:statePublishTopic=/myhome/state/${item}/state
mqtt-eventbus:stateSubscribeTopic=/myhome/out/${item}/state

to

mqtt:mosquitto.url=tcp://<myip>:1883

(In other words, no need to specify anything beyond the broker URL.) So you are running the mosquitto broker on the machine at <myip> on port 1883, with no passwords or encryption on that port?

I tried only MQTT: mosquitto.url = TCP: //localhost:1883

Windows Firewall turned off.
Antivirus disabled.
Additionally, create a rule for port 8080 and 1883 (opened)
Checked CMD netstat -ano
Everything is fine!
1883 mosquito
8080 Java (openhab)

Black magic! :smile

I tried to put on her laptop openhab!
Win 7 x64

Write in the config MQTT: mosquitto.url = TCP: //192.168.0.103:1883
(192.168.0.103 ip pc mosqitto)

Start Openhab!
and I get an error
[ERROR] [.io.transport.mqtt.MqttService] - Error starting broker connection

Hm!!! New Bug!!!

read MQTT binding - Error starting broker connection

I tried to install the mosquito on the same laptop (Win 7 x64)
Test mosquitto. Work good.

Analog error
[ERROR] [.io.transport.mqtt.MqttService] - Error starting broker connection

It’s getting ridiculous. I set up a lot of time such systems as AMX, Creston, Lutron and more!
Familiar with many protocols.
And I can not adjust the MQTT ))))

Hi, Aleksandr!

I have the same problem! %-)

Mosquitto and MQTT Spy work fine! OpenHab connect to Mosquitto without errors - It is seen in the log files. It works on miniPC with Win10 32 bit

But I can not receive or transmit commands between OpenHab and Mosquitto!

Black magic! %-)))

Hello, friends!
The problem was solved by reinstalling version Openhab 1.8 to 1.7.1
Everything works perfectly!

It appears in version 1.8 has an unknown error !!!

Version Mosquitto 1.4.7

Thank you all for your help!

Alexander, thanks!
Downgrade to version 1.7.1 and MQTT works without problems!

What exactly did you downgrade?

Openhab 1.8 то 1.7.1

Thank you, Aleksandr. Is there any chance you could take the org.openhab.binding.mqtt-1.8.0.jar and use it on your openHAB 1.7.1 installation in place of org.openhab.binding.mqtt-1.7.1.jar to see if that breaks your configuration again? It would help in trying to isolate the nature of your issue, in hopes of allowing you to upgrade back to current.

I am not Alexander…
But I did an experiment

  1. Updated runtime from 1.7.1. to 1.8.0
    MQTT - works!

  2. And updated Add-on from org.openhab.binding.mqtt-1.7.1.jar to org.openhab.binding.mqtt-1.8.0.jar
    MQTT - works!

What was the problem do not understand…

1 Like

hi,
alexander

even i faced the same problems you faced to make the openhab send the mqtt messages so try to do the following

  1. check if you have copied the correct addons to the add-ons directory in the openhab runtime. in openhab ver 1.8 there are two mqtt addons one is named as org.openhab.actions.mqtt and one more named as org.openhab.binding.mqtt . note that you have to copy the bindings to the add ons folder in your runtime

  2. make sure you have your mqtt broker running and when you run openhab make sure that you see something getting connected in your broker window.

  3. in the openhab config file change the line under mqtt transport to
    mqtt:mybroker.url=tcp://localhost:1883
    in that make sure you define some name to the broker in openhab like i have defined as mybroker

try these things and atleast you will able to see the mqtt messages on your subscribe all window

You really saved my day! I was also suffering for hours as to why my messages were not sent from openHAB to my RPi through MQTT.
I installed the org.openhab.action.mqtt-1.8.3.jar file, but I was NOT aware there was also a second JAR file needed to get the feature working fine: org.openhab.binding.mqtt-1.8.3.jar.
I spent hours chasing an error which I thought was because of me in my scripts, but it was just a lacking JAR file.
A pity this is not mentioned in the openHAB documentation of the MQTT binding (here). Would have saved me hours of frustration…

PS: adding debug information in the logback.xml file (as is explained here) is/was also very useful!

You’re welcome! :slight_smile:

I have both .jar files but openhab is still not updating :frowning: someone help me

Have you followed the guidelines explained in the second link in my post above? When you add the debug lines in the logback.xml file, you should at least see if the MQTT binding is fine and if the subscription is done properly.
By the way, that whole message thread is worth reading. It learned me a lot on how to try to tackle down the problems I faced with MQTT.