Shelly 2.5 rollershutter and mqtt binding 2.4

  • Platform information:
    • Hardware: _CPUArchitecture/RAM/storage: Raspberry Pi 3

    • OS: _what OS is used and which version: raspbian Linux openhab 4.19.42-v7+ #1219

    • Java Runtime Environment: which java platform is used and what version
      OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
      OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

    • openHAB version: 2.4

I configured via paper UI a shelly2.5 (generic mqtt thingh) device to use as rollershtter. I am using a mosquitto broker and when I send via command line “mosquitto_pub -d -u openhabian --pw xxxxxxxxx -t shellies/shellyswitch25-000208/roller/0/command -m open” the shelly 2.5 works.

I also configured a channel with:
MQTT state topic --> shellies/shellyswitch25-000208/roller/0
MQTT command topic --> shellies/shellyswitch25-000208/roller/0/command
Up value --> open
Down value --> close
Stop value --> stop

I inserted in items file “Rollershutter Shelly1 “SHELLY” {channel=“mqtt:topic:6eefa72f:shelly1”}”

When I use the control panel it does not work.

Is there someone who can help me ?
Regards
RIccardo

There is a known bug in the binding right now with Rollershutter Items. You will need to create a Proxy Rollershutter Item and a Rule that uses the Action to publish the right message for the given command.

Thanks Rich. I am new in Openhab and I don’t understant what can I do. I am able to create a rules but i don’t understand ho to send using openhab the right command. I am able to send MQTT command using mosquitto_pub and the shelly work correctly. Can yiou give me more info ? Thanks

Other question (Sorry :smile:) if i use the MQTT Binding “old” (binding-mqtt1 - 1.13.0) will I have the same problem ?
Thanks

How to use the MQTT 2 Action is documented in the binding docs (https://www.openhab.org/addons/bindings/mqtt.generic/#rule-actions).

I don’t know if you will have the same problem in MQTT 1.x but I wouldn’t recommend going back to it. The number of users who can help fix problems on this forum is slowing going down. Also, the ability of OH 3 to continue to support OH 1.x version bindings is in doubt.

Thanks. I am reading the docs. What do you mean when you say to create a " Proxy Rollershutter Item" ?
I need to create an item using witch binding ? Thanks for your help and sorry because I disturb you.
BR

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

Hi Jan, i have a question…if I don’t want to use the MQTT protocol but use the http get command is possible to build the same rules to manage a shelly 2.5 linked to a rolleshiutter ?
Thansk for your help .
Ciao
Riccardo

FYI there is a binding on the way :

This is the main thread:

It’s still in beta and uses http calls, the goal is to use Coap in the future.
Maybe it could simplify things.

Thank you! Works perfect!

Hi riccardom, i am not using th shelly 2.5 rollershutters with mqtt. I am using shelly binding that is in the latest 2.5 builds. And it works perfectly. It has already been sugested in this tread by alexxio. Just give it a try.