Clear captured status

In my rule I am capturing the status of the fan before turning it off and restoring it when motion is detected again. How would I go about resetting that status to off overnight so in the AM when I walk in the room it does not turn the fan back on?


There's no direct way to clear captured states, but here's something that I think might work: use Private Boolean (or a global variable if you prefer) to track whether it's still the same day. PB is true by default, so making it false when you've captured the fan might work. Insert this action before or after your "Capture: Office Fan" action:

Set Private Boolean False (This Rule)

Then, check its state before you "Restore." A simple conditional (IF) like this would work, though you could also use a "full" conditional (IF THEN ... END-IF) like you have elsewhere if you want. Maybe replace your "Restore: Office Fan" line with:

IF (Private Boolean is False) Restore: Office Fan

Finally, you'll need something else to reset PB to True before morning. An easy option for this is a second rule:

Trigger: Time is 04:00 AM


Set Private Boolean True (Your Rule Above)

Having two rules for this bothers some people, so they like to cram it into one instead. You could probably do this by adding something like this as your last action (after all the END-IFs):

Wait for Events: Time is 04:00 AM
Set Private Boolean True: This Rule

I'm not a fan of cramming a bunch of things into one rule ("keep it simple..." and whatnot), but either way seems pretty harmless here.

Hope this helps!

This should do exactly what I want and I already have another rule called "sunrise" where I take actions to reset certain things that I can add the command to reset the PB.

I don't know why I never think of using the PB!


1 Like