Rollershutter Item with MQTT commands

Hi there,

I try to integrate Dooya Rollershutters into openhab2. The motors are connected via 433MHz to a fhem installation with nanoCul Signalduino. From openhab I control them via “generic mqtt thing” (mosquitto Broker) with the following channels:

up: set/fhem/Rolladen_Wohnzimmer/on
down: set/fhem/Rolladen_Wohnzimmer/off
stop: set/fhem/Rolladen_Wohnzimmer/stop

state: state/fhem/Rolladen_Wohnzimmer/state

It works with 3 switch channels in the thing connected to switches in the sitemap, but that doesn’t look nice and the status is also not up to date.

So I want to use the rollershutter item. Problem here are the commands:

up: 0
stop: 0
down: 100

they are for the fancy motors which support positions, unfortunately my motors doesn’t support those commands. Is it possible to map the controls to my MQTT commands and the state to the small shutter icon?

My FHEM MQTT Bridge looks like this:

Thanks a lot

version is probably important, I believe there are recent changes to how MQTT binding v2 handles rollershutters.

1 Like

Where can I check the version? I’m using the MQTT Binding from David Graeff (binding-mqtt - 2.4.0) the only one in the Binding List with openhab2

A few seconds search of this forum gives a few ways to identify versions, like bundle.list on the karaf console.
But that’s fine, assume as-it-comes version 2.4.0

There is a problem with roller STOP in 2.4.0 as I understand it, and you want to use that. 2.5 versions will have a STOP fix. There’s a “but”…

That’s by design, right or wrong.
Lots about it here

Me, I’d stick with 2.4 and set up a roller Item linked to nothing, and have a rule that listened for commands and issued MQTT acions directly. The rule can also make a guess about the expected position and update the roller Item state.
Maybe review when 2.5M2 is available.

1 Like

Okay. could you help me with the rule syntax? I found different approaches but none of them work so far. I got:

rule "Shutter Wozi"
when
    Item RollershutterWohnzimmer received command
then
    switch (receivedCommand) {
        case UP :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/off")
            // { mqtt=">[mosquitto:set/fhem/Rolladen_Wohnzimmer/off]}
        case STOP :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/stop")
            //{ mqtt=">[mosquitto:set/fhem/Rolladen_Wohnzimmer/stop]}
        case DOWN :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/on")
            //{ mqtt=">[mosquitto:set/fhem/Rolladen_Wohnzimmer/on]}
    }
end

I already tried the commented lines, but there is no incoming message at mqtt broker. I also need an idea for implementing the shutter state in the rule.

Aren’t you supposed to have a payload, as well as a topic?

This is MQTT binding version 1 syntax and will never work with v2 binding. Careful looking at older guides.

I presume you mean something more than
RollershutterWohnzimmer.postUpdate(100)
?

If you have no feedback from the device, what can you do?
It would be possible to do complicated things with timers, to try and keep track of where it ought to be. Finding the 0 / 100 extremes would be tricky.

1 Like

Nope, in the commandline it also works without a message payload.

mosquitto_pub -h IP -p 1883 -u User -P Password -t set/fhem/Rolladen_Wohnzimmer/on -m “”

I just could offer the state from fhem. It switches from open to close immediately after an “on” or “off” command is send to the actor. So the state is also updated, when a manual remote control sends the command. That would be enough for me.

mm, but you also have to satisfy publishMQTT. Have you looked in openhab.log ?
I would at least try

mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/stop" , "")

You can link that to your roller Item then, effectively read-only. Some simple transform from open/close to 100/0

1 Like

Okay, something is missing in the rule. Is it necessary to define the mqtt broker separate in the rule?

Rule 'Shutter Wozi': The name 'mqttActions' cannot be resolved to an item or type; line 13, column 13, length 11

oh yes of course, we need to tell it the broker thing as well.
See many forum examples.

val mqttActions=getActions("mqtt","mqtt:broker:whateveryourbrokeriscalled")

1 Like

Nice, now it works. I will post an update if the state works as well

rule "Shutter Wozi"

when
    Item RollershutterWohnzimmer received command
then

val mqttActions=getActions("mqtt","mqtt:broker:mosquitto")

    switch (receivedCommand) {
        case UP :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/off", "")
        case STOP :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/stop", "")
        case DOWN :
            mqttActions.publishMQTT("set/fhem/Rolladen_Wohnzimmer/on", "")
    }
end

Thank you soo much! You keept my sanity.

This was driving me insane, crazy idea changing how rollershutter works without keeping the old functionality. (I to had build devices around the way the old binding worked).

For info is here my rules:
rule “Awning”
when
Item GF_Awning received command
then
val mqttActions=getActions(“mqtt”,“mqtt:broker:mosquitto”)
switch (receivedCommand) {
case UP :
mqttActions.publishMQTT(“home/br/sb/markise”, “UP”)
case STOP :
mqttActions.publishMQTT(“home/br/sb/markise”, “STOP”)
case DOWN :
mqttActions.publishMQTT(“home/br/sb/markise”, “DOWN”)
}
end