In my relatively fresh OH3.1 installation on RPi4, I have created a rule in the GUI. The rule has two triggers, each of them of type item receives a command and and action in form of a DSL script - basically, I am just trying to replicate this rule.
My problem is that in the script, triggeringItem is null, so accessing triggeringItem.name fails with error message that getName() cannot be used on null. I need this in order to find out which of the two items triggered the rule.
On the other hand receivedCommand works as expected.
But one has to wonder why you are looking at docs for the Jython and JavaScript Helper Libraries for hints for using Rules DSL. In Rules DSL there is no event Object really. The variables are injected into the Rule’s context directly.
Hi Rich, I understand why you wonder, but it seems quite logical at the time: I had tried to replicate one of the design patterns in the forums, got an error, searched for it, and somehow ended up on the documentation site I was referring to. It seemed to confirm that what I was doing (using triggeringItem.name in the rule) should work, so I posted a question to the forum.
In retrospect, I should have read the documentation instead of searching, I will try to remember it next time…