Ive got the below rule and have come up against an edge condition where if im in mode night and someone leaves it turns it into evening mode.
What id like to do is slip in an If event value is present go to evening mode otherwise just drop through to the end
If I understand the question correctly, you need to create a local variable and then set the local variable to %value%. You can then use the local variable in your conditional.
I am sure you will be able to use Rule Machine to accomplish this. Not trying to derail the conversation... I am just curious if you've looked at the built-in Mode Manager app? It basically handles this type of logic very nicely. I have been using the original Mode Manager (Legacy) for years, and it handles all Mode changes throughout the day, and handles Away (when everyone leaves) and the return from Away (when anyone arrives.)
Here is what my Mode Manager Legacy app looks like. I have never bothered to convert this to the newer Mode Manager app, as the old one 'Just Works'.
yea used original mode manager for ages, but the set mode by time never really worked for me
I also use the older Mode Manager and it will work with your use case.
With that said, if you stick with Rule Machine, the simplest solution would be to have two rules - one for "present" and the other for "not present"
Rule 1:
Trigger:
X, Y, Z any reports presence "not present"
Actions:
IF (Mode in [Day, Evening] AND all is not present) THEN
Mode: Away
END-IF
Rule 2:
Trigger:
X, Y, Z any reports presence "present"
Actions:
IF (Mode is Away AND Time is between 06:30-20:00) THEN
Mode: Day
ELSE
Mode: Evening
END-IF
IF (Mode is Night) THEN
Mode: Evening
Notify: xxxxx
END-IF