Jump to content

Run program in if(program)?


dzarn

Recommended Posts

**Edit: Added in the schedule on the Watering program

 

I'm setting up a program to run my sprinklers, and I have a RainDelay variable that I can set for X days (gets dropped by 1 nightly at midnight). I have a program Check Rain Delay which checks if there is a delay, and if so, emails me (this way I can have an idea of how long it's been since the lawn has been watered).

 

So in the actual watering program, I first check the result of the Check Rain Delay program. However, this just checks the last result from the Check Rain Delay run, it doesn't actually run the program first, then check the result. Is there any way to have the watering program run the check program, then get the result back? Or do I have to wrap this all in another program that runs the check, then runs the watering?

 

Thanks for your help!!

 

 

Check Rain Delay Program:
If
       $RainDelayDaysLawn is 0

Then
  - No Actions - (To add one, press 'Action')

Else
       Send Notification to 'Drew Email' content 'Rain Delay Info'
----------------------------

Watering Program:
If
       On Mon, Thu
       Time is  9:30:00PM
   And Program 'Check Rain Delay' is True

Then
       Set 'Irrigation / Sprinklers / Front Yard' On
       Wait  30 minutes 
       Set 'Irrigation / Sprinklers / Front Yard' Off
       Set 'Irrigation / Sprinklers / Back Yard West' On
       Wait  30 minutes 
       Set 'Irrigation / Sprinklers / Back Yard West' Off
       Set 'Irrigation / Sprinklers / Back Yard East' On
       Wait  30 minutes 
       Set 'Irrigation / Sprinklers / Back Yard East' Off

Else
  - No Actions - (To add one, press 'Action')

Link to comment

Dzarn,

 

I am curious as to why you cannot just merge these two programs together.

If
$RainDelayDaysLawn is 0

Then
Set 'Irrigation / Sprinklers / Front Yard' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Front Yard' Off
Set 'Irrigation / Sprinklers / Back Yard West' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Back Yard West' Off
Set 'Irrigation / Sprinklers / Back Yard East' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Back Yard East' Off

Else
Send Notification to 'Drew Email' content 'Rain Delay Info'

 

It appears that Check Rain Delay program will only evaluate and send the notification when the variable changes from 0 to another number. It also appears that the watering program only will run when the previous program is true. Unless of course there is more to these programs than meets the eye.

 

Tim

Link to comment

Hey Tim,

 

Yep, I left something out. In my troubleshooting I took out the schedule condition for the watering program, and forgot to add it back in. In the If it also has "On Mon, Thu Time is 9:30:00 PM". So it only runs at 9:30 PM if the Rain Delay program is true.

Link to comment

Hi dzarn,

 

Well, if I am understanding correctly, even with the time schedule I don’t see a reason you still couldn’t merge the two programs.

 

 

If
On Mon, Thu
Time is 9:30:00PM

And $RainDelayDaysLawn is 0

Then
Set 'Irrigation / Sprinklers / Front Yard' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Front Yard' Off
Set 'Irrigation / Sprinklers / Back Yard West' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Back Yard West' Off
Set 'Irrigation / Sprinklers / Back Yard East' On
Wait 30 minutes 
Set 'Irrigation / Sprinklers / Back Yard East' Off

Else
Send Notification to 'Drew Email' content 'Rain Delay Info'

As long as the variable RainDelayDaysLawn is 0 then on Monday and Thursday at 9:30 PM this program will run. The only issue I see is that you will get a notification of Rain delay every time the variable changes from 0 to another number (assuming State Variable) and also at 9:30 on Monday or Thursday when this program evaluates false.

 

As a side note I have been re-reading your original post and I may not be understanding your meaning:

 

So in the actual watering program, I first check the result of the Check Rain Delay program. However, this just checks the last result from the Check Rain Delay run, it doesn't actually run the program first, then check the result. Is there any way to have the watering program run the check program, then get the result back?

Can you elaborate a bit more? Were you having problems or just wanting to condsolidate?

 

Thanks,

Tim

Link to comment

Not problems per se, more just a question. To put it more generically:

 

Say I have 2 programs, ProgramA and Program B:

 

ProgramA:
If LightSwitch1 is switched On
And ProgramB is True
Then
Set Light1 On
Else
Set Light2 On


ProgramB:
If $Variable1 is 1
Then
Send Notification to email content "The variable is 1"
Else
Send Notification to email content "The variable is not 1"

 

 

So if I run ProgramB at 10 AM, it sends me a notification based on $Variable1, and the status of ProgramB (true/false) is updated. If I then run ProgramA at 11 AM, it uses the value from when ProgramB last ran, but doesn't actually run ProgramB. So if Variable1 changed between the running of ProgramB and ProgramA, say at 10:30 AM, ProgramA uses the old value of ProgramB, which is incorrect.

 

Is there any way to have ProgramB run when checked by ProgramA, thus updating its status as of the time ProgramA runs? I know I could put a schedule on ProgramB, but I'd rather only have to update the schedule on ProgramA.

 

Hopefully that makes more sense.

 

Thanks,

Drew

Link to comment

Hi Drew,

 

In your programs you listed I am assuming Variable1 is a state variable since an integer would never trigger the program.

 

So if Variable1 changed between the running of ProgramB and ProgramA, say at 10:30 AM, ProgramA uses the old value of ProgramB, which is incorrect.

I don’t quite understand “old value.†ProgramB only will run when $Variable1 changes (unless it is called by another program or manually ran in the admin. console). If the variable changes from 1 to another number the program will run Else, and stay false until the variable1 = 1. At that time it runs Then and stays true. So in effect is always going to reflect the true, latest and most up to day status.

Is there any way to have ProgramB run when checked by ProgramA, thus updating its status as of the time ProgramA runs? I know I could put a schedule on ProgramB, but I'd rather only have to update the schedule on ProgramA

Sorry, I don’t understand this question since the status of ProgramB is always going to be the newest and latest status of the variable.

ProgramA will re-evaluate every time ProgramB changes state or when the LightSwitch1 is switched On.

 

So ProgramA will not turn true until ProgramB is true and LightSwitch1 is switched on.

 

I am sorry if I am mis-understanding what you are asking.

 

Tim

Link to comment

Archived

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


×
×
  • Create New...