Rollershutter in OpenHab App not working properly - anywhere else no problem

Hello there,

i have a really weird problem. I have been installing new rollershutter controllers from Homematic and now been setting them up in OpenHab.

I can succsessfully control them with up/stop/down in the openhab-panel, I can also do it without any issue in the paperui panel with the buttons there.

but when i go to the basic ui - no matter if via PC or mobile phone, the rollershutter is going crazy. sometimes he is going up if i hit stop, or just going down for a second and stops again.

this only happens in the basic ui - but i would like to use it on mobile phone as the panel is too big for so small screens and i have everything setup already in basic ui.

here is my config - any idea why this is only happening in basic ui?

sitemap:

Switch item=Felix_Jalousie_rechts label="Jalousie rechts" mappings=[1="UP",2="STOP",3="DOWN"]

item:

Rollershutter Felix_Jalousie_rechts "Felix rechts [%d %%]" <blinds> (gRollladen) { channel="homematic:HM-LC-Bl1-FM:ccu2:OEQ1220437:1#LEVEL" }

rule:

rule "Felix_Jalousie_rechts"
        when
                Item Felix_Jalousie_rechts received command
        then
                switch(Felix_Jalousie_rechts.state) {
                        case 1: sendCommand(Felix_Jalousie_rechts, UP)
                        case 2: sendCommand(Felix_Jalousie_rechts, STOP)
                        case 3: sendCommand(Felix_Jalousie_rechts, DOWN)
                }
end

the only thing i can see in the events.log is, when hitting stop - the item state changes to a weird number…
example:

018-05-20 21:14:46.331 [vent.ItemStateChangedEvent] - Felix_Jalousie_rechts changed from 7 to 8
2018-05-20 21:14:48.472 [ome.event.ItemCommandEvent] - Item 'Felix_Jalousie_rechts' received command STOP
2018-05-20 21:14:48.637 [vent.ItemStateChangedEvent] - Felix_Jalousie_rechts changed from 8 to 12

i would really appreciate getting this fixed.thanks for your help.

First the easy thing.

https://docs.openhab.org/configuration/rules-dsl.html#sendcommand-method-vs-action

Next, I don’t even know where to start. You have a fundamental misunderstanding of how the Rollershutter Item works. Ignore the Rule for a second. The way you have it on your sitemap your Rollershutter will only ever be set to 1, 2, or 3 which (depending on your device) means 1%, 2% or 3% open. Obviously that makes no sense as you want to set the shutter to any value between 0 and 100.

You seem to want to use the Rollershutter like a Switch. You can’t do that. You need a separate Item to be the switch.

Now lets look at the Rule. Imagine the following. The Rollershutter is completly closed. You set it to 3 from the sitemap and the Rollershutter starts to go up because it wants to get the Rollershutter to 3% closed. Your Rule triggers and in your Rule you send DOWN to the Rollershutter and it starts to go back down.

You must use separate Items, a Number Item to put on your sitemap with the mappings and then trigger your Rule by this new Item. Then send the UP, STOP, DOWN command to your Rollershutter Item based on the command received from the new Item.

Finally, use switch(receivedCommand) instead of switch(Felix_Jalousie_rechts,state) because with a command the Rule gets triggered before the Item registry gets updated so Felix_Jalousie_rechts,state may not yet reflrect the state received as a command.

Thank you for your guidance.
I could now resolve it - i took the mappings out of the sitemap and now it is working flawlessly. Icons like up/stop/down are rendered automatically by openhab. It seems that those mappings have been creating that issues with the rollershutter going crazy. I need to figure out on how to adapt this for further use.

The only thing which is not working at the moment is to generate a button to move the rollershutter to a certain state (e.g. 50% down).
Will keep you posted if i could manage to get that to work also.

Thanks!