barkster Posted March 31, 2016 Posted March 31, 2016 I wrote this program to keep my pool heated anytime that the poolheating state variable is 1. It will run for a day or so and then next thing I know it's not running yet the state variable is still set to 1. What could cause it to stop, frustrating. I even set a notification if variable changes and it never does but the program stops. If $PoolHeating is 1 Then Set 'Pool Equipment / SupplyValve' Off Set 'Pool Equipment / ReturnValve' Off Set 'Pool Equipment / Polaris' Off Wait 1 minute Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 2 hours Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Wait 4 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off ***notificationIf $PoolHeating is 0 Then Send Notification to 'Text' content 'Heater' Else - No Actions - (To add one, press 'Action')
andyf0 Posted March 31, 2016 Posted March 31, 2016 (edited) The program will only run once when the state variable changes to "1" and then stop. It doesn't run just because the variable has a value of one. You really need a "repeat" statement in the "then" section". When you set the variable to "1" from "0" then it will repeat the "then" with the frequency/duration you specify in the "repeat". When you set it to "0" it will interrupt the repeat loop and run the "else" once and turn it all off. If $PoolHeating is 1 Then repeat {every x minutes/10 times etc..} Set 'Pool Equipment / SupplyValve' Off Set 'Pool Equipment / ReturnValve' Off Set 'Pool Equipment / Polaris' Off Wait 1 minute Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 2 hours Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Wait 4 hours Run Program 'HeatPool' (Then Path) Else Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off ***notification Edited March 31, 2016 by andyf0
barkster Posted March 31, 2016 Author Posted March 31, 2016 doesn't my last line of the then statement repeat? "Run Program 'HeatPool' (Then Path)"
larryllix Posted March 31, 2016 Posted March 31, 2016 (edited) Yes it should but if your variable ever glitches Off/On the cycle will be broken. I would add some times triggers to your If section, also to ensure retriggering after power cycling and other unfortunate cycle stoppers. I would also use andyf0's method (lose the last recursive line) as it is more structured and apparent approach. Edited March 31, 2016 by larryllix
andyf0 Posted March 31, 2016 Posted March 31, 2016 (edited) doesn't my last line of the then statement repeat? "Run Program 'HeatPool' (Then Path)" I was wondering what that program was that you were running at the end. So you're calling itself. I think I used that technique myself in a couple of programs where a repeat was not suitable. I really don't think the variable would glitch other than if there was another program referencing/changing it somewhere. Otherwise I don't see why it shouldn't work as you want. Edited March 31, 2016 by andyf0
barkster Posted March 31, 2016 Author Posted March 31, 2016 (edited) yeah it's weird to me because I even set the init to 1/0 when I want to turn it on or off so even if power cycled it should restart. Then I even wrote the program to notify me if it ever changes to 0 that way I would know if somehow it was getting changed and I've never gotten anything. Even to test I changed it to zero and was instantly notified on my phone. Frustrating because it seems like it will work for a few days, get my pool nice and hot and then next thing I know it's quit and my pool is cold. Edited March 31, 2016 by barkster
barkster Posted March 31, 2016 Author Posted March 31, 2016 I went ahead and changed it to this which I think is the same as I had, I'll see if it makes a difference HeatPool - [iD 0039][Parent 003E]If $PoolHeating is 1 Then Repeat Every 6 hours Set 'Pool Equipment / SupplyValve' Off Set 'Pool Equipment / ReturnValve' Off Set 'Pool Equipment / Polaris' Off Wait 1 minute Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 2 hours Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Else Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off
andyf0 Posted March 31, 2016 Posted March 31, 2016 You know there will be a 6 hour delay after each run of the program. The repeat every 6 hours means there will be a 6 hour wait after each run of the program. I used to get very confused by this.
barkster Posted March 31, 2016 Author Posted March 31, 2016 (edited) right, before I had it run the pumps 2 hours then wait 4 hours then restart so I would think this is the same. I eventually need to write a program that uses my thermostat but right now I just want it to maintain the temp without running constantly. This has worked well untill I started noticing it wasn't running at all. Do you think I could search some log and see if the turned off "heat pool" program somewhere? Not sure if the logging is on all the time or not Edited March 31, 2016 by barkster
larryllix Posted March 31, 2016 Posted March 31, 2016 (edited) yeah it's weird to me because I even set the init to 1/0 when I want to turn it on or off so even if power cycled it should restart. Then I even wrote the program to notify me if it ever changes to 0 that way I would know if somehow it was getting changed and I've never gotten anything. Even to test I changed it to zero and was instantly notified on my phone. Frustrating because it seems like it will work for a few days, get my pool nice and hot and then next thing I know it's quit and my pool is cold. What is controlling the control variable $PoolHeating ? If you enable the run at Initialisation, would the variable condition be true at that point because the IF sections is run and the logic needs to be true at the same time. If the logic fails your loop will never run until you change the variable. If the variable is not a State variable there is no trigger for the program, ever, and the program will not run Then or Else. I have always been very leery of programs that don't retrigger automatically. There are too many sneak factors that can make them fail, as you may be discovering. With absolute times you can also be sure the pool will be the best temperature when you need it. ...and the program will always self trigger despite unseen circumstances for the variable and/or program. HeatPool - [iD 0039][Parent 003E] If { time is 12:01 AM or time is 6:01 AM or time is 12:01 PM or time is 6:01 PM } AND $PoolHeating is 1 Then Set 'Pool Equipment / SupplyValve' Off Set 'Pool Equipment / ReturnValve' Off Set 'Pool Equipment / Polaris' Off Wait 1 minute Set 'Pool Equipment / FilterPump' On Set 'Pool Equipment / PoolHeater' On Wait 2 hours Set 'Pool Equipment / FilterPump' Off Set 'Pool Equipment / PoolHeater' Off Else ----- Edited March 31, 2016 by larryllix
barkster Posted March 31, 2016 Author Posted March 31, 2016 that looks like a good alternative, I may choose that. Thanks
larryllix Posted March 31, 2016 Posted March 31, 2016 (edited) that looks like a good alternative, I may choose that. Thanks I just noticed the title of the thread using "State Variable" ...ooops! I denote my state variables with a prefix $sVariable, my Integer variables with nothing, $Variable, and my constant variables as $cVariable. Many others use this style $s.variable and $i.variable. These techniques help to keep the confusion down when reading programs, a year later. Back to topic: You still need to find out what is causing your program and probably the variable to change. Edited March 31, 2016 by larryllix
barkster Posted March 31, 2016 Author Posted March 31, 2016 I have seen one instance of the variable getting changed, like I stated, if it changes i have a notification set and it never fires unless I change it manually. When the program quits working the variable is still always set as 1. I'll just change to the times and that should resolve it right?
larryllix Posted March 31, 2016 Posted March 31, 2016 I have seen one instance of the variable getting changed, like I stated, if it changes i have a notification set and it never fires unless I change it manually. When the program quits working the variable is still always set as 1. I'll just change to the times and that should resolve it right? Yes, it should resolve that problem but the variable is still the loose cannon as it can shut off your pools heat if it changes. Do you have any ISY REST hits from other devices or mobile apps that hit on ISY variables etc.? If your variable became 0 and stopped your pool heat cycler it should have shown up and notified you. Also when the variable became true again the pool het cycler should have self-started again??? as long as it is a State variable. That would be the final check. You sure the variable is a State variable. This could all be resolved by it being an Integer variable type... please?
rleidy Posted March 31, 2016 Posted March 31, 2016 It might also be an intermittent communication issue. I don't have a very rigorous mesh myself, and I've seen sometimes commands never make it to the destination device.
stusviews Posted March 31, 2016 Posted March 31, 2016 If the variable somehow changes to a value other than 1 or 0, then the program will stop running and you will not be notified. I'd add an incremental variable as a trouble-shooting technique (e.g., does the program stop after x iterations) and also change from: If $PoolHeating is 0 to If $PoolHeating is not 1
larryllix Posted April 1, 2016 Posted April 1, 2016 If the variable somehow changes to a value other than 1 or 0, then the program will stop running and you will not be notified. I'd add an incremental variable as a trouble-shooting technique (e.g., does the program stop after x iterations) and also change from: If $PoolHeating is 0 to If $PoolHeating is not 1 Yes. very good points! I have seen people using the =+ 1 program line to make a 0 into a 1. That is also a dangerous construct due to the reasons stated by Stu above. Note: OP used the opposite logic so $PoolHeating is not 0 would match the OP program.
Recommended Posts