dakhnod
(Daniel Dakhno)
January 13, 2019, 12:51pm
1
taken the following example from [https://www.openhab.org/addons/bindings/mqtt.generic/ ]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?
vzorglub
(Vincent Regaud)
January 13, 2019, 1:36pm
2
First, please use code fences, thanks
We all have to type this content over and over and over. Here is a posting we can all point to when the topic comes up.
Why use code fences?
Because rules, sitemap, logs, and configs are all but unreadable when code fences are not used.
When to use code fences?
Whenever one is posting any sort of code, config, log, and any text where line wrapping, indentation, and using an equal spaced font makes the text more legible.
How to use code fences?
Use 3 backticks (```)...
Or use <code>...
…
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: MQTT Things and Channels - Bindings | openHAB but I have just submitted a PR to add it.
dakhnod
(Daniel Dakhno)
January 13, 2019, 1:46pm
3
Hi, thanks for the quick answer!
The code fences, however, still do not seem represent the correct intendation.
Any way to archieve that?
vzorglub
(Vincent Regaud)
January 13, 2019, 1:49pm
4
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
vzorglub
(Vincent Regaud)
January 13, 2019, 1:49pm
5
Please tick the solution post, thanks