fryfrog Posted June 27, 2015 Posted June 27, 2015 It is pretty silly that I have to write a timer program any time I want to use a timer. What about a special class of variables called 'timers' in addition to integer and state called 'timers'. The easiest way would be to reduce the value by 1 every second, but it could be more useful to allow a few more options to specify how much to reduce/increase the variable by and at what interval. And of course, being able to set them in programs would be awesome.
MWareman Posted June 27, 2015 Posted June 27, 2015 You could ask 20 different people how they want this to work - and get 20 different answers. What stops a timer? When restarted - does it restart from the beginning? Where it left off? Does only that device changing stop or reset the timer - what about allowing other devices to interrupt the timers? The list goes on and on... Instead, UDI has created a framework that allows us to create a timer in whatever way we desire without having to implement many, many different methods. Just my $0.02. Michael.
fryfrog Posted June 27, 2015 Author Posted June 27, 2015 All of those are still answerable and configurable inside the programming framework using existing methods, just like they are not. I'm just saying having *one* program that is 3-4 lines acting as a timer is silly. I'm only talking about literally a variable that automatically counts down. What happens at the end is part of your programming. What resets it is part of your programming. Nothing stops or resets it, as long as the timer is not 0 it counts down.
stusviews Posted June 28, 2015 Posted June 28, 2015 What resets it is part of your programming. Nothing stops or resets it, as long as the timer is not 0 it counts down. If Control 'device' is Switched On Then Wait ... will reset the timer whenever the device is turned On If Control 'device' is Switched On And Control 'device' is not Switched Off Then Wait ... will reset the timer whenever the device is switched On and stop the timer whenever the device is switched Off
fryfrog Posted June 28, 2015 Author Posted June 28, 2015 Maybe I'm doing things weird?I have a whole house fan that I hook up to a timer that counts down by the minute, a button on a keypad is used to add or remove minutes from the timer. The other timer I use is for house occupancy, it goes by the hour. Right now I just reset it to 24 every time an "event" happens, but then at 1 hour remaining I send a warning. For simpler things like closet lights that turn off after X minutes, I use the method you describe.
apostolakisl Posted June 28, 2015 Posted June 28, 2015 If you want a timer that has an adjustable duration you will always need to have a program dedicated to that, no matter what UD builds into the firmware. There is no way for the firmware to know what it is you would want to add/subtract minutes/seconds/hours to your timer. But as far as timers that start at a fixed length and can be restarted or terminated, a single program that both controls the actions of the timer and the timer itself is already built in to ISY firmware via the wait command. If you want a timer that can not be restarted or terminated you need an extra trigger program that gets disabled while the timer runs. This has long been an issue of debate since both wait and repeat programs are affected by it, sometimes in a good way, sometimes not.
fryfrog Posted June 30, 2015 Author Posted June 30, 2015 Okay, this wasn't a well thought out idea. Please ignore it!
larryllix Posted July 1, 2015 Posted July 1, 2015 Actually that may have some merit. Have a command to set a timer type variable in seconds. The variable timer automatically counts down to zero and stops. When the timer variable hits zero it triggers conditional events. Supports the event style processing triggers. if Control 'door1' is switched on Then set variable 'Countdown Timer 1' to 120 seconds else -- if Control 'door2' is switched on Then set variable 'Countdown Timer 1' to 90 seconds else -- if Control 'door3' is switched on Then set variable 'Countdown Timer 1' to 60 seconds else -- If 'Countdown Timer 1' = 0 AND Status 'door' is On Then Notify 'door open more than 120 seconds' Very simple example but it should exemplify the idea for more advanced apps. Then
Recommended Posts
Archived
This topic is now archived and is closed to further replies.