Shelly 2.5 rollershutter and mqtt binding 2.4

i got my shelly’s rollershutters working with following config:
.thing file:

Thing topic Shelly25_xxxxxx "Shelly2.5 Rolluik Achterdeur" @ "Keuken" {
    Channels:
        Type rollershutter : Rolluik    "Rolluik achterdeur"     [ stateTopic="shellies/shellyswitch25-xxxxxx/roller/0/pos", transformationPattern="JS:ShellyRS.js"]
        Type number : Rolluikpos        "Positie achterdeur"     [ commandTopic="shellies/shellyswitch25-xxxxxx/roller/0/command/pos"]
        Type string : Rolluikcmd        "Command achterdeur"     [ commandTopic="shellies/shellyswitch25-xxxxxx/roller/0/command"]
}

the shellyRS.js file:

(function(i) {
    return (100-i);
}) (input)

this gives the right symbol for the shutter on the sitemap shelly open = 100% vs openHAB open = 0%

.item file:

Rollershutter Rolluik_achterdeur    "Rolluik achterdeur"        <blinds>    { channel="mqtt:topic:mosquitto:Shelly25_xxxxxx:Rolluik", autoupdate="false" }
Number Rolluik_achterdeurpos        "Rolluik achterdeur"                    { channel="mqtt:topic:mosquitto:Shelly25_xxxxxx:Rolluikpos" }
String Rolluik_achterdeurcmd        "Rolluik achterdeur"                    { channel="mqtt:topic:mosquitto:Shelly25_xxxxxx:Rolluikcmd" } 

.sitemap:

Default item=Rolluik_achterdeur

and a . rules file:

rule "Shellie2.5 Achterdeur command"
when
    Item Rolluik_achterdeur received command
then 
    switch (receivedCommand) {
        case UP : 
            Rolluik_achterdeurcmd.sendCommand("open")
        case STOP : 
            Rolluik_achterdeurcmd.sendCommand("stop")
        case DOWN : 
            Rolluik_achterdeurcmd.sendCommand("close")
    }
end

Hope this helps.
Jan

5 Likes