Pool pump freeze protection help requested

Hi guys,
I know there are many iterations of different pool pump automations here, but was hoping to get some help here.
I want the following to happen and preferably in 1 script:

  1. Run the pump from 8:00 AM to 8:00 PM every day
  2. Using 2 data points (for redundnacy) to get temperature:
    Check the local weather every hour using the OpenWeather API for my location;
    Check the temperature of the Intermatic Freeze probe every hour;
    If either temperature is 35 deg F or below outside the normal running schedule, turn the pump on.

Obviously I am not a programmer. I want there to not be a problem should there be a power failure and Home Assistant restart. I don’t want the automation to be reset or not work.
Can someone please help with what I have so far or give me a different automation.
Many thanks.

[{"id":"0bc02a3955cba19b","type":"poll-state","z":"f2a97156.abf83","name":"Intermatic Freeze Sensor","server":"9999.88888","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.pool_air_temperature","state_type":"str","halt_if":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"x":175,"y":335,"wires":[["02b0a39ae3891df4","626b18e5e6c87f5e"]]},{"id":"02b0a39ae3891df4","type":"time-range-switch","z":"f2a97156.abf83","name":"Outside pool hours","lat":"","lon":"","startTime":"20:01","endTime":"07:59","startOffset":0,"endOffset":0,"x":455,"y":370,"wires":[["4c298a26860213a1","9a7e50acf4730769"],[]]},{"id":"626b18e5e6c87f5e","type":"debug","z":"f2a97156.abf83","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":425,"y":325,"wires":[]},{"id":"82667d729d92d04c","type":"poll-state","z":"f2a97156.abf83","name":"Open Weather Temp","server":"9999.88888","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.openweathermap_temperature","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":155,"y":385,"wires":[["02b0a39ae3891df4"]]},{"id":"4c298a26860213a1","type":"debug","z":"f2a97156.abf83","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":290,"wires":[]},{"id":"9a7e50acf4730769","type":"switch","z":"f2a97156.abf83","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"35","vt":"num"},{"t":"gte","v":"36","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":375,"wires":[["c11338a91fb59838","c5a3f9f825a33e48"],["a1132619efee9494","ee3f8b21b54f9f31"]]},{"id":"c11338a91fb59838","type":"api-call-service","z":"f2a97156.abf83","name":"Pool pump ON","server":"9999.88888","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.pool_intermatic_controller"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":415,"wires":[["27d659442868cda2"]]},{"id":"c5a3f9f825a33e48","type":"debug","z":"f2a97156.abf83","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":333.75,"wires":[]},{"id":"a1132619efee9494","type":"api-call-service","z":"f2a97156.abf83","name":"Pool pump OFF","server":"9999.88888","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.pool_intermatic_controller"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":470,"wires":[["d4b2ed773d17ce4a"]]},{"id":"ee3f8b21b54f9f31","type":"debug","z":"f2a97156.abf83","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":377.5,"wires":[]},{"id":"c083e09bed871359","type":"switch","z":"f2a97156.abf83","name":"on-off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":415,"y":445,"wires":[["c11338a91fb59838"],["a1132619efee9494"]]},{"id":"27d659442868cda2","type":"debug","z":"f2a97156.abf83","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":421.25,"wires":[]},{"id":"d4b2ed773d17ce4a","type":"debug","z":"f2a97156.abf83","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":465,"wires":[]},{"id":"468bea114e038455","type":"bigtimer","z":"f2a97156.abf83","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Pool pump schedule","comment":"","lat":"","lon":"","starttime":"480","endtime":"1200","startoff":"0","endoff":0,"startoff2":"","endoff2":"","offs":"0","outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":165,"y":455,"wires":[["c083e09bed871359"],[],[]]}]

[{"id":"365009f152e42863","type":"inject","z":"878e74c2.7f39c8","name":"at 8:00","props":[],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","x":180,"y":2860,"wires":[["0ddb1941ebc41173"]]},{"id":"6f823328bf9dc391","type":"inject","z":"878e74c2.7f39c8","name":"at 20:00","props":[],"repeat":"","crontab":"00 20 * * *","once":false,"onceDelay":0.1,"topic":"","x":180,"y":2900,"wires":[["0ddb1941ebc41173"]]},{"id":"0ddb1941ebc41173","type":"time-range-switch","z":"878e74c2.7f39c8","name":"","lat":"","lon":"","startTime":"08:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":430,"y":2900,"wires":[["587ece46cebc09bc"],["613cdd58aba6dc84"]]},{"id":"2d9f2a759dbe8a5e","type":"server-state-changed","z":"878e74c2.7f39c8","name":"sensors & startup fix","server":"9405c3fe.d0a6c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":["input_boolean.startup","sensor.pool_air_temperature","sensor.openweathermap_temperature"],"entityidfiltertype":"list","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[],"x":150,"y":2940,"wires":[["0ddb1941ebc41173"]]},{"id":"613cdd58aba6dc84","type":"api-current-state","z":"878e74c2.7f39c8","name":"pool air <= 35 ?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"35","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.pool_air_temperature","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":640,"y":2940,"wires":[["587ece46cebc09bc"],["7bf04875abc05496"]]},{"id":"7bf04875abc05496","type":"api-current-state","z":"878e74c2.7f39c8","name":"openweather temp <= 35 ?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"35","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.openweathermap_temperature","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":2980,"wires":[["587ece46cebc09bc"],["8237485d1a5ce222"]]},{"id":"587ece46cebc09bc","type":"api-call-service","z":"878e74c2.7f39c8","name":"Pool pump ON","server":"9999.88888","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.pool_intermatic_controller"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1180,"y":2880,"wires":[[]]},{"id":"8237485d1a5ce222","type":"api-call-service","z":"878e74c2.7f39c8","name":"Pool pump OFF","server":"9999.88888","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.pool_intermatic_controller"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1180,"y":2980,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

The entity startup is an input_boolean created in HA that triggers upon every HA restart thus triggering your flows.

YAML automation for this input:

- id: '4567773212467'
  alias: DAILY DING on restart
  trigger:
  - event: start
    platform: homeassistant
  action:
  - delay: 00:00:15
  - service: homeassistant.turn_on
    entity_id: input_boolean.startup
  - delay: 00:00:05
  - service: homeassistant.turn_off
    entity_id: input_boolean.startup

This way your flow will adjust at every HA restart

1 Like

Just wow! :star_struck:
Thank you so much. I greatly appreciate you taking the time to give me a working solution. This is really kind of you and just in time as temperatures have plummeted in my neck of the woods.
Hope you have a great week.

1 Like

Another way to do the same thing but without an Input Boolean (inspired by Mariusthvdb).

Create an automation that posts a custom event a few seconds after Home Assistant starts.

alias: Delayed Startup Event 
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay: '00:00:15'
  - event: 'delayed_startup'

Use an Event Trigger to detect the delayed_startup event.

1 Like

Thanks for this also. Appreciate you taking the time to respond. I am grateful :pray:

1 Like

Have another question that is just befuddling me.
Aim: create a change in my HA dashboard that shows when the pool pump is running because the temp is below 35 deg F.

I have tried using an input boolean I created for my HA dashboard to show when the pool pump is operating in “freeze protection mode.”
I have them coming off the OpenWeather current state node, but that is basically creating another sensor for no reason, when what I really want it to do is change the input boolean to true when the pool pump is running because of the temperature. I tried placing the alerts after the pool pump call service node for turn on and added the same time range node, but I wasn’t getting it to work properly.
I realize that essentially in this flow anytime the pump is running outside the scheduled time range it has to be because of low temp by definition, but wanted to figure out the logic properly.
Can anybody help me please?
A true bonus feature would be to send an iOS notification when in freeze protection mode, but I don’t want it going off every 2 minutes and not from midnight to 7 am. Anyone care to have something like this?
Many thanks.

[{"id":"7bf04875abc05496","type":"api-current-state","z":"ed82291778b86e34","name":"openweather temp <= 35 ?","server":"xxx","version":3,"outputs":2,"halt_if":"35","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.openweathermap_temperature","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":750,"y":165,"wires":[["587ece46cebc09bc","745c0f5a3d1da14c","6f33024249871994"],["8237485d1a5ce222","82836347d33ce67b"]]},{"id":"0ddb1941ebc41173","type":"time-range-switch","z":"ed82291778b86e34","name":"","lat":"","lon":"","startTime":"08:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":425,"y":110,"wires":[["587ece46cebc09bc","7bf04875abc05496"],[]]},{"id":"587ece46cebc09bc","type":"api-call-service","z":"ed82291778b86e34","name":"Pool pump ON","server":"xxx","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.pool_pump"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1175,"y":90,"wires":[[]]},{"id":"745c0f5a3d1da14c","type":"change","z":"ed82291778b86e34","d":true,"name":"Set notification attributes","rules":[{"t":"set","p":"title","pt":"msg","to":"Pool Freeze Warning","tot":"str"},{"t":"set","p":"message1","pt":"msg","to":"Pool temperature <35ºF. The pump has been activated.","tot":"str"},{"t":"set","p":"sound","pt":"msg","to":"default","tot":"str"},{"t":"set","p":"critical","pt":"msg","to":"1","tot":"str"},{"t":"set","p":"volume","pt":"msg","to":"1","tot":"str"},{"t":"set","p":"target","pt":"msg","to":"mobile_app_<your_device_id_here>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1145,"y":305,"wires":[["358d421e4ebd8c34"]]},{"id":"6f33024249871994","type":"api-call-service","z":"ed82291778b86e34","name":"Pool Freeze Alert ON","server":"xxx","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.pool_freeze_alert"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1155,"y":35,"wires":[[]]},{"id":"8237485d1a5ce222","type":"api-call-service","z":"ed82291778b86e34","name":"Pool pump OFF","server":"xxx","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.pool_pump"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1175,"y":180,"wires":[[]]},{"id":"82836347d33ce67b","type":"api-call-service","z":"ed82291778b86e34","name":"Pool Freeze Alert OFF","server":"xxx","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.pool_freeze_alert"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1155,"y":245,"wires":[[]]},{"id":"365009f152e42863","type":"inject","z":"ed82291778b86e34","name":"at 8:00","props":[],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","x":175,"y":70,"wires":[["0ddb1941ebc41173"]]},{"id":"6f823328bf9dc391","type":"inject","z":"ed82291778b86e34","name":"at 20:00","props":[],"repeat":"","crontab":"00 20 * * *","once":false,"onceDelay":0.1,"topic":"","x":175,"y":110,"wires":[["0ddb1941ebc41173"]]},{"id":"2d9f2a759dbe8a5e","type":"server-state-changed","z":"ed82291778b86e34","name":"sensors & startup fix","server":"xxx","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":["sensor.openweathermap_temperature","input_boolean.startup"],"entityidfiltertype":"list","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[],"x":145,"y":150,"wires":[["0ddb1941ebc41173"]]},{"id":"358d421e4ebd8c34","type":"link out","z":"ed82291778b86e34","name":"","links":["93167bdb4d6a4c5b"],"x":1315,"y":305,"wires":[]}]

That would turn on the input/sensor, what should turn it off? temp above 35 &/or/andor pump off?

On the other hand, why did you change this?

Instead of this?

Thank you so much for taking the time to reply. Good catch on the error in the chest floor image. I was trying to use keyboard shortcut’s and messed up. The flow you have shown as the second image is exactly what it is now.

Turning it off would be both temp above 35 and pump off. Likewise vice versa, the toggle would change to indicate the pool pump is off and not operating because of the temperature condition, but the pool pump may be running because it’s on its normal schedule in nice weather. There’s really no way of knowing the pump is actually running AFAIK but at least including it in the logic from the temp sensor would provide me with some peace of mind.
Thank you again.

I’m afraid I don’t quite get the logic of what you are trying to achieve, I hope this helps somehow…

[{"id":"41801cd719533a67","type":"server-state-changed","z":"878e74c2.7f39c8","name":"Triggers","server":"9405c3fe.d0a6c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":["pool pump switch","openweather temp"],"entityidfiltertype":"list","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[],"x":240,"y":240,"wires":[["8d5f1f4cb12e05a3"]]},{"id":"0e7bd2b5dd34b627","type":"api-current-state","z":"878e74c2.7f39c8","name":"open weather temp > 35","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"35","halt_if_type":"num","halt_if_compare":"gt","entity_id":"open weather temp","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":690,"y":200,"wires":[["36fa043b86ccb36e"],[]]},{"id":"8d5f1f4cb12e05a3","type":"api-current-state","z":"878e74c2.7f39c8","name":"pump switch off?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"pump switch","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":240,"wires":[["0e7bd2b5dd34b627"],["40073709c167ecea"]]},{"id":"40073709c167ecea","type":"api-current-state","z":"878e74c2.7f39c8","name":"open weather temp > 35","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"35","halt_if_type":"num","halt_if_compare":"gt","entity_id":"open weather temp","state_type":"str","blockInputOverrides":true,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":690,"y":280,"wires":[[],["49b7ed644c5877a5"]]},{"id":"36fa043b86ccb36e","type":"api-call-service","z":"878e74c2.7f39c8","name":"Input off","server":"9405c3fe.d0a6c","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":200,"wires":[[]]},{"id":"49b7ed644c5877a5","type":"api-call-service","z":"878e74c2.7f39c8","name":"Input on","server":"9405c3fe.d0a6c","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":280,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
1 Like

Thank you. That’s very kind of you. I’ll tinker with it when I get home. :clap:

Hi guys,

I continue here because i used these samples at trying to create my own hot tub anti freeze automation.

At image is my current setup, it kinda works, but if Intermatic is -1c and outside weather is +1c it is calling ON / OFF at same time.

How it needs to works:

When one off two temperatures goes below 0c pump turns on and keeps running untill both temps are back to over +1c

Boolean is for manual pump override when heating tub, it works ok.

This works fine with only one temperature state node. But i want to keep 2, so one is real measurement at tub and if goes out there is still one from internet.

[{"id":"8d945f13c52f6043","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"0bc02a3955cba19b","type":"poll-state","z":"8d945f13c52f6043","name":"Intermatic Freeze Sensor","server":"a9421726.30c498","version":3,"exposeAsEntityConfig":"","updateInterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputInitially":false,"outputOnChanged":false,"entityId":"sensor.shellyplus2pm_c049ef8d5048_temperature","stateType":"str","ifState":"","ifStateType":"num","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":460,"wires":[["02b0a39ae3891df4","626b18e5e6c87f5e"]]},{"id":"02b0a39ae3891df4","type":"time-range-switch","z":"8d945f13c52f6043","name":"Outside pool hours","lat":"","lon":"","startTime":"04:01","endTime":"23:59","startOffset":0,"endOffset":0,"x":730,"y":520,"wires":[["4c298a26860213a1","9a7e50acf4730769"],[]]},{"id":"626b18e5e6c87f5e","type":"debug","z":"8d945f13c52f6043","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":300,"wires":[]},{"id":"82667d729d92d04c","type":"poll-state","z":"8d945f13c52f6043","name":"Outside Weather Temp","server":"a9421726.30c498","version":3,"exposeAsEntityConfig":"","updateInterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputInitially":false,"outputOnChanged":false,"entityId":"sensor.outside_temperature_internet","stateType":"str","ifState":"","ifStateType":"num","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":220,"y":530,"wires":[["57b4d90e853c7d55"]]},{"id":"4c298a26860213a1","type":"debug","z":"8d945f13c52f6043","name":"debug 9","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1560,"y":420,"wires":[]},{"id":"9a7e50acf4730769","type":"switch","z":"8d945f13c52f6043","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"1","vt":"num"},{"t":"gte","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":950,"y":520,"wires":[["c11338a91fb59838","c5a3f9f825a33e48"],["ee3f8b21b54f9f31","780da0fd0d049e02"]]},{"id":"c11338a91fb59838","type":"api-call-service","z":"8d945f13c52f6043","name":"Pool pump ON","server":"a9421726.30c498","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.shellyplus2pm_c049ef8d5048_switch_0"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1380,"y":540,"wires":[["27d659442868cda2"]]},{"id":"c5a3f9f825a33e48","type":"debug","z":"8d945f13c52f6043","name":"debug 10","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1560,"y":460,"wires":[]},{"id":"a1132619efee9494","type":"api-call-service","z":"8d945f13c52f6043","name":"Pool pump OFF","server":"a9421726.30c498","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.shellyplus2pm_c049ef8d5048_switch_0"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1380,"y":600,"wires":[["d4b2ed773d17ce4a"]]},{"id":"ee3f8b21b54f9f31","type":"debug","z":"8d945f13c52f6043","name":"debug 11","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1560,"y":500,"wires":[]},{"id":"c083e09bed871359","type":"switch","z":"8d945f13c52f6043","name":"on-off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":720,"wires":[["c11338a91fb59838"],["a1132619efee9494"]]},{"id":"27d659442868cda2","type":"debug","z":"8d945f13c52f6043","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1560,"y":540,"wires":[]},{"id":"d4b2ed773d17ce4a","type":"debug","z":"8d945f13c52f6043","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1560,"y":600,"wires":[]},{"id":"468bea114e038455","type":"bigtimer","z":"8d945f13c52f6043","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Pool pump schedule","comment":"","lat":"51.025","lon":"-1.4","starttime":"0","endtime":"240","startoff":"0","endoff":0,"startoff2":"","endoff2":"","offs":"0","outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":280,"y":660,"wires":[["c083e09bed871359"],[],[]]},{"id":"57b4d90e853c7d55","type":"debug","z":"8d945f13c52f6043","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":560,"y":400,"wires":[]},{"id":"780da0fd0d049e02","type":"api-current-state","z":"8d945f13c52f6043","name":"","server":"a9421726.30c498","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.palju_pumppu","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":810,"y":580,"wires":[["c11338a91fb59838"],["a1132619efee9494"]]},{"id":"a9421726.30c498","type":"server","name":"Home Assistant","addon":true}]