Issue of the topic: I have a question about rules created via the UI vs. rules I create textually.
I have created several rules via the UI to automatically control lights.
This creates dozens of rules and now I was wondering if it is possible to simply build a rule via the UI that then processes what arrives.
In my previous attempts, I guess I was thinking too simply, because if I use multiple triggers as “when”, all “then” events are processed one after the other.
I just thought if I trigger “AA”, event “AA” is triggered, if trigger “AB”, then event “AB” and so on.
I know that I can create such sequences in a text-based rule according to the scheme:
Filename like “Auto_Lights_Rule”
rule: “Test”
when: “Trigger Item”
then: “Event Item”
if: “…”
rule: “Test1”
when: “Trigger Item”
…and so on.
Now the question, is a collection rule only text-based possible or also via the UI?
That rule is exactly what you’ve described doing in the UI. One rule per Item.
If I understand correctly, you want to process events from multiple Items in one rule, perhaps doing something slightly different based on the Item that triggered the rule.
Of course this is possible but not with pure UI rules. You will have to use a Script Action and code the actions same as you would in a .rules file. In the Script Action you only put the stuff that goes between the when and end.
So if the rule is triggered by ItemA, ItemB, and ItemC you could create a Rules DSL Script Action under then: