Jump to content

Run a program only if it hasn't been run recently?


smorgasbord

Recommended Posts

I have an OutletLinc into which a water recirculating pump is plugged. I have 3 programs:

OneCycle: Runs the pump for 2 minutes

Scheduled: Repeat every 1 hour: Run OneCycle

Motioned: Runs the pump while motion is being detected. (motion detector in far bathroom)

 

This all works, but I'd like to optimize the pump running. Ideally:

1) As long as someone's in the bathroom, the pump runs.

2) If the time is between 6am and midnight and the pump hasn't run in the last 60 minutes, run the pump for 2 minutes.

3) If the time is between midnight and 6am, do not have scheduled pump runs (only use the motion invoked run).

 

I have the motion detector set to 0.5 duration, both ON and OFF, and ignoring NIGHT. Those seem like the right settings.

 

I was thinking I need a variable that somehow remembers the last time the pump ran, but maybe I just need to have the Scheduled program be killed whenever motion makes the pump run, and restart Scheduled when motion turns the pump off. And, of course, Scheduled needs to not just Repeat, but to have a time of day check.

 

For extra credit, I have a switch that's called "Away from house" and when that's ON, I don't want Scheduled to run at all, but when that gets turned off, the pump should run for 2 minutes and restart Scheduled. Make sense?

 

Any help with how to set this up would be appreciated.

Link to comment

For the 60 minute cycle, I think I would go with a program something like:

 

If

(Nothing)

Then

Wait 60 minutes

Run this program (else path)

Else

(Nothing)

 

This program becomes my timer. It is true for 60 minutes after being called, then false.

 

Then I would have a motion program something like

 

If

Status motion sensor is on

Then

Turn on pump

Else

Turn off pump

Run timer program (then path)

 

Another program

 

If

Time is between 6am and midnight

And status timer program is false

Then

Turn pump on

Wait 2 minutes

Turn pump off

Run timer program (then path)

Else nothing

 

This program, above, has some risks of being interrupted during the wait period, but I think things should be good when all three programs are in place. Still, if you head down this path, this is something I would watch for.

 

For my extra credit, you could put these programs in a folder who's condition is based upon you away switch, and create yet another program (not in the folder)

 

If

control away switch is turned off

Then

Run another program (then path)

Else

 

I have not spent a lot of brain cells on this, hoping instead to through out some concepts that you may consider and apply. If so, pay special attention to the what-ifs, double checking that the pump is not inadvertently left on because a wait statement was interrupted.

Link to comment

The first program is my one-hour timer. It should be TRUE for on hour, then turn false.

 

Program status(true or false) is based upon the last action taken (then path or else path). The statement to call the else path is there simply to change program status to false at the end of the one-hour period.

Link to comment
Program status(true or false) is based upon the last action taken (then path or else path).

 

Thanks! You just saved me from much confusion! :)

 

I had been assuming program true/false reflected whether the program was currently running or not!

 

I really should slow down and read a bunch of documentation ....

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...