barkster Posted February 15, 2021 Share Posted February 15, 2021 I wrote this to try and prevent my pool equipment from freezing but it never goes off and don't know why. Everything turns on but nothing ever gets turned off. What am I missing? Antifreeze - [ID 002C][Parent 003E][Not Enabled] If 'PoolTemp' Temperature < 29.0° Then Set 'Pool Equipment / SpaValve' Off Wait 15 seconds Set 'Pool Equipment / FilterPump' On Wait 10 seconds Set 'Pool Equipment / Polaris' On Wait 10 seconds Set 'Pool Equipment / Waterfall' On Wait 15 minutes Set 'Pool Equipment / Waterfall' Off Wait 30 minutes Set 'Pool Equipment / Polaris' Off Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / Waterfall' Off Repeat Every 2 hours Else - No Actions - (To add one, press 'Action') Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 Can you better explain what you mean by "but it never goes off"? I also note that the program is disabled, or it least it was when you pasted it. Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 The problem is likely that each time the temp changes the then body is restarting. I don't know the nature of where your temp value is coming from or how often it is updated. To test that theory, leave it disabled and right click and 'run then' if the then body does what you're expecting under those conditions then the IF body being re-evaluated is the problem. 1 Link to comment
barkster Posted February 15, 2021 Author Share Posted February 15, 2021 thanks for reply, the pool temp comes from my wireless thermostat that I tied into pool water supply. When I mean it never goes off I mean the equipment never goes off. Yes I disabled program. Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 The tempature updating is likely the problem. temp = 28.9 loop starts temp = 28.8 loop restarts temp = 28.7 loop restarts Also repeat every 2 hour at the bottom does nothing, that would need to be moved up to be the first line of the loop. Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 (edited) to fix the looping problem use 3 programs: (apologize these have form typos because I did it off the top of my head, i didn't go create sample programs... if that results in questions please feel free to ask.) antifreeze.on If 'PoolTemp' Temperature < 29.0° then Run program antifreeze.loop (then) else (none) Antifreeze.loop - [ID 002C][Parent 003E][Not Enabled] If (none) Then Disable Anti-freeeze.on Repeat Every 2 hours Set 'Pool Equipment / SpaValve' Off Wait 15 seconds Set 'Pool Equipment / FilterPump' On Wait 10 seconds Set 'Pool Equipment / Polaris' On Wait 10 seconds Set 'Pool Equipment / Waterfall' On Wait 15 minutes Set 'Pool Equipment / Waterfall' Off Wait 30 minutes Set 'Pool Equipment / Polaris' Off Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / Waterfall' Off Else - No Actions - (To add one, press 'Action') antifreeze.off If 'PoolTemp' Temperature > 30.0° then stop program antifreeze.loop Set 'Pool Equipment / Polaris' Off Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / Waterfall' Off enable program antifreeze.on else (none) the second program antifreeze.loop should be disabled. Edited February 15, 2021 by MrBill Link to comment
barkster Posted February 15, 2021 Author Share Posted February 15, 2021 thank you for the help I will try it out Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 Actually spread the on/off temp out a little bit..... if on is < 29 make off > 30 since you're temp appears to update based on tenths (.1) putting on and off at the same temp is going to lead to a different problem. Link to comment
Goose66 Posted February 15, 2021 Share Posted February 15, 2021 (edited) I would suggest a little bit different structure. It is often the case that you need two programs when switching "modes" results in long running programs. You'll see the two tier programming structure in a lot of examples around on this site. Here you need two two-tier programs (four total programs): A FreezeProtectionMode On pair of programs and a FreezeProtectionMode Off pair of programs. The FreezeProtectionMode On pair of programs consists of a "trigger program" that is enabled and uses a state variable: If FreezeProtectionMode = 0 And PoolTemp <= 34 degrees Then Run Program TurnFreezeProtectionModeOn (Then Branch) Else <--- No Action ---> The second program in the pair is disabled, sets the state variable, and performs the actions: If Then Set FreezeProtectionMode Value = 1 Set FreezeProtectionMode Default = 1 Repeat Every 2 Hours ... The FreezeProtectionMode Off pair of programs also has an enabled "trigger program": If FreezeProtectionMode = 1 And PoolTemp >= 37 degrees Then Run Program TurnFreezeProtectionModeOn (Else Branch) Else <--- No Action ---> The "second" program of the Off pair could be it's own program that resets the state variable, kills any running TurnFreezeProtectionModeOn program and performs the necessary functions to restore the pool to normal operating mode, or it could just all go into the Else branch of the TurnFreezeProtectionModeOn program to keep all the statements together. The other good thing about putting it in the Else branch is that any running instance of the TurnFreezeProtectionModeOn is automatically killed (i.e. any Repeat or Wait is preempted) in favor of the new instance of the Else branch of the program. Edited February 15, 2021 by Goose66 Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 I edited my contribution above, My .off program wasn't making sure everything got turned off. I used to use state variables for everything, but started using the disable method for things like this because at one time I had too many state variables and it was causing queue full errors. Link to comment
barkster Posted February 15, 2021 Author Share Posted February 15, 2021 You mentioned program wasn't making sure everything got turned off. If it goes above my set point how is it turning off the pumps, etc... it only stops the loop but the pumps are one won't they remain on? Link to comment
MrBill Posted February 15, 2021 Share Posted February 15, 2021 19 minutes ago, barkster said: You mentioned program wasn't making sure everything got turned off. If it goes above my set point how is it turning off the pumps, etc... it only stops the loop but the pumps are one won't they remain on? check the edit to the 3rd program above. I added turning everything off. 1 Link to comment
barkster Posted February 16, 2021 Author Share Posted February 16, 2021 thanks for all the help, unfortunately I lost power at 7pm and has been out since. I had to drain everything. Let's hope it survived. 1 Link to comment
MrBill Posted February 16, 2021 Share Posted February 16, 2021 24 minutes ago, barkster said: thanks for all the help, unfortunately I lost power at 7pm and has been out since. I had to drain everything. Let's hope it survived. wow... I hope it comes back soon!! We've had rolling blackouts that make me nervous, but no sustained outage. Stay Warm!! Link to comment
barkster Posted February 17, 2021 Author Share Posted February 17, 2021 got it back for now 24hours later. One more question you mention that antifreeze.loop should be disabled. So when it disable and you call the then statement it will still run the then? It seems like when I tried first time with it disabled it didn't run but who know. Just want to confirm that disabled programs can still have the "then" statement executed. Thanks 1 Link to comment
MrBill Posted February 17, 2021 Share Posted February 17, 2021 12 hours ago, barkster said: got it back for now 24hours later. One more question you mention that antifreeze.loop should be disabled. So when it disable and you call the then statement it will still run the then? It seems like when I tried first time with it disabled it didn't run but who know. Just want to confirm that disabled programs can still have the "then" statement executed. Thanks Disable effectively disables the IF portion. When disabled a program still runs when run manually from the admin console, or Run by another program. In actuality with no If statement it doesn't matter if the program is enabled or disabled, it just seems most people around here tend to disable and leave them disabled. Right click My Programs at the top and make sure that Status Icons is set to detailed: With detailed status Icons the icon to the left of the program name will tell you much. Examples: Solid Red: the ELSE block of the program is currently running. Solid Green: the THEN block of the program is currently running. (your .loop program would be solid green when the the block is running/active. Red Strip: the IF last evaluated to false, and if the program has an ELSE block it was run, but its not currently active. Green Strip: the IF last evaluated to True, and if the program has a THEN block it was the run, but its not currently active. the international NO symbol (Red Circle with a Red Slash) means that the program is disabled and the IF conditions will not run, but the program can still be run manually or run by another program. Folders can also have conditions (IF) but do not have actions. Folder conditions don't work the same way Program If conditions work. I'll stop there because folder conditions are for an advanced class ? but just recognize they work differently for now. Link to comment
barkster Posted February 17, 2021 Author Share Posted February 17, 2021 awesome thank you for all your help Link to comment
Recommended Posts