Openhab2 MQTT issues using UI

Hi There. I am stuck

I have installed openhab 2 on a raspberry pi with openhabian. Everything is running fine. I also have Mosquitto MQTT installed.

I then added a sonoff wifi relay and its connected to Mosquitto MQTT.

When I publish a topic directly using terminal to the queue, my relay works perfectly. this is the command
mosquitto_pub -r -t /relay/newsonoff1 -m “0”

I then add a sitemap, and have an switch item setup using a itme file usiong this command
Switch Sonoff {mqtt="<[mosquitto:/relay/newsonoff1:state:MAP(],>[mosquitto:/relay/newsonoff1:command:ON:1],>[mosquitto:/relay/newsonoff1:command:OFF:0]"}

The switch appears in the Basic UI.
When I toggle the switch using the UI, it doesnt always publish the command to the queue.
When I listen to the topic in Mosquitto, it would work 4 times, and then it doesnt work for 10 times, then work 4 times again.

Can anybody please help me

same problem here: tried with the stable release and with that last snapshot.
Openhab2 is always reconnecting to mosquitto and doing this it’s loosing commands and reliability.

Have you solved this problem?


Hi There.
I solved it yes. I had two different things connecting to MQTT using the same client id. This resulted in one always being dumped. By giving each device, system unique id, the problem dissapeared