Rules - multiple Triggers - Check which in code

Hello,

I have a rule with 4 triggers. (away_status_personA, away_satus personB… change).

The scipt then checks for the away_status of all people to sett an overall everyone_away or everyone_home.

Now there are a few things I want to do in the sciprt specifically if perrsonA changes awaystatus.

Can I somehow in a rules sciprt check which trigger triggered (which state changed)?

Thanks
Daniel

You can achieve the overall away/home status by using a group with an aggregate function

If you want to check what has triggered the rule, in JavaScript you can look at the event variable, a DSL rule will have similar and blockly will have a contextual info block

1 Like

perfect that was what I was looking for thanks!

Yes, I know about the group aggregate function, however I have a switch for the relevant peeople with “extended away”, (business trip), and the person should only be included in the ishome and isaway group when the person is not “extended away”. I hope that makes sense?
I think that can only be handled with rules? (or very weird nested groups)

Why complicate a rule? I’d just create another one, doing exactly that – “a few things if personA changes awaystatus”.