Rule doesn't trigger on ItemStateEvent

Hello,

I am trying to control my rollershutters with a switch.

So I do have a simple rule script which just sends the state of the switch as a command to my rollershutter.

My problem is, that the only trigger I can use is the “item change” event trigger.
Basically that works - using that trigger I am able to open and close my shutters.

But that’s not the bahaviour I want.

My rollershutters can be stoped in the middle of the movement by just sending the same command.

I was looking in the Event Monitor and found that there is a “ItemStateEvent” fireing everytime I press the button.

openhab/items/FS204fachWandtasterK4/FS204fachWandtasterK4_State/statechanged
GroupItemStateChangedEvent
{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}
openhab/items/FS204fachWandtasterK4_State/statechanged
ItemStateChangedEvent
{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}
openhab/items/FS204fachWandtasterK4_State/state
ItemStateEvent
{"type":"OnOff","value":"ON"}
openhab/items/FS204fachWandtasterK4_State/state
ItemStateEvent
{"type":"OnOff","value":"OFF"}
openhab/items/FS204fachWandtasterK4_State/state
ItemStateEvent
{"type":"OnOff","value":"OFF"}
openhab/items/FS204fachWandtasterK4/FS204fachWandtasterK4_State/statechanged
GroupItemStateChangedEvent
{"type":"OnOff","value":"OFF","oldType":"OnOff","oldValue":"ON"}
openhab/items/FS204fachWandtasterK4_State/statechanged
ItemStateChangedEvent
{"type":"OnOff","value":"OFF","oldType":"OnOff","oldValue":"ON"}
openhab/items/FS204fachWandtasterK4_State/state
ItemStateEvent
{"type":"OnOff","value":"OFF"}
openhab/items/FS204fachWandtasterK4_State/statechanged
ItemStateChangedEvent
{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}
openhab/items/FS204fachWandtasterK4/FS204fachWandtasterK4_State/statechanged
GroupItemStateChangedEvent
{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}
openhab/items/FS204fachWandtasterK4_State/state
ItemStateEvent
{"type":"OnOff","value":"ON"}

Unfortunately the only trigger that fires the rule is the “ItemStateChangedEvent” and that fires only when I change the state and not if the state stays the same.

How can I trigger a rule with the “ItemStateEvent” seen in the EventMonitor?

Thanks
Stefan

You should let us know what script language you use and how you define your rule (file, UI), otherwise it‘s nearly impossible to help.

Good Point.

I am using the UI to define the rule and used Blockly to define the script.

While playing arround I found the right combination which is working as expected.

I have to trigger on the Item-State and not on the item itself. Then I receive the behaviour I am expecting.

The other thing I discovered is that the only point in the UI where I can select the Item-State is while creating a new rule as I can choose the “item” from the Model.

When I try to change the Item within the rule I need to choose the item from the items list which does not contain the item-state:

Again what learned about the UI - thanks for helping!

1 Like