Pool Freeze Protection

I am using a Sonoff Dual R2 to control 120v contactors to control my pool pump and cleaner, but this does not give me freeze protection. With it getting cooler, I need to make sure that I get this going. How would I go about adding freeze protection to these very basic automations? I have tried on my own a few times, but it doesn’t even validate in HomeAssistant.

I would like to keep it on for the times listed, but I need it to kick on when it gets to 39 degrees as well no matter what.

- id: pool_pump_start
    alias: Pool Pump start in the morning
    trigger:
      - platform: time
        at: '08:00:00'
    action:
      service: switch.turn_on
      entity_id:
        - switch.Pool_Pump
  - id: pool_cleaner_start
    alias: Pool Cleaner start in the morning
    trigger:
      - platform: time
        at: '12:00:00'
    action:
      service: switch.turn_on
      entity_id:
        - switch.Pool_Cleaner          
  - id: pool_pump_stop
    alias: Pool Pump stop in the evening
    trigger:
      - platform: time
        at: '18:00:00'
    action:
      service: switch.turn_off
      entity_id:
        - switch.Pool_Pump
  - id: pool_cleaner_stop
    alias: Pool Cleaner stop in the evening
    trigger:
      - platform: time
        at: '14:00:00'
    action:
      service: switch.turn_off
      entity_id:
        - switch.Pool_Cleaner

Indentation and syntax is very important. So, for us to better help you, please format your code per the instructions in the blue box at the top of the page:

and you need to post any relevant error log entries.

Need to put that at top of the page

1 Like

Very good LOL.

It will probably be easiest to create a separate anti-freeze automation that fires every five minutes. Look at automaton 3 here.

You also will need to add a numeric_state condition that the temperature is below 39 degrees. That way home assistant will check every five minutes, and if so turn on the pump.

You should do that instead of triggering on the temperature dropping, because if you miss the temperature crossing from above to below your threshold it will never fire (e.g. You restart home assistant and it’s already cold out).

You could also create a freeze stop automation that just triggers on the numeric state of the temperature going to above say 41 degrees that turns off the pump, with a time condition to check that it’s not during the normal pumping hours.

Thanks for the hint. I am going to attempt to implement this by adding the additional start and stop option.

This is what I came up with. I’ll have to wait until later to see how it works. Thanks for the help @Dolores.

  - id: pool_pump_freeze_protection
    alias: Pool Pump Freeze Protection
    trigger:
      - platform: time
        minutes: '/10'
        seconds: 00
      - platform: numeric_state
        entity_id: sensor.pws_temp_f
        below: 39
    action:
      service: switch.turn_on
      entity_id:
        - switch.Pool_Pump
  - id: pool_pump_freeze_protection_stop
    alias: Pool Pump Freeze Protection Stop
    trigger:
      - platform: numeric_state
        entity_id: sensor.pws_temp_f
        above: 39
    condition:
      - condition: time
        after: '18:00:00'
        before: '08:00:00'
    action:
      service: switch.turn_off
      entity_id:
        - switch.Pool_Pump
1 Like

You need to add a numeric_state condition to that first automation. As is now, it will fire every ten minutes regardless of temperature. (and also when the temperature drops.)

Also I would change the temp in the second automation to 40, just in case the temp bounces rapidly above and below 39. Not essential, just my paranoia.

Here are my modifications. Does this look better?

- id: pool_pump_freeze_protection
    alias: Pool Pump Freeze Protection
    trigger:
      - platform: time
        minutes: '/10'
        seconds: 00
    condition: 
      condition: numeric_state
      entity_id: 'sensor.pws_temp_f'
      below: '39'
    action:
      service: switch.turn_on
      entity_id:
        - switch.Pool_Pump
  - id: pool_pump_freeze_protection_stop
    alias: Pool Pump Freeze Protection Stop
    trigger:
      - platform: numeric_state
        entity_id: 'sensor.pws_temp_f'
        above: '40'
    condition:
      - condition: time
        after: '18:00:00'
        before: '08:00:00'
    action:
      service: switch.turn_off
      entity_id:
        - switch.Pool_Pump

Yes. I haven’t checked the syntax but the general triggers and conditions and whatnot should do what you want.

You can test this automation by manually setting the temperature using the states tool under development tools on the front end. The sensor will read that fake temperature until your actual sensor sends an update.

Thanks! This has been working great on my end.

1 Like