On rule / off rule - both kicked off at same time?

Hi everyone,

I’m trying to make a velbus input channel connected to an Ikea light. I created 2 rules (one stating -
if trigger CH1 received == IKEA ON IF IKEA=! ON

and rule numer 2 is
if trigger CH1 received == IKEA OFF IF IKEA=! OFF

I think the problem now is timing… in my log i get:
#CH1 triggered PRESSED
‘IKEA’ received command OFF
‘IKEA’ received command ON
‘IKEA’ predicted to become OFF
‘IKEA’ predicted to become ON
‘IKEA’ changed from 0,0,0 to 0,0,100
#CH1 triggered RELEASED
‘IKEA’ changed from 0,0,100 to 72,100,100

so the light flashes a bit and either goes off or on…

how to make sure that only 1 rule is activated (either ON or OFF) instead of predictions and such…?

and anyone have an idea on how to do the DIM UP / DIM DOWN on these IKEA lights? (I want to make LONG_PRESS UP / LONG PRESS DOWN) and possibly COLOR ROTATE as well…

thnx

Hi Roelf, welcome to the forums.

In general you’re going to get help much faster if instead of interpretations or abbreviated descriptions, you just include the actual code of your rules and the full log entries. Put them all in different code fences sections (how to use code fences) so that they can be easily read and then it should be pretty easy for us to find a solution for you.

2 Likes

Apologies, I wrote the actions in the GUI, hence no code… but here we go…
Rule 1 (off)

triggers:
  - id: "1"
    configuration:
      thingUID: velbus:vmbgpod-2:7f964e441a:02
      event: PRESSED
      channelUID: velbus:vmbgpod-2:7f964e441a:02:input#CH1
    type: core.ChannelEventTrigger
conditions:
  - inputs: {}
    id: "3"
    configuration:
      itemName: Ikea_Color
      state: OFF
      operator: "!="
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Ikea_Color
      command: OFF
    type: core.ItemCommandAction

then rule 2

triggers:
  - id: "1"
    configuration:
      thingUID: velbus:vmbgpod-2:7f964e441a:02
      event: PRESSED
      channelUID: velbus:vmbgpod-2:7f964e441a:02:input#CH1
    type: core.ChannelEventTrigger
conditions:
  - inputs: {}
    id: "3"
    configuration:
      itemName: Ikea_Color
      operator: "!="
      state: ON
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: Ikea_Color
      command: ON
    type: core.ItemCommandAction

what happens is that the light does go on as should, but when I want to switch it off, it goes off and then on again quickly…

the logs:

2021-06-04 07:25:31.199 [INFO ] [openhab.event.ChannelTriggeredEvent ] - velbus:vmbgpod-2:7f964e441a:02:input#CH1 triggered PRESSED
2021-06-04 07:25:31.203 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'IKEA_Color' received command OFF
2021-06-04 07:25:31.220 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'IKEA_Color' received command ON
2021-06-04 07:25:31.227 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'IKEA_Color' predicted to become OFF
2021-06-04 07:25:31.243 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'IKEA_Color' predicted to become ON
2021-06-04 07:25:31.248 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IKEA_Color' changed from 72,100,100 to 72,100,0
2021-06-04 07:25:31.250 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IKEA_Color' changed from 72,100,0 to 72,100,100
2021-06-04 07:25:31.257 [INFO ] [openhab.event.ChannelTriggeredEvent ] - velbus:vmbgpod-2:7f964e441a:02:input#CH1 triggered RELEASED
2021-06-04 07:25:31.267 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IKEA_Color' changed from 72,100,100 to 0,0,0
2021-06-04 07:25:31.877 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IKEA_Color' changed from 0,0,0 to 72,100,100

found it … the IKEA lamp doesnt provide state ON or OFF, hence both rules where invoked… changed it to:

triggers:
  - id: "1"
    configuration:
      thingUID: velbus:vmbgpod-2:7f964e441a:02
      event: PRESSED
      channelUID: velbus:vmbgpod-2:7f964e441a:02:input#CH1
    type: core.ChannelEventTrigger
conditions:
  - inputs: {}
    id: "3"
    configuration:
      itemName: IKEA_Color
      state: 0,0,0
      operator: "!="
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: IKEA_Color
      command: OFF
    type: core.ItemCommandAction

so essentially looked for state = 0,0,0 and != 0,0,0 in the rules

now how to get the color to rotate on long-press…

1 Like

You’ve hit on one of the most important distinctions to make as you get more and more into complex rules. In OH there are commands and there are states and even though some have the same terminology, they are not the same thing. This most often trips people up with ON and OFF as these can be either commands or states. The difference is that only certain item types have ON and OFF as their actual states, but many different items can handle ON and OFF commands in a sensible way.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.