Range in case of Roller position

To me it looks like your rule is running multiple times try

    Item RoletaZadna_Position received command UP

This may solve your problem

But the Roller will never received command UP, as it is steered with IKEA GW and the command is for OH invisible, I can catch it only through Item 'RoletaZadna_Position' changed from X to Y

Even the Roller remote is sending command DOWN (through Tradfri GW) in this case.

Tried, it does not work.

Ahh ok so you have a blind with a remote that works.

Now you want the roller shutter to stop if the window is open.
Is this to stop physical damage ?

Yes, exactly, it is because it hapends from time-to time, that someone forget that the window is open.

I would recommend only electrically enabling the motor when the reed switch shows window closed. However if you don’t want to rewire you blinds and disable it with openHAB like you have done.

So to answer your question you can use multiple expressions in your if statement.
Please use Implicit Variable

rule "rolety-otvorene_okna"
when
    Item RoletaZadna_Position changed
then
    logInfo("rolety-otvorene_okna.rules", "Rule rolety-otvorene_okna.rules spustene")
    if(MagnetOknoDetska_OpenStatus.state == OPEN && receivedCommand == DOWN ) {
        RoletaZadna_Position.sendCommand(UP)        
    }
end 

OK, but I can’t see the remote action, or log about receivedCommand == DOWN in OH. It is going through IKEA Tradfri internally, as the Roller and Remote are connected to it.
I can see only the reaction - that the Roller has started to move:

2021-02-13 23:05:05.973 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-13 23:05:07.043 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 6
2021-02-13 23:05:08.062 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 11

Your solution will not work, only if I use ZigBee2MQTT instead of IKEA GW. And I am too weak-spirited to change connections to ZigBee2MQTT.

You can’t put that in the trigger, but you can make test in the rule body

if (MagnetOknoDetska_OpenStatus.state == OPEN && RoletaZadna_Position.state > 3) {
        RoletaZadna_Position.sendCommand(UP)

Because you have position sensing on your roller Item, you might consider disabling autoupdate on the Item to reduce false readings when you do issue commands in openHAB.

1 Like

Your solution has solved the case, if the roller will be already lower as position 3. - means roller is already behind the danger position of hitting the window.
However, the ticks when the position reaches back to 0 are still there:

2021-02-13 23:45:05.461 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-13 23:45:05.482 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-13 23:45:05.526 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-13 23:45:05.548 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-13 23:45:05.457 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-13 23:45:05.469 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:05.473 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-13 23:45:05.479 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-13 23:45:05.490 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:05.496 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-13 23:45:05.523 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-13 23:45:05.533 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:05.539 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-13 23:45:05.545 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-13 23:45:05.555 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:05.560 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
==> /var/log/openhab/openhab.log <==
2021-02-13 23:45:06.123 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-13 23:45:06.144 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-13 23:45:06.493 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-13 23:45:06.120 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-13 23:45:06.129 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:06.133 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-13 23:45:06.137 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-13 23:45:06.152 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:06.155 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-13 23:45:06.489 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 6
==> /var/log/openhab/openhab.log <==
2021-02-13 23:45:07.510 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-13 23:45:07.507 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 9
==> /var/log/openhab/openhab.log <==
2021-02-13 23:45:09.563 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-13 23:45:09.560 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 9 to 0
2021-02-13 23:45:09.569 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-13 23:45:09.574 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP

This could be something I am probably looking for: How can I disable temporarily the autoupdate on Item?

When left as default, openHAB’s autoupdate function attempts to predict the outcome of a command on the Item state. This prediction may be influenced by any linked channels. autoupdate="false" is a special instruction which keeps the current state of the Item, even if a command has been received. This way, the Item is unchanged unless you explicitly post an update to the Item, or a binding updates it. autoupdate="true" forces autoupdate to act, overriding any binding recommendations.

Example:

Switch Garage_Gate {channel="xxx", autoupdate="false"}

You’d better show us your current rule.

Depends how you manage your Items,files or UI

1 Like

You’d better show us your current rule.

rule "rolety-otvorene_okna"
    when
        Item RoletaZadna_Position changed
    then
        logInfo("rolety-otvorene_okna.rules", "Rule rolety-otvorene_okna.rules spustene")
        if(MagnetOknoDetska_OpenStatus.state == OPEN && RoletaZadna_Position.state < 2) {
            RoletaZadna_Position.sendCommand(UP)      
        }
    end

or even with

if(MagnetOknoDetska_OpenStatus.state == OPEN && RoletaZadna_Position.state > 3)

So if it is position state 2 or 1 or 0, you send another command UP - is that what you want? Isn’t 0 fully UP?

You are right! Too late night for my brain to work :slight_smile:

My first though was to catch the movement - when number of position is increasing, but now I see it does not matter. Any movement definition is enough - if it is already at 0,1,2, its fully up, it can go only down.

So the ticks will be solved with disabled autoupdate?

I shouldn’t be ticking if you fix the rule and position is less than whatever number you have chosen.

But it still is:

rule "rolety-otvorene_okna"
    when
        Item RoletaZadna_Position changed
    then
        logInfo("rolety-otvorene_okna.rules", "Rule rolety-otvorene_okna.rules spustene")
        if(MagnetOknoDetska_OpenStatus.state == OPEN && RoletaZadna_Position.state < 2) {
            RoletaZadna_Position.sendCommand(UP)      
        }
    end

I think Ikea GW is fighting with OH?

2021-02-14 00:22:00.390 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MagnetOknoDetska_OpenStatus' changed from CLOSED to OPEN
2021-02-14 00:22:15.129 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
==> /var/log/openhab/openhab.log <==
2021-02-14 00:22:15.415 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:15.449 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:15.484 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:15.512 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:16.082 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:16.099 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:22:16.190 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:22:15.423 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:15.434 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:15.446 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-14 00:22:15.457 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:15.461 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:15.480 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-14 00:22:15.491 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:15.497 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:15.503 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-14 00:22:15.519 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:15.524 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:16.079 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
2021-02-14 00:22:16.089 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:16.092 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:16.096 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 0
2021-02-14 00:22:16.106 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:16.111 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:22:16.186 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 6
==> /var/log/openhab/openhab.log <==
2021-02-14 00:22:17.218 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:22:17.215 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 9
==> /var/log/openhab/openhab.log <==
2021-02-14 00:22:18.275 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:22:18.272 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 9 to 4
==> /var/log/openhab/openhab.log <==
2021-02-14 00:22:19.308 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:22:19.305 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 4 to 0
2021-02-14 00:22:19.315 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:22:19.321 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP

It’s openHAB that is making commands, right there in your log.

This is because you have not fixed the rule.
< 2 means “less than 2”
if the roller position is 0 or 1 you will send it another UP command.

Don’t you think instead that you want to that when position > 2 , more than 2?

I tried it also like this:

rule "rolety-otvorene_okna"
when
    Item RoletaZadna_Position changed
then
    logInfo("rolety-otvorene_okna.rules", "Rule rolety-otvorene_okna.rules spustene")
    if(MagnetOknoDetska_OpenStatus.state == OPEN && RoletaZadna_Position.state > 2) {
        RoletaZadna_Position.sendCommand(UP)
    }
end

but then:

2021-02-14 00:29:59.105 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rolety-otvorene_okna.rules'
==> /var/log/openhab/events.log <==
2021-02-14 00:30:11.381 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MagnetOknoDetska_LastTimeOpenedDateTime' changed from 2021-02-14T00:22:00.369877+0100 to 2021-02-14T00:30:11.375993+0100
2021-02-14 00:30:11.394 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MagnetOknoDetska_OpenStatus' changed from CLOSED to OPEN
2021-02-14 00:30:16.290 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 1
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:16.565 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:17.276 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:17.317 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:17.357 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:17.376 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:17.273 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 1 to 6
2021-02-14 00:30:17.284 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:17.298 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:17.313 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 0
2021-02-14 00:30:17.352 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 6
2021-02-14 00:30:17.364 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:17.367 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:17.371 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 0
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:18.032 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:18.063 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:18.326 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:18.347 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:18.029 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 6
2021-02-14 00:30:18.049 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:18.053 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:18.057 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 6 to 0
2021-02-14 00:30:18.322 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 11
2021-02-14 00:30:18.332 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:18.337 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:18.341 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 11 to 0
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:18.562 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:18.584 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:19.158 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:19.176 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:19.360 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:19.383 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:18.560 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 11
2021-02-14 00:30:18.570 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:18.575 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:18.581 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 11 to 0
2021-02-14 00:30:19.154 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 11
2021-02-14 00:30:19.164 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:19.169 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:19.171 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 11 to 0
2021-02-14 00:30:19.356 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 14
2021-02-14 00:30:19.369 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:19.375 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:19.379 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 14 to 0
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:19.763 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:19.788 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:20.360 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:20.380 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:20.404 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:20.427 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:19.757 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 14
2021-02-14 00:30:19.771 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:19.780 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:19.784 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 14 to 0
2021-02-14 00:30:20.357 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 14
2021-02-14 00:30:20.367 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:20.371 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:20.383 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 14 to 0
2021-02-14 00:30:20.410 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 9
2021-02-14 00:30:20.412 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:20.417 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:20.425 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 9 to 0
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:20.960 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:20.979 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:21.432 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:21.451 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:20.956 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 9
2021-02-14 00:30:20.967 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:20.972 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:20.975 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 9 to 0
2021-02-14 00:30:21.429 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 4
2021-02-14 00:30:21.439 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:21.442 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:21.448 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 4 to 0
==> /var/log/openhab/openhab.log <==
2021-02-14 00:30:21.564 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:21.586 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:22.161 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
2021-02-14 00:30:22.181 [INFO ] [el.script.rolety-otvorene_okna.rules] - Rule rolety-otvorene_okna.rules spustene
==> /var/log/openhab/events.log <==
2021-02-14 00:30:21.561 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 4
2021-02-14 00:30:21.571 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:21.577 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:21.581 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 4 to 0
2021-02-14 00:30:22.158 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 0 to 4
2021-02-14 00:30:22.169 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'RoletaZadna_Position' received command UP
2021-02-14 00:30:22.172 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RoletaZadna_Position' predicted to become UP
2021-02-14 00:30:22.177 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RoletaZadna_Position' changed from 4 to 0

Looks to me like the rule is doing its job now.
Something else is moving the roller down for about 2 seconds.

So I leave it as it was on original, without adding && RoletaZadna_Position.state > 2, as it has no influence.
As in the beginning, the Roller is rolled DOWN cca 20cm, then stopped, and going back. When it is on 0, it is tickling few times.

So this is the rule for one roller. What if I want to do it for more of them, in one rule. Is this “gramatically” correct (tail is not throwing any errors)? Is there a place for improvement? I have now up to 5 of them.

rule "rolety-otvorene_okna"
when
    Item RoletaZadna_Position changed or
    Item RoletaTerasaPrava changed
then
    logInfo("rolety-otvorene_okna.rules", "Rule rolety-otvorene_okna.rules spustene")
    if(MagnetOknoDetska_OpenStatus.state == OPEN) {
        RoletaZadna_Position.sendCommand(UP)
    }
    if(MagnetTerasaObyvacka_OpenStatus.state == OPEN) {
    RoletaTerasaPrava_Position.sendCommand(UP)
    }
end

Thanks,
M.

You might find this technique useful.

in your case, for a rule to work out which window to look at for any given roller.