Blind Control - Special Widget and rule

Hi all,

I am using shellys for my blinds and its working great so far.
Just one thing I would like to ask you for support even its a general “blind-topic” maybe but I cannot find it that way i need :confused:

I have following usecase for the blinds. A Widget with 3 buttons.

[UP] [Home] [DOWN)

UP = blind up to 0%
DOWN = blind down to 100%
they are straight forward but
Home = Blind down but open a little bit - maybe like down to 100%, wait for finishing this and afterwards up again for about 3%?
or is there another way?

So 2 topics here:
1.: Can someone share his implementation to reach this? Rules or is there another way?
2.: Does someone has a nice widget as I am too bad in html/css coding :frowning:

This is my current implementation: Maybe this could be bind in one Widget instead of 4 items in dashboard :smiley:
image

I also dont find/understand, how i could send a custom command like “XYZ” to a item and check in a rule what was send. do i have to use string item here? cant it be done with switch item because switch only has 3 fixed commands?

Thanks in advance for your help.
Stef

Asking the same question as a new topic ??? Not a good idea. Seems you are not willing to search, read and understand existing examples.
So I will give you some basic hints.
Let’s start easy with a sitemap example.
Let’s assume you have a Rollerschutter Item named RaffstoreControl bound to your Schelly controll channel.

Item RaffstoreControl "Raffstore" {channel="shelly:shelly2-roller:xxxxxx:roller#control"}

You will need a Switch Item with 3 mappings, one for 0%, one for 93% and one for 100%

Switch item=RaffstoreControl label"Raffstores Auf/Beschattung/Zu" mappings=[0="AUF", 93="Schatten", 100="Zu" 

This will give you a Switch with three buttons in your Sitemap which do all the magic you asked for.

To achieve similar things in HABpanel, read this:

hi,

Thanks for your reply and help. Appreciate.
i tried to find and thought basically everyone with blinds must have the same “problem” positioning the blinds (slat) :wink:

The switch item in your example is for the sitemap I understand, in the .items file i thought i cannot create mappings. Thanks for that hint, will check on this.
However, I will try with following ruleset because as I understood I cannot just set to 93 or something similar with blinds because depending on the current state it would not open the slat in the right position.

items (to link in habpanel):
switch vRaffEZUP
switch vRaffEZDOWN
switch vRaffEZHOME

rules:
rule “to go up”
when vRaffEZUP received command ON
then
RaffstoreEZ.sendCommand(0)
vRaffEZDOWN.state = OFF
vRaffEZHOME.state = OFF
end

rule “to go gown”
when vRaffEZDOWN received command ON
then
RaffstoreEZ.sendCommand(100)
vRaffEZUP.state = OFF
vRaffEZHOME.state = OFF
end

rule “to go home position”
when vRaffEZHOME received command ON
then
RaffstoreEZ.sendCommand(100)
vRaffEZUP.state = OFF
vRaffEZDOWN.state = OFF
end

rule “set homeposition”
when RaffstoreEZ.rollerpos == 100
then
if(vRaffEZHOME.state == ON)
{
RaffstoreEZ.sendCommand(RaffstoreEZ.state-3)
}
vRaffEZHOME.state = OFF
vRaffEZUP.state = OFF
vRaffEZDOWN.state = OFF
end

Please use code fences.

It’s not allowed to set the state of an Item as if it would be a var. Instead, you have to use the method .postUpdate()
Use the correct key word Item for the trigger part:

rule "to go up"
when
    Item vRaffEZUP received command ON
then
    RaffstoreEZ.sendCommand(0)
    vRaffEZDOWN.postUpdate(OFF)
    vRaffEZHOME.postUpdate(OFF)
end

There is no property .rollerpos and equality can’t be used as a trigger. I guess you mean something like this:

rule "set homeposition"
when 
    Item RaffstoreEZ changed to 100
then
    if(vRaffEZHOME.state == ON)
        RaffstoreEZ.sendCommand((RaffstoreEZ.state as Number) - 3)
    vRaffEZHOME.postUpdate(OFF)
    vRaffEZUP.postUpdate(OFF)
    vRaffEZDOWN.postUpdate(OFF)
end

Hi,

Finally i managed it that it runs :wink: Thanks all for your help!!
Now it looks so easy when its running :wink:

If someone having a similar request, this is my solution:

i have just each a button for “down”, “home” (meaning open the slat), and “up”.

When pressing “home”, the blinds must go down and about for about 2% again.

Items:
I created a group for each group of raffstores - here you see the Raffstore from groundfloor (gRaffstoresEG). Additionally one for the positioning control (gRaffstoresPosEG). And for sure the 2 items for my shelly.

Switch vRaffEGHOME "raff home"
Group:Rollershutter gRaffstoresEG
Group:Dimmer gRaffstoresPosEG

Rollershutter RaffstoreEZ "RaffstoreEZ" (gRaffstoresEG) {channel="shelly:shelly25-roller:xxxx:roller#control"}
Dimmer RaffstoreEZPos "RaffstoreEZPos" (gRaffstoresPosEG) {channel="shelly:shelly25-roller:e4e2dd:roller#rollerpos"}

For up and down my buttons just send 100 or 0 to the group. this is going to send command to all the items. done.
For the “home” part, a dummy item “vRaffEGHome” is switched to “ON”. Then I check if every blind is either down or already at 98% and just switch it to this percentage. If its any other value, i have first to move them to closed (100%).

And the last rule is triggering on positionchange, so for the shellys just once after its done. Here i just have to check if the virtual switch for “home” is on, otherwise i just might want to close it. So when its on, and the blind reached 0 (meaning 100%closed) i move them back up to 2% (meaning 98%closed)

Rules:


rule "to go up or down"
when Item gRaffstoresEG received command
then
    vRaffEGHOME.sendCommand(OFF)
    gRaffstoresEG.members.forEach[ i | i.sendCommand(receivedCommand) ]
end
 

rule "to go home position"
when Item vRaffEGHOME received command ON
then
gRaffstoresEG.members.forEach[ i | 
    if(i.state == 100 || i.state == 98)
    {
        i.sendCommand(98)}
    else
    {
        i.sendCommand(100)
    }
]
end

rule "set homeposition"
when Member of gRaffstoresPosEG changed
then
    if(triggeringItem.state == 0 && vRaffEGHOME.state == ON)
    {
        triggeringItem.sendCommand(2) 
    }
end

The code might not be perfect for sure, but it looks quite ok for me and my current learning curve in openhab.
however, I might need to check if I really need the “positioningItem” or if i can also use the control item of the shelly - I think i had some problems before when trying with that item.
And another point might be that i have also other groups of venetian blinds and i would have to copy paste all of them. So another change might be useful to avoid copy pasting for all of my further groups (but anyhow there will be onls 3-4 groups at the end…)

If you see any issue or something completely wrong/to improve, please let me know;)

Take a look in the widget gallery. There is a pretty good widget for blinds which allow open, close and any percentage you like.

Edit to add: