Mqtt 2.5

I am on openHAB 2.5.0 Build #1491. If I wanted to go to that 2.5 M1 milestone, what would be correct way to get there? Just switching to “testing” in openhabian-config seems to not work:

Aktualisierung für 59 Pakete verfügbar. Führen Sie »apt list --upgradable« aus, um sie anzuzeigen.

$ apt-get -y install openhab2=2.5.0~M1-1
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden Pakete werden durch eine ÄLTERE VERSION ERSETZT (Downgrade):
  openhab2
0 aktualisiert, 0 neu installiert, 1 durch eine ältere Version ersetzt, 0 zu entfernen und 59 nicht aktualisiert.
E: Packages were downgraded and -y was used without --allow-downgrades.
FAILED (apt)

Based on the message, Build #1491 came out after 2.5 M1 so moving to 2.5 M1 is a downgrade. So, as the error from apt says, you need to apply the --allow-downgrades flag or not use -y and let it ask you if you want to downgrade.

I do have a vague memory that apt, for some reason, treats all of the milestone releases as if they were ahead of the snapshots. If that is the case, the solution is still the same.

So if my build came out after 2.5 M1, should my build have the MQTT outgoing transformation functionality included (I wouldn’t have to downgrade then)? I tried and it didn’t seem to work. Might have done something wrong though…

The easiest way to check is through PaperUI.

Thanks, I just “downgraded” to M5, and now it seems that the outgoing transformations work. Thanks again.

Thank you very much for your answer, outgoing transformation is clear but still i’m getting mad with this rollershutter items! :exploding_head:
So, the thing is a Shelly2, which is running very good in my OH 2.3 with following item:

Rollershutter Studio_Rollershutter "Studio Rollershutter [%d]"  (Studio) {mqtt=">[syn:shellies/shellyswitch-xxxxxx/roller/0/command:command:*:MAP(shelly.map)], <[syn:shellies/shellyswitch-xxxxxx/roller/0/pos:state:default]"}

And shelly.map file is:

UP=open
DOWN=close
STOP=stop

because open close and stop are the payloads of Shelly2 rollershutter.
In my sitemap i can manage a rollershutter item to command up and down, and get the percentage back.

Now i am running openHAB 2.5.0 Build #1549 and i want to replicate the same command.
I have no problem to run it as a dimmer using another mqtt payload, but still i would like to use a rollershutter item.
I inclued transformationPatternOut and here is my thing file:
MAP file is same as previous

Thing mqtt:topic:shelly2studio (mqtt:broker:synBroker) {
    Channels:
       Type rollershutter : studioshutter "Studio Shutter Command" [ stateTopic="shellies/shellyswitch-xxxxxx/roller/0/pos", commandTopic="shellies/shellyswitch-xxxxxx/roller/0/command",transformationPatternOut="MAP:shelly.map"]

And here the item:

Rollershutter   Studio_Shutter_Com           "Studio Shutter Com [%d]"   <rollershutter>             (Studio, gShutter)              { channel="mqtt:topic:shelly2studio:studioshutter" }


But when i try to send up or down the item, here is the log:

2019-03-09 15:56:21.950 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mqtt.generic.internal.handler.GenericThingHandler@57efe67c': Cannot call update() with custom stop/move/up/down
java.lang.IllegalStateException: Cannot call update() with custom stop/move/up/down

I am getting crazy please help!
Thank you :grinning:

1 Like

Rollershutter support is not complete on the MQTT binding side. The binding just doesn’t know what to do when it gets a “STOP” command etc.

so the only thing is to wait i guess… correct?

Until someone implements it, correct. That is how open source projects work ^^.

Rick 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

Anyone have a working example with a chain of transformations with both JSONPATH and JS.
Need to divide the JSON value by 10. Or is there any other way to not having two items and run through a rule?

I am running Openhab 2.5M4 and MQTT 2 binding.

See seperate post on same subject: