Jump to content

Please help with program


Recommended Posts

Posted

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

UD.jpg

Posted
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

UD.jpg

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.

 

Posted
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?

  • Haha 1
Posted

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. 

  • Like 1
Posted

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')
 

 

  • Like 1
Posted (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 by Goose66
  • Like 1
Posted

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

 

 

  • Like 3
Posted (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 by larryllix
  • Like 1
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37.1k
    • Total Posts
      371.5k
×
×
  • Create New...