tmorse305 Posted December 11, 2022 Posted December 11, 2022 I have a set of 4 programs that I use to detect when the dishwasher is finished. It works fine but I'm wondering if there is a simpler way to do it. Maybe with a 'Repeat while' command? I attached a screenshot of the power consumption timeline. The power actually drops to 0 many times during the cycle so I decided to detect the 5 large pulses (heating element on). Basically count 5 pulse then wait a fixed amount of time before calling it done. Here are the programs: Dishwasher Start - [ID 010D][Parent 010B] If 'Emporia / 115 Frontier / Dishwasher' Killowatts >= 0.0500 kW And $sDishwasher_On is 0 Then $sDishwasher_HC_Count = 0 $sDishwasher_On = 1 Dishwasher Heat on - [ID 013D][Parent 010B] If 'Emporia / 115 Frontier / Dishwasher' Killowatts >= 0.8000 kW And $sDishwasher_On is 1 Then $sDishwasher_On = 2 Dishwasher Heat off - [ID 013C][Parent 010B] If 'Emporia / 115 Frontier / Dishwasher' Killowatts < 0.6000 kW And $sDishwasher_On is 2 Then $sDishwasher_HC_Count += 1 $sDishwasher_On = 1 Dishwasher Done - [ID 013E][Parent 010B] If $sDishwasher_HC_Count is 5 Then Wait 9 minutes and 30 seconds $sTell_Pushover = 29 $sTell_Telegram = 29 $sDishwasher_On = 0 Any ideas on doing this with fewer programs?
Techman Posted December 11, 2022 Posted December 11, 2022 If the dishwasher run time is always the same, why not use one program with a wait time that ends just after the dishwasher completes all its cycles 1
MrBill Posted December 16, 2022 Posted December 16, 2022 I don't have any better suggestions than just use a timer from a known point as suggested by @Techman As written above $sDishwasher_On doesn't need to be a state variable. It doesn't trigger anything. 1
tmorse305 Posted December 16, 2022 Author Posted December 16, 2022 51 minutes ago, MrBill said: doesn't need to be a state variable @MrBill, I don't usually use integer variables but in this case I see your point. I just set up a simple program to try something base on your comment. 1 Test - [ID 0146][Parent 0001] If $Int_2 > 1 Then $Int_2 += 1 Wait 5 seconds Else - No Actions - (To add one, press 'Action') I set the int_2 to 2, then Run(If). The integer increments to 3 but the wait never executes. I would think it would if there is no re-trigger.
larryllix Posted December 16, 2022 Posted December 16, 2022 (edited) 13 minutes ago, tmorse305 said: @MrBill, I don't usually use integer variables but in this case I see your point. I just set up a simple program to try something base on your comment. 1 Test - [ID 0146][Parent 0001] If $Int_2 > 1 Then $Int_2 += 1 Wait 5 seconds Else - No Actions - (To add one, press 'Action') I set the int_2 to 2, then Run(If). The integer increments to 3 but the wait never executes. I would think it would if there is no re-trigger. If that was a State variable your program would run wild and lock up your ISY somewhat. You have no instruction line after the Wait 5 seconds line. It doesn't serve any function. Edited December 16, 2022 by larryllix
tmorse305 Posted December 16, 2022 Author Posted December 16, 2022 (edited) Oh, I see the wait will not execute if there is nothing after it. Got it Edited December 16, 2022 by tmorse305
MrBill Posted December 16, 2022 Posted December 16, 2022 2 hours ago, tmorse305 said: @MrBill, I don't usually use integer variables but in this case I see your point. I just set up a simple program to try something base on your comment. 1 Test - [ID 0146][Parent 0001] If $Int_2 > 1 Then $Int_2 += 1 Wait 5 seconds Else - No Actions - (To add one, press 'Action') I set the int_2 to 2, then Run(If). The integer increments to 3 but the wait never executes. I would think it would if there is no re-trigger. A State variable has the magical property of being able to trigger an IF statement. An Integer variable can only act as a filter to prevent the If from occurring. Be careful here, You can create an infanite loop that's hard to stop because the admin console becomes unresponsive, specifically make sure to put the wait first.... start with $sTest set to 0 If $sTest > 1 Then Wait 1 second $sTest += 1 Save the program. Now set $sTest = 2 manually and watch it begin to count upward. You can stop it with either right click program stop or set $sTest manually to 0 or any negative number. If you leave out the wait or put the wait second in the program after adding... the ISY will go nuts and the variable will spiral up very rapidly and you may or may not have trouble stopping the program. The reason for the differnce is as soon as $sTest value has changed, that copy of the program vanishes because the value of $sTest changed, which IMMEDIATELY re-triggers IF. If you use the same thing with an integer variable i.e. $iTest the program will ONLY RUN when you right click and Run If or Run Then.
tmorse305 Posted December 16, 2022 Author Posted December 16, 2022 @MrBill, thanks, I understand the difference between integer and state variables, the learning today for me was that a wait statement without any follow up commands is ignored. Obviously a condition you would never have to worry about in practice, I just created a quick program to confirm the integer behavior and got surprised when it didn't work.
MrBill Posted December 16, 2022 Posted December 16, 2022 3 minutes ago, tmorse305 said: @MrBill, thanks, I understand the difference between integer and state variables, the learning today for me was that a wait statement without any follow up commands is ignored. Obviously a condition you would never have to worry about in practice, I just created a quick program to confirm the integer behavior and got surprised when it didn't work. I had to test this, but you're correct a program that doesn't have anything after the wait apparently doesn't wait..... My expectation would have been that the program would sit Running for the duration of the wait then silently end. I even set the wait up to 1 minute to make certain. Of course then again what would be the purpose of waiting for nothing? 1
tmorse305 Posted December 16, 2022 Author Posted December 16, 2022 10 minutes ago, MrBill said: My expectation would have been that the program would sit Running for the duration of the wait then silently end. Me too!
Recommended Posts