qVAMPIREp Posted November 15, 2012 Share Posted November 15, 2012 Is it better to use a timer or just a simple delay before a stop command for a bathroom fan? If so, why? Link to comment Share on other sites More sharing options...
JP Rizal Posted November 15, 2012 Share Posted November 15, 2012 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 More sharing options...
Cyknight Posted November 15, 2012 Share Posted November 15, 2012 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 programmingDoorbell is pusheddelay 5 secondsflip ts to front doorcameraplay audio announcementvsDoorbell is pushedstart 5 sec timerplay audio announcementat timer expireflip TS to front door cameraIn 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 More sharing options...
TexasBill Posted November 16, 2012 Share Posted November 16, 2012 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 programmingDoorbell is pusheddelay 5 secondsflip ts to front doorcameraplay audio announcementvsDoorbell is pushedstart 5 sec timerplay audio announcementat timer expireflip TS to front door cameraIn 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 More sharing options...
Cyknight Posted November 16, 2012 Share Posted November 16, 2012 ....I agree that that would be the most obvious way of doing it, but...When Blind closesIf fan is on--Turn fan off--Start timerWhen Timer expiresTurn Fan onWould 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 More sharing options...
TexasBill Posted November 16, 2012 Share Posted November 16, 2012 ....I agree that that would be the most obvious way of doing it, but...When Blind closesIf fan is on--Turn fan off--Start timerWhen Timer expiresTurn Fan onWould 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 More sharing options...
qVAMPIREp Posted November 23, 2012 Author Share Posted November 23, 2012 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 More sharing options...
Cyknight Posted November 23, 2012 Share Posted November 23, 2012 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 More sharing options...
qVAMPIREp Posted November 23, 2012 Author Share Posted November 23, 2012 Ok, it's just in my case I ended up with half of my script under the wakeup and the rest under the timer so it seemed like I was doing something less than optimal Thanks Cyknight Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.