[SOLVED] MQTT 2.x inbound command

Tags: #<Tag:0x00007fc3ecab6730> #<Tag:0x00007fc3ecab6578>

taken the following example from [https://www.openhab.org/addons/bindings/mqtt.generic/]:frowning:https://www.openhab.org/addons/bindings/mqtt.generic/)

Bridge mqtt:broker:myUnsecureBroker [ host=“192.168.0.42”, secure=false ]
{
Thing topic mything {
Channels:
Type string : alarmpanel “Alarm system” [ stateTopic=“alarm/panel/state”,
commandTopic=“alarm/panel/set” ]
}
}

the alarmpanel channel can receive commands, which it will post to the commandTopic topic, equivalent to outbound messages in the 1.x binding.
The other way around, each message received through the stateTopic topic will become the things state.

To my question: is there any way to get inbound MQTT messages to get send as a command to the thing instead of becoming its state?

First, please use code fences, thanks

Bridge mqtt:broker:myUnsecureBroker [ host="192.168.0.42", secure=false ]
{
    Thing topic mything {
    Channels:
        Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set" ]
}
}

Yes:
Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", postCommand="true" ]

PS: This is not yet documented in: https://www.openhab.org/addons/bindings/mqtt.generic/ but I have just submitted a PR to add it.

Hi, thanks for the quick answer!

The code fences, however, still do not seem represent the correct intendation.
Any way to archieve that?

Yes edit by hand
Once you posted without the code fences the only way is by hand or delete the code and paste it again from the original in new code fences

Please tick the solution post, thanks