The screenshot below is just a test. I have set it so that the lamp should turn on and off outside of the specified time.
However, no matter what I do, the circuit keeps working even within the set time.
Can you explain (in plain language, not using any concepts from Rule Machine) specifically what you're trying to do?
There are many apps that make lighting automations easy to set up, some even easier for beginners. Rule Machine is not one. Have you considered something like Motion Lighting, Basic Rule, or Room Lighting instead?
But of course, I probably should have done this right away indeed.
(steps that work perfectly)
Step 01: Door open (contact sensor open) → Light on in the toilet.
Step 02: Door open again (contact sensor open again) → Light off in the toilet.
Step 03: Between 21:00 and 07:00, the above rule must NOT be executed.
Summary: No light on, no actions during these hours.
In that case, I would set the time window as either a Required Expression or incorporate it in as a Conditional Trigger, and I'd add "Light = Off" as a second component in that required conditional statement.
ETA -- thinking about it more, I'd use the Time Window as a Required Expression, and then use Light = Off as as Conditional Trigger for the Contact = Open Trigger. That way, the light status is evaluated at every Contact Open, and the Required Expression is just a big-picture gatekeeper.
ETA2 -- I'm inclined now to suggest just using both the time window and light=off as a Required Expression (RE). Or use the time window and a Private Boolean as the RE. I myself avoid using the same event as the trigger and a rule action to avoid these kind of potential-collision headaches, but it should be do-able.
I initially thought so too, but from what I can tell, the OP keeps this door closed in general... So open to enter (light on), close door while doing business (light stays on), then when door opens again to leave, light goes off (and stays off when door is closed again after exit).
If all that's true, then Contact = Closed is going to be problematic with croweflight's version (light will go off while OP's on the throne). I think, anyway... I'm low on sleep today, so I may be missing something.
Oh yes I read too quickly and you're right I wasn't thinking about the fact that the garage logic and the bathroom logic are distinctly different, just liked the structure of the rule.
I think I'd set the time frame as the required expression, and the trigger is the contact opens.
Then if statement...if the light is on turn it off, else turn it on.
Was not a solution but more using a trigger condition to stop the trigger during certain times. The problem could be when operations span the time boundaries.