Automation action condition

Need some help with a HA automation. I have 2 pool temp sensors, one in the controller box that provides air temp and another in from of the pool pump that provides water temp. The pool water temp return a unknown value when the pump is not running. This is by design in the esphone code so the heater does not turn on if the pump is not running Once the pump starts it take about 30 secs for HA to get the pool temp value, which is why I have the 1 min wait after turning on the pump. I am trying to get the pool pump to turn on when the outside temp (sensor.pool_controller_temperature) gets below freezing. This works. What I cannot get to work it getting the pump to turn off once the pool water temp sensor (sensor.pool_temp) returns a value over 33.

I have tried value templates, conditions in the actions ect but nothing seems to be working.

- id: '1614614709491'
  alias: Pool run pump if freezing
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.pool_controller_temperature
    below: '30'
  action:
  - type: turn_on
    device_id: 1433f8ce872fee2588ab932635795523
    entity_id: switch.sonoff_pool_pump
    domain: switch
  - wait_template: 00:01:00
  - condition: template
    value_template: ' value_template: ''{{ states.sensor.pool_temp > 33 }}'''
  - type: turn_off
    device_id: 1433f8ce872fee2588ab932635795523
    entity_id: switch.sonoff_pool_pump
    domain: switch
  mode: single
- id: '1614614709491'
  alias: Pool run pump if freezing
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.pool_controller_temperature
    below: '30'
  action:
  - type: turn_on
    device_id: 1433f8ce872fee2588ab932635795523
    entity_id: switch.sonoff_pool_pump
    domain: switch
  - wait_template: "{{ states('sensor.pool_temp')|int > 33 }}"
  - type: turn_off
    device_id: 1433f8ce872fee2588ab932635795523
    entity_id: switch.sonoff_pool_pump
    domain: switch
  mode: single
1 Like

Thanks that did it!

1 Like