So I have many rules that turn lights on/off based on lux sensors, door triggers, occupancy, etc.
I seem to have some challenges in my logic when trying to prevent the rules from repeating when not necessary.
For example, I want to turn on cafe lights if it's dark enough, we're home, and we're in the space they are installed. I want to turn them off if any of those change. So I want a rule to both turn on and off based on conditions, but I don't want to send the 'on command' every time the trigger fires the rule. So I have logic like "turn ON if x, y, and z, and also if cafe lights are off, ELSE turn OFF if any of x, y, and z (are not desired state) and lights are ON."
I have too many that seem to have small gaps that cause lights to turn on/off over and over from the trigger and I'm betting that I'm just approaching it slightly wrong. what's the best practice method for these scenarios?