So I’ve been looking at what apps have been using resource on my hub and was surprised to see one of my scene activations.
Looking at the rule and the logs, I can see that the scene is being ‘re-activated’ even if it is already active. What I had assumed would happen is that if the scene was already activated it wouldnt re-activate.
Is this expected behaviour? and what would the most optimal way to reduce the unnecessary executions ? add a condition to the IF statement to check whether Night OR Evening scenes are not running?
Do you have "enable activation optimization" turned on for the scene?
EDIT: Just checked the documentation...this is not what you're looking for.
You can also add a required expression to that rule to only run it if the scene is off.
Its switched off currently…
Right...so you do a required expression for "scene is off". That will prevent the scene from re-activating if it is already on.
When I went to modify the rule, I took the opportunity to re-create in RM 5
I noticed the predicate condition so added one to capture that the rule should only run if the mode is evening or night.
Would it be more efficient to move additional conditions from the IF statement in to the predicate logic?
Is the condition to check if the motion sensor has CHANGED state and then checking in the IF statement whether the motion sensor is ACTIVE - the most efficient way to process this rule?
Thanks for the advice!
You could also add the scenes condition to the required expression.
Realistically, with how that rule is currently written, you could move everything except the motion sensor to a required expression and just set your trigger to "Motion is active". Then the actions would just be the line of "scenes per mode" without an if evaluation.
The downside is that it limits making simple changes in the rule later on.