Pool Pump Based on Forecasted High Temp


#1

I couldn’t find a piston that would turn on my pool pump and run it for a number of hours based on the high temperature for the day. Since it wasn’t too complicated, I decided to learn a bit more and create my own. By default, the piston will turn on the pool pump at 11:00pm (you can adjust this) and will turn off after X hours (where X is the high temperature from the past 24 hours divided by 10).

Prerequisites:

  • Pool pump connected to SmartThings via switch, relay, etc.
  • SmartThings Virtual Switch named “Pool Automation”

Configuration:

  • Define the StartTime variable. This is when your pool pump will start running. By default it’s 11pm, but it can be changed to whatever time you’d like.
  • Define the MinDuration variable. This is the minimum time that you want your pool pump to run on a daily basis. I added this so if you want the pump to run at least 5 hours a day, it will still do that even in the colder parts of the year.

Update (10/1/19): I removed the StopTime variable initial value as that wasn’t allowing the calculated StopTime variable to persist. With the initial value of 7:00:00 AM, the pump was always turning off then, regardless of the outside temperature.


#2

Hi @Bullfrogskin. Your piston is exactly what I’m looking for. I added the piston via backup code without any changes (apart from assigning devices), but the StopTime is not changed when the “run duration” is longer than the “minimum duration”. I can’t seem to figure out why. It the piston as you uploaded it, working correctly for you? (I have previously had some issues with pistons not restoring correctly when using a backup code, although, on the face of it, they are exactly as the original. I tried adding the piston a second time, in case that might be my issue, but without any luck.)


#3

Sorry, I haven’t been logged on for a while. After taking a quick look, it seems like “$twcweather.forecast.temperatureMax[0]” isn’t returning today’s high temperature (more on that later). When editing the piston, it tries to evaluate that expression and it just returns a “0”. Once I changed it to “$twcweather.conditions.temperatureMax24Hour”, it returned “90” which will work. I’m assuming since it’s not a forecast, it’s the highest temperature in the past 24 which should work for the purposes of the piston.

It’s been four months, but I’m thinking that it was morning and early afternoon when I constructed and tested the piston. Because is was daytime, there was still a forecasted max temp. However, since the piston starts at 11pm by default, there is no more forecasted max temp since the temps are falling in the hour from 11pm to midnight. Using “$twcweather.conditions.temperatureMax24Hour” gets around this as it’s not dependent on the time the piston starts. If you are starting the pump at 11pm, you could use “$twcweather.forecast.temperatureMax[1]” (0 changed to 1) to return tomorrow’s high temp.

I’m going to update the original post to use “$twcweather.conditions.temperatureMax24Hour”.


#4

I’ve been using the Max24Hour function and it has been working very well for my.
Thanks again for sharing your piston.


#5

If it’s working for you, I’m sure you fixed the mistake in my original piston when it set StopTime to an initial value of 7:00:00 AM. I updated the original post to get rid of that and it finally seems to be working as planned.


#6

I made a few changes, like moving some of the tests to the top of the piston. But the basic structure remained the same as your piston.