Recently migrated to OpenHab 3.0.2. My MQTT devices expect the command to be a 0 or 1 not on or off. In the previous version I had my items setup like this.
Switch pond_heater “Pond Heater” (all) [ “Lighting” ] {mqtt=">[broker:/PondCont/gpio/12:command:on:1],>[broker:/PondCont/gpio/12:command:off:0]"}
Switch pond_lamp “Pond Lamp” (all) [ “Lighting” ] {mqtt=">[broker:/PondCont/gpio/05:command:on:1],>[broker:/PondCont/gpio/05:command:off:0]"}
That worked great but in 3.1 its sending ON or OFF
I have created a new item with a MAP profile and a map file with this per the example
cat …/transform/bin.map
key=value
1=ON
0=OFF
ON=1
OFF=0
=default
After this it still sends ON or OFF I also tried adding various combinations of 1=ON, 0=OFF to the channel configuration in the GUI and still getting on or of sent to the topic.
openHAB 3.0.2 Mosquito broker PI 4.
You are using MQTT Binding V1 syntax, which OH3 can no longer use. You must move over to using the OH2/3 MQTT syntax. See this to convert:
## Examples
Have a look at the following textual examples.
### A broker Thing with a Generic MQTT Thing and a few channels
demo1.things:
```xtend
Bridge mqtt:broker:myUnsecureBroker [ host="192.168.0.42", secure=false ]
{
Thing topic mything {
Channels:
Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
Type string : alarmpanel "Alarm system" [ stateTopic="alarm/panel/state", commandTopic="alarm/panel/set", allowedStates="ARMED_HOME,ARMED_AWAY,UNARMED" ]
Type color : lampcolor "Kitchen Lamp color" [ stateTopic="lamp/color", commandTopic="lamp/color/set", rgb=true ]
Type dimmer : blind "Blind" [ stateTopic="blind/state", commandTopic="blind/set", min=0, max=5, step=1 ]
}
This file has been truncated. show original
If this is not the case please show us your Thing and Item configurations.
1 Like
hafniumzinc:
Bridge mqtt:broker:myUnsecureBroker [ host="192.168.0.42", secure=false ]
{
Thing topic mything {
Channels:
Type switch : lamp "Kitchen Lamp" [ stateTopic="lamp/enabled", commandTopic="lamp/enabled/set" ]
Type switch : fancylamp "Fancy Lamp" [ stateTopic="fancy/lamp/state", commandTopic="fancy/lamp/command", on="i-am-on", off="i-am-off" ]
Thank you that seemed to work.
Infeus
(Oleksii Biatets)
May 13, 2021, 12:20pm
4
HI
Do you mean need to add - on=“i-am-on”, off="i-am-off?