If door contact is open then do not shut down rollershutter

Maybe I think totally wrong but I do not got any success on this. My goal is that if the door is open the rollershutter should stop if the item receive the command DOWN.

my coding looks like this:

rule "LivingRoom Stop Rollershutter if Door is open"
when Item RolloTerassentur_Level received command DOWN
then
    logInfo ("DoorCheckRollershutterEG","Rollershutter received command: " +  RolloTerassentur_Level.state.toString)
    logInfo ("DoorCheckRollershutterEG","Status of the DOOR: " + TursensorTerrasse_State.state.toString)
    if (TursensorTerrasse_State.state === OPEN){
        logInfo ("DoorCheckRollershutterEG","State is OPEN: " +  TursensorTerrasse_State.state.toString)
        RolloTerassentur_Level.sendCommand(STOP)
    }
    else{
        logInfo("LivingRoom Stop Rollershutter", "RUN because: " + TursensorTerrasse_State.state.toString)
    }
end

But it seams so that the rule do not jump into the if statement. As you can see in the log:

2022-02-19 16:18:45.702 [INFO ] [odel.script.DoorCheckRollershutterEG] - Rollershutter received command: 0

2022-02-19 16:18:45.707 [INFO ] [odel.script.DoorCheckRollershutterEG] - Status of the DOOR: OPEN

2022-02-19 16:18:45.711 [INFO ] [script.LivingRoom Stop Rollershutter] - RUN because: OPEN

==> /var/log/openhab/events.log <==

2022-02-19 16:18:45.693 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'RolloTerassentur_Level' received command DOWN

2022-02-19 16:18:45.696 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RolloTerassentur_Level' predicted to become DOWN

2022-02-19 16:18:45.707 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RolloTerassentur_Level' changed from 0 to 100

2022-02-19 16:18:45.889 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RolloTerassentur_Level' changed from 100 to 0

2022-02-19 16:18:45.893 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Rolladen_EG_Terasse_Working' changed from OFF to ON

Do I make something wrong?

Try just two ==

It might be safer to use != CLOSED anyway (not-closed) so it won’t run if the door status is unknown.

Hi Rossko57,
I modified it from === to == but this also is not working.

2022-02-19 17:05:20.409 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TursensorTerrasse_State' changed from CLOSED to OPEN

2022-02-19 17:05:20.442 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HeizkorperEsszimmer_SetTemperature' received command 5

2022-02-19 17:05:20.454 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'HeizkorperWohnzimmer_SetTemperature' received command 5

2022-02-19 17:05:20.456 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HeizkorperEsszimmer_SetTemperature' predicted to become 5

2022-02-19 17:05:20.469 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'HeizkorperWohnzimmer_SetTemperature' predicted to become 5

2022-02-19 17:05:20.482 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HeizkorperEsszimmer_SetTemperature' changed from 20.5 °C to 5 °C

2022-02-19 17:05:20.484 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'HeizkorperWohnzimmer_SetTemperature' changed from 20 °C to 5 °C

2022-02-19 17:05:21.124 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TargetTempLivingRoom2' changed from 20.50 to 5

2022-02-19 17:05:21.731 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TargetTempLivingRoom' changed from 20 to 5

==> /var/log/openhab/openhab.log <==

2022-02-19 17:05:22.517 [INFO ] [odel.script.DoorCheckRollershutterEG] - Rollershutter received command: 100

2022-02-19 17:05:22.521 [INFO ] [odel.script.DoorCheckRollershutterEG] - Status of the DOOR: OPEN

2022-02-19 17:05:22.525 [INFO ] [script.LivingRoom Stop Rollershutter] - RUN because: OPEN

==> /var/log/openhab/events.log <==

2022-02-19 17:05:22.503 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'RolloTerassentur_Level' received command DOWN

2022-02-19 17:05:22.505 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'RolloTerassentur_Level' predicted to become DOWN

2022-02-19 17:05:22.516 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RolloTerassentur_Level' changed from 0 to 100

2022-02-19 17:05:22.754 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'RolloTerassentur_Level' changed from 100 to 0

2022-02-19 17:05:22.757 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Rolladen_EG_Terasse_Working' changed from OFF to ON**strong text**

The != CLOSED solved it

thnx rossko57

What type is your Item? If is a string, OPEN not same as “OPEN” within the rule (but will look the same in the log)

The type of the item is String and it is a point

But you are right - I tested it again and if the String Item is closed the rollershutter can also not be closed.

I got it rossko57,
because it is a string I need to compare different

  if (TursensorTerrasse_State.state != "CLOSED"){

Now it works in both situations door open rollershutter will not go down - door closed rollershutter can go down-

thnx for the hint

1 Like