Temperature check for pool pump

I recently upgraded my pool timer to the GE ZWave timer (12726). All I can say is that in the past month it has worked like a charm and I can’t believe I didn’t pull the trigger earlier.

Anyway, I am trying to set up some rules for when the cold weather hits in about seven months or so. I have two jobs that turn the pump on in the morning and turn it off at night, basic cron jobs. But what I would like to do is whenever the temperature drops below 35F/1.7C to have the pump turn on to protect the pipes and equipment.

I created this rule but wanted to know if there was a better way to do it.

rule "Pool Pump On"
when
  //Check time to see if 6:30 to turn on pump
  Time cron "0 30 6 * * ?"
then
  logInfo("Pool","Pool pump turned on.")
  PoolPumpStatus.sendCommand(ON)
end

rule "Pool Pump Off"
when
  //Check time to see if 19:00 to turn off pump
  Time cron "0 0 19 * * ?"
then
  logInfo("Pool","Pool pump turned off.")
  PoolPumpStatus.sendCommand(OFF)
end

rule "Pool Cold Temps"
when
  //Check weather temperature, when drops below 1.7C or 35F pool pump turns on.
  Item Weather_Temperature < 1.7
then
  logInfo("Weather","Cold temps turned the pool pump on.")
  PoolPumpStatus.sendCommand(ON)
end

The pump should run until the next OFF cycle hits. I would like to modify the Off rule so that it would check the time and the temperature. The temperature rule would stay separate in case the temps fell overnight and the pool pump was off.

Thanks.

First, as your HA grows you might find more cases where you want to do things base on time or solar events (sunrise, sunset). I recommend the Time of Day Design Pattern to centralize that sort of logic.

You cannot trigger a rule with a conditional like that. You instead need to:

when
    Item Weather_Temperature changed
then
    if(Weather_Temperature.state < 1.7) {

Beyond that your approach is sound. The next step might be to add some persistence so the last state the pump was in when OH went down gets restored when OH comes back up. Then have a System started rule that sends the appropriate command to the pump based on what time it is.

I recommend this because if by chance OH goes down at 06:29 and doesn’t come back up until after 06:31 the pump will never be turned on. Similarly for the off rule. With a System started rule that figures out what time it is and what state the pump is supposed to be in you will be able to send the command to turn on/off the pump even if OH is down during the deadline.

The Time of Day pattern above should give you the example you need to do this.

1 Like