BobM99 Posted February 23, 2022 Posted February 23, 2022 Hi, I'm trying to write a simple program to reset the energy meter on a Zooz power switch every 30 minutes. I attached a photo. This doesn't seem to be working. Please help. Thanks. Bob
larryllix Posted February 23, 2022 Posted February 23, 2022 37 minutes ago, BobM99 said: Hi, I'm trying to write a simple program to reset the energy meter on a Zooz power switch every 30 minutes. I attached a photo. This doesn't seem to be working. Please help. Thanks. Bob You have a useless Repeat construct. The lines to be repeated are found indented under the repeat loop construct command. To terminate the repeat loop use Repeat 1 times after the lines you want repeated. Repeat every 30 minutes .....do something in a loop Repeat 1 times do the rest only once. If you want two condition you can use this construct Repeat 20 times ....do something 20 times ....Wait 20 minutes Repeat 1 times Do more lines only once Etc... Move your Repeat line up one.
MrBill Posted February 23, 2022 Posted February 23, 2022 10 hours ago, larryllix said: Repeat every 30 minutes .....do something in a loop Repeat 1 times do the rest only once. When does it jump out of "repeat every 30 minutes"? What makes it jump to Repeat 1 times? 1
dbwarner5 Posted February 23, 2022 Posted February 23, 2022 Am also wondering if in @BobM99 case, if he reversed the two program lines, will the program turn false during the reboot, which would stop the repeat, and then turn true again once on, causing a loop effect less than the 30 minutes. My suggestion would be to have the following, assuming he wants it running all the time: Program 1: IF time is 2am Then run THEN of program 2 Program 2: THEN: repeat every 30min reset zoom. This way, the program will always be running and if it were to stop due to reboot etc, it will start up again every day. 1
MrBill Posted February 23, 2022 Posted February 23, 2022 I also tend to make loops like this occur at odd times, so that there is a less likely chance be data collisions. That is, instead of happening every 30 minutes exactly on the half and and hour, I'll mix it up: DoorOpenLight.Query - [ID 014C][Parent 0034] If From 5:28:28AM To 11:59:59PM (same day) Then Repeat Every 33 minutes and 33 seconds Set 'Garage Entryway+# / Door Open' Query Else - No Actions - (To add one, press 'Action') 1
Goose66 Posted February 23, 2022 Posted February 23, 2022 (edited) You could instead just alter your program to run every 30 minutes: If 'ZW 016 On-Off Power Switch' Status is On And Time is Last Run Time for 'Reset kWh sump 2' + 30 minutes Then Set 'ZW 016 Energy Meter Sump 2' Reset Else - No Actions - (To add one, press 'Action') Make sure "Run at Startup" is Enabled. Edited February 23, 2022 by Goose66 1
BobM99 Posted February 23, 2022 Author Posted February 23, 2022 Success! First I reordered the repeat line as suggested by @larryllix. It still didn't work. Then I created 2 programs as suggested by @dbwarner5. It now works perfectly. Thanks to everyone who responded, and in general thanks to all who make this forum invaluable. Bob 3
larryllix Posted February 24, 2022 Posted February 24, 2022 (edited) 14 hours ago, MrBill said: When does it jump out of "repeat every 30 minutes"? What makes it jump to Repeat 1 times? Good catch! Repeats usually need a terminator so that following lines don't repeat in a loop fashion also. In this case of an infinitely repeating time loop, there is "no out". UDI needs to implement a Break on xxxxxx condition construct yet. Edited February 24, 2022 by larryllix 1
Recommended Posts