[SOLVED] MQTT State/Command Topic

Hi OpenHAB Forum,

I am currently trying to set up a MQTT switch through the Paper UI (OH2.5) and I have the problem that I can update the command topic and switch my device, but I don’t receive an update through the state topic when I send the command from a different program:

I have a state/topic and command/topic and the payload {"val":"1"} or {"val":"0"}. When I update the command topic to 0, I can see the state topic update to 0 shortly afterwards. But the switch on the paper UI does not reflect this change.

I added the JSONPATH transformation later for incoming messages - as I thought the switch might need the 1/0 value directly. But so far no success.

Does someone have an idea what I am doing wrong?

regards

Mike

Turn the binding and debug mode and show the log when your send a payload on this topic from another MQTT client

@mpol
Are you using 2.5RC1? If so there is a problem with the MQTT

2 Likes

Thank your for your replies vzorglub and David!

This solved my issue - it works now :grinning:

pi@raspberrypi:/var/log/openhab2 $ dpkg --list | grep openhab
ii  openhab2                       2.5.0~RC1-1                         all          openhab2
pi@raspberrypi:/var/log/openhab2 $ openhab-cli console

Logging in as openhab
Password:  

                          __  _____    ____      
  ____  ____  ___  ____  / / / /   |  / __ )     
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
    /_/                        2.5.0.RC1
                               Milestone Build   

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> bundle:update org.openhab.core.io.transport.mqtt https://janessa.me/esh/org.openhab.core.io.transport.mqtt-2.5.0-fs.jar
openhab> logout
pi@raspberrypi:/var/log/openhab2 $ sudo systemctl restart openhab2
pi@raspberrypi:/var/log/openhab2 $ sudo systemctl status openhab2
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)   Active: active (running) since Thu 2019-12-12 11:10:45 GMT; 17s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
 Main PID: 3240 (java)
    Tasks: 29 (limit: 2200)
   Memory: 78.1M
   CGroup: /system.slice/openhab2.service
           └─3240 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openha
Dec 12 11:10:45 raspberrypi systemd[1]: Started openHAB 2 - empowering the smart home.
lines 1-12/12 (END)

I am facing the same issue with a switch in papeUI in openhab3 I could not find a solution can you explain what solved the issue

Hi @Rajiv_Dey

I tested the latest version of the OH3 docker container today and the MQTT binding worked perfectly.

  1. I created an MQTT Thing and added a channel:

  1. Choose an ON/OFF Switch:

  1. And added the STATE and COMMAND topic:

Linked to an item it worked right away.