[SOLVED] MQTT 2.x thing with dual commandTopic (i.e. Sonoff Dual driven Rollershutter)?

Dear community,
I’m successfully rewriting my MQTT 1.x items to MQTT 2.x binding way - based on the excellent tutorial posted by Max @max-e-moose Sonoff Tasmota with MQTT Binding 2.4 (using config files) and the very detailed MQTT 2.x binding documentation (https://www.openhab.org/addons/bindings/mqtt.generic/).

All normal (switch, plug) things work like charm, however I’m stuck on rewriting my old Rollershutter items. Here an example how they look in MQTT 1.x:

// old.items
// Sonoff Dual [sonoff-D-bedroom-001]
Rollershutter Bedroom_Shutter "Bedroom shutter" (G_Bedroom, G_Shutter) {mqtt="
	>[mosquitto:cmnd/bedroom/shutter/POWER1:command:UP:1],
	>[mosquitto:cmnd/bedroom/shutter/POWER2:command:DOWN:1],
	>[mosquitto:cmnd/bedroom/shutter/POWER1:command:STOP:0],
	>[mosquitto:cmnd/bedroom/shutter/POWER2:command:STOP:0]
",
expire = "30s,command=STOP"
}

I tried defining the 2.x Thing like this by defining two same name rollershutter channels with different commandTopic(s):

// file.things
Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port="1883", secure=false, clientID="openHAB24" ]

Thing mqtt:topic:mosquitto:sonoff-D-bedroom-001 "sonoff-D-bedroom-001" (mqtt:broker:mosquitto) @ "Home" {
    Channels:
        Type rollershutter : shutter "Rollershutter" [ 
            commandTopic="cmnd/bedroom/shutter/POWER1", on="UP", off="STOP" 
        ]
        Type rollershutter : shutter "Rollershutter" [ 
            commandTopic="cmnd/bedroom/shutter/POWER2", on="DOWN", off="STOP" 
        ]        
}

and defining the Rollershutter item as follows:

// file.items
Rollershutter Bedroom_Shutter "Bedroom shutter" { channel="mqtt:topic:mosquitto:sonoff-D-bedroom-001:shutter" }

And this of course doesn’t work, since if I define 2 command topics like above - both of them fire when a sitemap button (up / down / stop) is pressed.

Does someone have a working MQTT 2.4 example of dual commandTopic rollershutter Thing/Item like in the typical 1.x example above? Is this possible at all in the current MQTT 2.x version?

Many thanks in advance!

No, mqtt-rollershutter was fixed yesterday. Stop, Up, Down commands were basically broken. So OH 2.5M2 is the earliest “release” like build with that functionality.

In said release you would do commandTopic="cmnd/bedroom/shutter/POWER1", up="1", down="1" stop="0" (roughly, don’t know the exact argument names from mind).

Edit: I just realized that you use two command topics for one “subject”. That is not supported by mqtt2 unfortunately and I hesitate to introduce that for code complexity reasons.

For now I would continue to use mqtt1 for that specific item. Mid-term solution is the new OH 2.5 release and a changed mqtt topic structure on your tasmota.

Cheers, David

1 Like