OH3 conditions doesn't seem to compare items?

So I have this simple usecase, if there’s movement (MoveDoor == ON) on my frontdoor, I want the lights (KNXFrontLights) to turn on, but only, if it is dark outside (DarkOutside == ON).
so, I added a rule in OH3 GUI:

triggers:
  - id: "1"
    configuration:
      itemName: MoveDoor
      command: ON
    type: core.ItemCommandTrigger
conditions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Darkoutside
      state: ON
      operator: =
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "3"
    configuration:
      itemName: KNXFrontLights
      command: ON
    type: core.ItemCommandAction

Problem is, the rule fires anytime, “KNXFrontLights” turns to ON, even if the “DarkOutside” item is NULL or OFF? What did I do wrong?

2021-01-03 10:51:18.130 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Darkoutside' changed from NULL to OFF
2021-01-03 10:51:20.550 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'MoveDoor' received command ON
2021-01-03 10:51:20.556 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'KNXFrontLights' received command ON

IMHO what you are trying to get is the AND condition for a trigger, such wasn’t possible for the DSL rules and is IMHO not possible in OH3 as well.
Check the DarkOutside state with an ButOnlyIf condition and dotheaction inside this one.

I have a similar rule which is working.
I think there is a typo in your condition item name. (small o vs O)

Hmm… I do interpret this so, that my “When” = “triggers” (MoveDoor == ON), should lead to an “then” = “actions” (KNXFrontLights = ON), but “only if” = “conditions” (Darkoutside == ON)?
grafik
That would mean a AND in my eyes? Or is the logic different?

I chose the items via GUI, which makes typos impossible! :wink:

Ups!

I must have missread your post. You are already using the “But only if”, I missread your second part as a trigger as well. Me.stup.is

That should work and it’s not clear why it is not working. It’s all selected through the UI (right? or did you type this into the code tab?) so there can’t be a typo in an Item name or something like that. The only thing that looks maybe off is you’re seeing the changed from NULL to OFF in an ItemCommandEvent. It should be logged as an ItemChangedEvent. Do you have any other independent verification of the state of the Darkoutside Item?

Unfortunately I’ve found the only hope to debugging rules like this is to use a Script Condition and/or Script Action to log out the states of relevant Items and comparisons and such.

1 Like