Jump to content

Challenged with OpenWeatherMap temperature in program IF clause


DPerovich

Recommended Posts

Posted

I'm running into an issue with a couple of my programs.  I believe the frequent OpenWeatherMap polls are interfering with the repeat clause in my THEN statements.

The gist of the programs is this:  If the weather is less than or equal to 40 degrees, run a small pump full time.  If the weather is above 40 degrees, run the pump for 5 minutes every hour.

The problem I am having is the pump seems to ALWAYS be on even when the weather is well above the 40 degrees.  I've been outside all weekend and haven't it turn off once.  Here are my programs...any suggestions what I am doing wrong?

 

Coop Pump - Winter v2 - [ID 0002][Parent 0001]

If
        'OpenWeatherMap' Feels Like <= 40.0°F
 
Then
        $pumpAlwaysOn  = 1
        Repeat 2 times
           Set 'Chicken Coop / Coop Water Pump' On
 
Else
        $pumpAlwaysOn  = 0

 

Coop Pump - Winter (Warm) - [ID 0003][Parent 0001]

If
        From     7:00:00AM
        To       7:00:00PM (same day)
    And $pumpAlwaysOn is 0
 
Then
        Repeat Every  1 hour 
           Set 'Chicken Coop / Coop Water Pump' On
           Wait  5 minutes 
           Set 'Chicken Coop / Coop Water Pump' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

 

 

Thanks for the input!

Posted
5 hours ago, DPerovich said:

any suggestions what I am doing wrong

First question is whether $pumpAlwaysOn is an Integer or State variable.  It needs to be a State variable.  If it's not a State variable then the only time the THEN of "Coop Pump - Winter (Warm)" will ever possibly run is at 7AM, and it will only run then if $pumpAlwaysOn = 0.  And running that THEN is the only way the pump will be shutoff once it has been turned on by "Coop Pump - Winter v2".

Posted
9 hours ago, kclenden said:

First question is whether $pumpAlwaysOn is an Integer or State variable.  It needs to be a State variable.  

It is set as a state variable with an init value of 0.

What I am thinking is happening is that every time the OpenWeatherMap polyglot runs (once every minute, I believe) and the temperature changes (which is seems to change every update due to the temperature being reported with two decimal places), the IF statement is reevaluated in "Coop Pump - Winter (Warm) - [ID 0003][Parent 0001]".  This then causes the State variable to be updated.  Which, in turn, causes the IF statement of "Coop Pump - Winter (Warm) - [ID 0003][Parent 0001]" to run.  This then kills the long-running 'Repeat Every 1 hour' block in its THEN statement.

 

Posted
15 minutes ago, DPerovich said:

It is set as a state variable with an init value of 0.

What I am thinking is happening is that every time the OpenWeatherMap polyglot runs (once every minute, I believe) and the temperature changes (which is seems to change every update due to the temperature being reported with two decimal places), the IF statement is reevaluated in "Coop Pump - Winter (Warm) - [ID 0003][Parent 0001]".  This then causes the State variable to be updated.  Which, in turn, causes the IF statement of "Coop Pump - Winter (Warm) - [ID 0003][Parent 0001]" to run.  This then kills the long-running 'Repeat Every 1 hour' block in its THEN statement.

 

To prove your theory set a variable when Open Weather temperature is less than 40 degrees and use the variable to trigger your program. This will allow you to troubleshoot the remaining program.

Guest
This topic is now closed to further replies.

×
×
  • Create New...