OH2 and MQTT random responce

Hey Guys!

I am really new to this community and would need some guidelines.
I have installed openhabian on rasperry pi 3 + misquitto as MQTT broker.
.fx
I send data to OH2 via MQTT.fx and read it into Number.

Number BasementMonitor_Temp01 “Temperature [%.1f °C]” (gC_Furnace, gTemperature) {mqtt="<[brokerpi:mytemperature:state:default]"}

I created simple rule like MQTT echo. What I get I send back.

rule "Spremba stanja"
when Item BasementMonitor_Temp01 changed
then
publish(“brokerpi”, “Change”, BasementMonitor_Temp01.toString())

Now comes very strange problem.
Sometimes response is instant and sometimes it takes up to 10s that data is processed and echo is sent back.

Anyone knows what could be problem?

Hi all!

I found problem, maybe helps someone.

I changed my broker name in mqtt.cfg. That caused that OH2 remembered old broker and connect to both and connection was lost all the the time.

Solution:

In file \openhab2-userdata\config\org\openhab\mqtt.config
delete all items except your correct broker.

brokerA.async="true"
brokerAclientId="openhab"
brokerA.qos="1"
brokerA.retain="true"
brokerA.url=“tcp://localhost:1883”

brokerB.async="true"
brokerBclientId="openhab"
brokerB.qos="1"
brokerB.retain="true"
brokerB.url="tcp://localhost:1883"
service.pid=“org.openhab.mqtt”