Announcement

Collapse
No announcement yet.

Count up timer, but why no count down timer?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Count up timer, but why no count down timer?

    There are timers in HS3 and HS4 that can be used to count up. But generally, like an egg timer, you want to count down to an event.

    An example would be turning off a light after the last motion is detected in a room. You can set a delay, but then when another motion is detected you end up with an endless string of events that fire off forever turning of the damn light! If I want to set a timer to turn off the light after 10 minutes of no motion, but then I see motion, I'd like to add some time to the timer (not always the same amount) so when it goes to 0 it will trigger.

    This will make writing timed and delayed events much more reasonable.

    If you want a real world example.

    Let's say you have a kid that you put in the corner for 15 minutes because they did something dumb. But during that time they swear. What's easier, just adding 10 more minutes to their time out of going in and modifying an event to reset a count up timer from the current time and then finding the delayed event from the old one and deleting it.

    Also, when you are boiling eggs, and in the middle decide to add 3 more eggs, the water temperature drops, so you just twist your egg timer to add a couple more minutes. That's why egg timers count down not count up. You don't launch rockets by counting up to a time do you.

    I'm baffled why this simple thing is not available. If it is, can someone point me to it? I'm writing such events right now to handle lighting timeouts when someone opens a door, if someone opens the same door before the count up occurs I would like to add some time to the timer. Right now, the damn light turns off at the time in which the door was opened the FIRST time!

    I see that the controls could be the almost exactly the same with Reset, Start, Stop, Resume and Set with possibly an Add time function.

    So am I missing something?

    Thanks.

    #2
    Originally posted by George View Post
    I'm baffled why this simple thing is not available. If it is, can someone point me to it? I'm writing such events right now to handle lighting timeouts when someone opens a door, if someone opens the same door before the count up occurs I would like to add some time to the timer. Right now, the damn light turns off at the time in which the door was opened the FIRST time!
    The easiest way to do this with native HS commands is not with a timer, but by using delayed device action or delayed events. Randy provided a typical example here (last example).
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Please re-read my post. If you use delayed actions, i just queued a delayed event for the that time. If you want to change it you can't. You have to hunt down the queued delayed action and delete it and then reset another delayed action.

      Try this. Create an event that turns on your hallway light for 5 minutes every time your door opens. Pretty simply right,

      If Front Door opened
      Then,
      Turn on Hallway Light
      Turn off Hallway Light after 5 minutes.

      Right?

      Then open and close the door once a minute for about 20 minutes. You'll find that there are now 20 delayed actions, every one of then turning off the light before the last time you opened the door! The damn light will never stay on for 20 minutes!

      I already specified that delayed actions or delayed events does NOT accomplish the same thing!

      Comment


        #4
        Did you read the link Mike posted? It seems to take into account your exact scenario about re-triggering the delayed action and starts a fresh 5 minute delay by canceling the previous delayed action . At least that's the way i read it.

        Comment


          #5
          Yes, but what if I just want a count down timer to speak something after a certain amount of time. Or to just trigger a plugin action? But want to add time.

          In that case, I there are no devices attached to that event or timer. And if I want to delay the speech, just how do I do that?

          His case is for removing a delayed device, but how about a general fire an event when a timer gets to zero?

          Let's use HomeSeer to launch a rocket,,,, FAIL! ABORT, EXPLOSIONS!

          Comment


            #6
            I have yet to upgrade to HS4, but they are saying that on HS4 you can set a timer to a negative value (time), and it will count up from there. Which is functionally equivalent to a count down timer.

            For my Kitchen Timer (on HS3), I set a Virtual Switch to my time (in minutes), then create a one minute timer that decrements the Virtual Switch (and restarts the timer), and when the Virtual switch reaches zero, sounds the alarm. I use a virtual switch so that I can display the remaining time on a HS Touch screen, but a global variable would also work. One advantage to this method is that it is easy to modify or cancel the Kitchen Timer, just by changing the virtual switch value.

            Comment


              #7
              Originally posted by George View Post
              Yes, but what if I just want a count down timer to speak something after a certain amount of time. Or to just trigger a plugin action? But want to add time.
              In that case, I there are no devices attached to that event or timer. And if I want to delay the speech, just how do I do that?
              His case is for removing a delayed device, but how about a general fire an event when a timer gets to zero?
              Can you provide a more specific example of what you want to do?
              What do you envision doing to add time? Press a button? Rotate a dial? Adjust a slider?
              Do you want/need a constant readout of the remaining time?

              You can use the same scheme as in Randy's example to run an event, just use a delayed event in place of a delayed device action and cancel pending delayed events as the first action in the calling event.

              Mike____________________________________________________________ __________________
              HS3 Pro Edition 3.0.0.548, NUC i3

              HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

              Comment


                #8
                Yep, one can set a negative timer in HS4 to count towards zero (I've down it).... the only wrinkle is that it keeps counting past zero. One would then have to write a separate event to detect the zero value and stop the timer. I lot of work for a simple timer, hence why I stay away from timers in HS4 and just use wait statements and virtual devices similar to what others have described. The virtual device also has the advantage of visibility and direct control over it as aa6vh described.

                Comment


                  #9
                  Originally posted by TC1 View Post
                  Yep, one can set a negative timer in HS4 to count towards zero (I've down it).... the only wrinkle is that it keeps counting past zero. One would then have to write a separate event to detect the zero value and stop the timer. I lot of work for a simple timer, hence why I stay away from timers in HS4 and just use wait statements and virtual devices similar to what others have described. The virtual device also has the advantage of visibility and direct control over it as aa6vh described.
                  Can you just set the stop time at 1 second then (00:00:01)? At least until the zero problem gets fixed. I suspect that the one second inaccuracy is not going to be a problem for most uses. And if it is, then just subtract that additional one second from the initial minus time that is set.

                  Comment


                    #10
                    Originally posted by aa6vh View Post

                    Can you just set the stop time at 1 second then (00:00:01)? At least until the zero problem gets fixed. I suspect that the one second inaccuracy is not going to be a problem for most uses. And if it is, then just subtract that additional one second from the initial minus time that is set.
                    I'm not sure what you mean by "stop time"? The only functionality I see in setting up timers in HS4 is Start, Stop, Resume, Restart and Set (the initial value). As indicated before, one can set a separate event that triggers on the timer value of X in order to stop it, but I personally have no desire to have to setup multiple events just to manage my timers when time and state machine functionality can be achieved in better ways (like the examples Randy gives), IMO.

                    Comment


                      #11
                      Originally posted by TC1 View Post

                      I'm not sure what you mean by "stop time"? The only functionality I see in setting up timers in HS4 is Start, Stop, Resume, Restart and Set (the initial value). As indicated before, one can set a separate event that triggers on the timer value of X in order to stop it, but I personally have no desire to have to setup multiple events just to manage my timers when time and state machine functionality can be achieved in better ways (like the examples Randy gives), IMO.

                      I guess I always assumed that an event would be created for when the timer gets to a specific value, so that something can be done about it. How else would timers work?

                      Comment


                        #12
                        Originally posted by aa6vh View Post


                        I guess I always assumed that an event would be created for when the timer gets to a specific value, so that something can be done about it. How else would timers work?
                        Agreed... hence another point, why does one need a countdown timer? What's the difference whether one triggers on 10 minutes (from a count up) or 0 minutes (from a countdown of 10 minutes). It's still a 10 minute time span, right?

                        By using the delayed actions/waits inside events, one can eliminate additional events just to trigger on timers.Many ways to skin a cat, no right or wrong answers.

                        Comment


                          #13
                          Originally posted by TC1 View Post

                          Agreed... hence another point, why does one need a countdown timer? What's the difference whether one triggers on 10 minutes (from a count up) or 0 minutes (from a countdown of 10 minutes). It's still a 10 minute time span, right?
                          "Problem" I ran into was, I wanted to send an initial warning at 15 minutes and subsequent ones every 5. With a count up timer, needed to trigger on 15 minutes, then start it at zero initially, and to 10 (15 - 5) subsequently. Works, but ugly (especially down the road, as the neurons start to fade faster).

                          Comment


                            #14
                            Originally posted by zwolfpack View Post

                            "Problem" I ran into was, I wanted to send an initial warning at 15 minutes and subsequent ones every 5. With a count up timer, needed to trigger on 15 minutes, then start it at zero initially, and to 10 (15 - 5) subsequently. Works, but ugly (especially down the road, as the neurons start to fade faster).
                            Or just do it as delay or wait statements in one event..

                            WAIT 15 minutes
                            THEN send/trigger notification/other-event
                            WAIT 5 minutes
                            THEN send/trigger notification/other-event
                            WAIT 5 minutes
                            THEN send/trigger notification/other-event

                            If you want to do infinite 5 minute notifications then there's some different logic needed.

                            Comment


                              #15
                              Originally posted by George View Post
                              You don't launch rockets by counting up to a time do you...
                              The trope of counting down began with filmmaker Fritz Lang who felt that counting down instead of up created more dramatic tension....

                              https://www.atlasobscura.com/article...9-1f0d72a193db

                              HS4 Pro on Shuttle NC10U, Win10; Z-NET
                              Number of Devices: 449
                              Number of Events: 210

                              Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

                              External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

                              Comment

                              Working...
                              X