Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Challenged with OpenWeatherMap temperature in program IF clause

Featured Replies

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!

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".

  • Author
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.

 

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.