Jump to content

Creating a schedule for a battery maintainer - HELP


Teken

Recommended Posts

andyf0

 

FYI - A Program with an If status is triggered only when there is a 'change' in the status, in this case when LightA status changes to On will run the Then clause once. The Program does not loop nor get triggered again just because the status stays On.

 

I have not stayed up with this topic so if this is redundant, my apologies.

 

Lee

Link to comment

The program you just wrote will behave exactly the same as the wait were not even there at all.

 

The logic follows in this order

 

When a "then" or "else" is executed.

All of the line by line stuff is done in order without possiblity for interuption until a "wait" is encountered.

 

The program pauses for the specified time in the wait. During that time, the contents of the if are opened back up for triggering. If any line of the if statement gets triggered, then the wait is killed, the if gets run in full, and the then or else clause executes.

 

Here is an example program that is easy to do.

 

If

Control 'switchlinc' is switched on

Then

set 'device 1' on

wait 30 seconds

set 'device 2' on

Else

set 'device 3' on

 

This statement triggers when you push switchlinc "on" so it runs and evaluates to true. It promptly turns on device 1, (and assuming you don't do anything) waits 30 seonds, then turns on device 2. Device 3 never turns on. This is what actually happens.

 

If, as is implied in the wiki, the wait clause looped back and forced a re-evaluation of the if clause, it would now be false (no one pushed the button a second time), and device 3 would turn on, and device 2 would never turn on. This does not happen.

 

But, if during that 30 second wait, you manually turned off device 1, and then pushed the switchlinc "on" button again, device 1 would turn back on, and the wait 30 second timer would start over again followed by device 2 turning on. This is becuase the "if" clause was available for interuption by pushing the "on" button.

 

As this program is written, there is no way for the else clause to run except if a separate program called it since "control on" can't evalute to false all by itself.

Link to comment

Andy,

 

Agreed, it is confusing. To expand upon Lee and apostolakisl’s comments try thinking of it this way. Once a wait or repeat is reached in the program any trigger change in the “if†during execution will cause the program to re-evaluate during the wait or repeat. If none of the triggers change after execution has begun then the program will not re-evaluate.

 

A single time schedule in the “if†does not cause automatic re-evaluation by itself because the trigger (1:00pm) didn’t change (its merely waiting for 1:00pm in order to trigger).

 

Tim

Link to comment

Like Tim said.

 

I like to think of a wait or repeat as making the if "available". The same exact rules apply to an if running during a wait as when the program is not running at all.

 

Oh, and Andy, I apologize for very poor arythmatic, 11:10 is more than 3 hours after 8, so indeed your program would run fine, it is just that the 11:10 part of it is just superfluous.

Link to comment

Back to poor Teken, if you write the last version of what I posted, it will work. Thanks to Andy for pointing out that it can be made one program instead of 2.

 

And, I am stilling wishing there were some way to make the program foolproof in the event of a poorly timed power failure. Thoughts???

Link to comment

From the wiki:

 

"Catch up schedules at Restart - When this box is checked (default) the ISY will attempt to run all programs that are time dependent beginning at midnight until the present time.'

 

Does that mean that a program that was set to run at 5am and I reboot my isy at 6pm, then the program will run again? If this is so, rebooting your ISY after a counter program has already done its daily count, will then add an extra count for that day. Correct?

 

Edit: Answered my own question and it is YES. I rebooted my ISY after writing this program.

If 
   Time is 6:00:00 am
Then
   Int_1+=1

 

the reboot was done at 11:10. When it first rebooted I want to the variables page and the value was at the init value (1). About 10 seconds later it upped it to 2. Presumably the ISY just hadn't gotten to running that program when I first loaded the page.

 

This is definitely a new twist to consider if you are writing any kind of counting variable program. Perhaps you should have the count occur at 11:59pm or perhaps you should uncheck that box and use the 15 minute catchup instead. Since I have my ISY on a UPS, typically I only reboot when I do firmware updates and that only takes about 5 minutes. I think I will uncheck the box and use a 5 or 10 minutes catchup.

Link to comment

When I first got my ISY and updated the firmware I couldn't figure out why a light in the living room and bedroom went on. It took a while to figure out it was my wake-up program. I have this unchecked also.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...