Jump to content
C4 Forums | Control4

Timer or Delay Question


qVAMPIREp

Recommended Posts


Is it better to use a timer or just a simple delay before a stop command for a bathroom fan? If so, why?

Timer is better because you can stop the timer if the event or trigger has changed and program accordingly.

Delay will do the count and turn the fan on or off even if the event has changed

I guess it largely depends on what you are trying to accomplish

Link to comment
Share on other sites

Delays are the older method. While they have some merit in certain situations, if a timer is viable, use that.

Apart from the above, a timer uses less processing power than a forced delay.

Biggest difference is that a delay does not "pause" the whole script, a delay does. Both are useful at times.

ie nothing written below that delay is executed until that delay is over, yet you can trigger a timer and proceed with other programming

Doorbell is pushed

delay 5 seconds

flip ts to front doorcamera

play audio announcement

vs

Doorbell is pushed

start 5 sec timer

play audio announcement

at timer expire

flip TS to front door camera

In one, the audio doesn't play until 5 seconds expire, in the other the audio plays right away.

This is of course a simplified example: yes you could put the announcement line before the delay.

But add 10 more lines like this and it becomes much easier to mess up.

Link to comment
Share on other sites

Delays are the older method. While they have some merit in certain situations, if a timer is viable, use that.

Apart from the above, a timer uses less processing power than a forced delay.

Biggest difference is that a delay does not "pause" the whole script, a delay does. Both are useful at times.

ie nothing written below that delay is executed until that delay is over, yet you can trigger a timer and proceed with other programming

Doorbell is pushed

delay 5 seconds

flip ts to front doorcamera

play audio announcement

vs

Doorbell is pushed

start 5 sec timer

play audio announcement

at timer expire

flip TS to front door camera

In one, the audio doesn't play until 5 seconds expire, in the other the audio plays right away.

This is of course a simplified example: yes you could put the announcement line before the delay.

But add 10 more lines like this and it becomes much easier to mess up.

A place where I have a DELAY in my programming is in the master bedroom - I have a floor to ceiling blind. When the large fan is on it blows the blind against the door and catches on the door handles when closing. So - when closing the blind using a switch (or schedule) I turn of the fan, then DELAY ten seconds and close the blind, then turn the fan back on again (if it was on before closing the blind).

SOMETIMES a DELAY is what you MUST HAVE to get the desired result.

Bill

Link to comment
Share on other sites

....I agree that that would be the most obvious way of doing it, but...

When Blind closes

If fan is on

--Turn fan off

--Start timer

When Timer expires

Turn Fan on

Would work just as well - and has built in that it doesn't do all this when the fan wasn't on to begin with without adding multiple blinds.

Pleas note I'm not saying you method is wrong Bill - not at all.

In fact what I meant earlier with viable is that use a timer --if it is reasonable to do so in your OWN eyes-- the difference is system resource use isn't all that much, and certainly shouldn't force you to make programming more difficult or -perhaps more important still- less logical and/or harder to follow/ keep track of.

Link to comment
Share on other sites

....I agree that that would be the most obvious way of doing it, but...

When Blind closes

If fan is on

--Turn fan off

--Start timer

When Timer expires

Turn Fan on

Would work just as well - and has built in that it doesn't do all this when the fan wasn't on to begin with without adding multiple blinds.

Pleas note I'm not saying you method is wrong Bill - not at all.

In fact what I meant earlier with viable is that use a timer --if it is reasonable to do so in your OWN eyes-- the difference is system resource use isn't all that much, and certainly shouldn't force you to make programming more difficult or -perhaps more important still- less logical and/or harder to follow/ keep track of.

Never even thought of that - I simply wanted to make sure that the fan STAYED OFF while the blind was closing so that it would not blow on it.

Thanks,

Bill

Link to comment
Share on other sites

Why is there no "When Timer XXX expires" selection possible in the Timer Actions window or it's conditionals? I'm working on a wakeup agent that has a timer to turn on my TV after 15 mins etc. and the only way I can get this to work is by using the "When Timer XXX expires" option in the Timer events window. I would like to use an If statement and keep all of my code in the same place so its not confusing but the Timer is not running option doesn't trigger the rest of my script. Hope that makes sense :)

Link to comment
Share on other sites

Because it's not how composer works - there is no "when" for anything under the actions section, so not for timers either.

I get where you're coming from, but within the context of Composer it simply wouldn't be possible. It is considered a more "advanced" form of programming I suppose (cascading events) and was left out to keep it simple and robust for general use (and to prevent accidental loops and leaks) is my guess.

So you're stuck with putting any programming that depends on a timer starting, stopping or expiring under it's own "section".

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...