Piston related to weather


#1

I have a piston to turn my pool pump on and off. Its connected to a solar heater on the roof. Is there any way to only turn the pump on between say 10am and 5pm but only if its above a certain temp using local weather somehow or another option would be to turn the pump on during the day only if its not cloudy
Thanks
Rick


#2

I have found some info from WCmore so I added if over 70 but one of the conditions he mentions is Partly Cloudy I cant figure how to add that.
This is what I have


#3

Where you have $weather rises above 70, I think you’ll need $weather.conditions.current_observation.temp_f

The weather string you are talking about for “Partly Cloudy” is found at $weather.conditions.current_observation.weather but it can have many values so you’ll need to identify all the strings you want to match or not match. A full list is available here: https://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary#current_condition_phrases


#4

Thanks
Im not sure how to put that string into the piston


#5

It’s not clear what you are trying to do, you mention Partly Cloudy but what’s the overall plan? If you can edit the first post to match the format given when you create a new thread it would be much clearer.


#6

For your project, you might want something like this:

Set variable wuCurrent = $weather.conditions.current_observation.weather
Set variable cloudy = (contains(wuCurrent,'Cloud') ? 'true' : 'false')
IF cloudy is true and time is between 10AM and 5PM, then turn on Pool

The trick though is those weather variables do not populate automatically. The method that I usually use is to have my “weather piston” gather the data every 20 or 30 minutes, and store the important data into global variables. I can then use those globals in queries from many other pistons. (in other words, one piston to focus on weather data gathering, and one piston to monitor the pool pump USING the weather data already gathered.) This method keeps things grouped together nicely for editing, but more importantly, it keeps duplicate commands from being run needlessly. (since there are MANY pistons that can benefit from having access to weather conditions)

Although, you COULD combine them into one piston, by doing something like this:

If you import the code ‘pfa3t’, you’ll want to replace my bulb with your Pool Pump.

(Also note, it will take 20 minutes after you save the piston for it to start working)


#7

Why would you want the pool pump on when its cloudy? I think @trickyrick only wants it on in clear sunlight, but I can’t be sure as the original post isn’t detailed enough.


#8

Yes, ‘if cloudy is true’ can be changed to ‘if cloudy is false’ if I misunderstood the original post.


#9

Thanks guys
Yes I edited original post
on if not cloudy
Made the change to false
I will see what happens tomorrow and report back
Rick
P.S. WCmore what is the line (hour24) is inside of range 10 and 16


#10

It means that section of the piston will only run between 10am and 4:59pm…
(think of the first two digits in military time)


#11

Thanks for the piston the pool pump came on today. Ill have to wait for a cloudy day to see what happens


#12

Glad to help. One thing that might be worth adding to your code at some point is:
When it is overcast, or raining, or snowing etc, the current weather will NOT say Cloudy, so the pool pump will still come on… (It is currently coded to look for Partly Cloudy, Cloudy & Mostly Cloudy)


#13

Thanks


#14

If you look at the API link I posted you can see the full list of values that variable can return. It’s probably easier to code for when you want the pump on, then when it shouldn’t come on.


#15

Follow up
This is really the first day its being overcast (is this the same as cloudy) and it is also raining and its also 65 degrees out. The pump still came on
Is there any way to read the weather conditions that its drawing from


#16

As I suggested before.


#17

OK thanks but in the piston as one of the conditions it temp is greater then 70
This morning when the pool pump came on it was only 65


#18

I looked at the web site is this the way I add weather conditions


#19

If you only want the pump to come on if it is clear, instead of trying to match every possibility of bad weather, why not simplify it by only matching when it is Clear outside. Like this:

Change line 30 to:
Set variable {cloudy} = (contains(wuCurrent,'Clear') ? 'false' : 'true')

The following IF only needs to say:

IF {temp} is greater than 70
AND
{cloudy} is false
THEN
Turn on Pump

This way, the pump will only come on if it is CLEAR and over 70 degrees…
If it is raining, Cloudy, snowing, overcast etc, the pump will not come on.
(delete lines 36-50)


#20

Thanks WCmore
I will make those changes but with the existing piston I don’t understand why the pump came on as I stated the temp this morning was only 65 degrees. Is there any way to see the weather forecast from where ever the piston gets it info