Announcement

Collapse
No announcement yet.

how to define a changable variable to end a timer

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

    how to define a changable variable to end a timer

    I have an event that when a timer reaches 3 minutes it turns off lights and stops the timer
    If I want a double tap of a switch to increase the stop time to say 15 minutes how do I set up a variable that is changeable through an event to change the compare end time for the timer.


    any Help

    THANX
    MITCH

    #2
    Originally posted by Mitch View Post
    I have an event that when a timer reaches 3 minutes it turns off lights and stops the timer
    If I want a double tap of a switch to increase the stop time to say 15 minutes how do I set up a variable that is changeable through an event to change the compare end time for the timer.


    any Help

    THANX
    MITCH
    Without scripting, you would have to use a Virtual Device. When you double tap the switch it would turn the Virtual Device on and when the light turns off it would turn the Virtual Device off.

    You would start the timer when the light is turned on.

    You would have two events to turn it off, one at three minutes IF the Virtual Device is OFF and another at 15 minutes IF the Virtual Device is ON.
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    Comment


      #3
      I am curious about the use case. Why would you want to momentarily change the delay for when a light is turned off? I have my motions set to turn off lights after no motion for 30 seconds in some areas (high traffic) and they stay on reliably until no one is around.

      Comment


        #4
        Originally posted by waynehead99 View Post
        I am curious about the use case. Why would you want to momentarily change the delay for when a light is turned off? I have my motions set to turn off lights after no motion for 30 seconds in some areas (high traffic) and they stay on reliably until no one is around.
        There are so many cases where motion sensors do not see motion.
        example I walk through the gym to get to my office. I would want the gym lights off after 3 minutes. My wife goes to the gym and gets on the inversion table and hangs there for 15+ minutes she needs a way of telling the system to extend the timer. And yes she constantly leaves lights on which is why I want to keep the controls by timers.

        Comment


          #5
          There's very likely a stream of OCD in all of us. That's part of why we like HA as a hobby. On the other hand, leaving the lights on for 15 minutes rather than 3 comes at a fairly small cost.

          If you - like me - think of the challenge to figure out how to solve a problem like this is fun, then by all means go for it. But, the simplest solution (and possibly the most cost effective as well) is just to set the timer for the longest quiet period you expect to need and live with it.
          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


            #6
            how to define a changable variable to end a timer

            Yea in the kitchen I have the delay set to 15 minutes vs the laundry room is set to 30 seconds. I just figure amount of motion actually happening in the room and set the delay the highest needed to keep the lights on for the wife (in the beginning she almost lost it on me when I had delays really low).

            I can see the use case where the room has mixed motion though. What Randy suggested is probably the best route. Create a virtual device that is controlled by the double tap. I would only change to have the timer restart when no motion is detected. Have the timer pause when motion is detected. This will allow the delay to be determined by motion over the light being on and it just turn off at 3 or 15 minutes.

            Comment


              #7
              Occupancy probability approach to lighting control

              I started experimenting with an approach that is along the lines of what you want to do utilizing concepts Randy noted. It is more events than it could be done with other ways, but I was interested in testing a more generic concept of using different inputs to determine occupancy probability, then use the determined value to control the lights.

              Below is the light to control and virtual devices. One virtual device is the occupancy probability to be controlled by different events. The other is a simple on/off device set in events to stop decrementing the occupancy value.

              Click image for larger version

Name:	Occupancy Devices.png
Views:	1
Size:	32.1 KB
ID:	1185032


              Below are events triggered by the PIR that increment the occupancy probability if it is not low and to set to a medium value if it is low. More motion = higher probability of occupancy. In conjunction with other events below this means lights on longer for higher occupancy probability. I used immediate script commands to do simple math as part of the concept which might get more sophisticated later. The occupancy virtual device is Ref 301.

              Click image for larger version

Name:	Occupancy Motion.png
Views:	1
Size:	93.0 KB
ID:	1185037


              Below are events to turn off the lights when the occupancy probability is low enough and turn it on when the occupancy probability is high enough.

              Click image for larger version

Name:	Occupancy light control.png
Views:	1
Size:	60.8 KB
ID:	1185033


              Below are events that decrement the occupancy probability once per minute. Logging is turned off so these decrements don't fill up the log. Unfortunately the immediate script executions still get logged, can't figure out how to disable those.

              Click image for larger version

Name:	Occupancy timer-decrement.png
Views:	1
Size:	83.7 KB
ID:	1185036


              Below are switch double click events that permanently leave the light off or on. In your case you could have double clicks add even more to the occupancy value to leave lights on longer.

              Click image for larger version

Name:	Occupancy double clicks.png
Views:	1
Size:	53.0 KB
ID:	1185034


              Below are switch single click events that re-enable the occupancy decrement to restore normal motion control.

              Click image for larger version

Name:	Occupancy on-off press.png
Views:	1
Size:	57.8 KB
ID:	1185035

              John
              Last edited by jhearty; June 7, 2016, 09:01 PM.

              Comment


                #8
                Three other options, not mutually exclusive (I use all of these):
                1. Install additional motion sensors, especially in strategic locations to capture motion that is unique to the area being monitored.
                2. Record motion data for the area and analyze it for characteristic patterns that reflect different activities. Use those patterns to determine how long to wait for motion before determining the area is unoccupied.
                3. Add a warning signal, e.g. a sound, dimming or flashing the lights, so someone in the space can deliberately activate a motion sensor before the lights go out.
                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


                  #9
                  All of our motion controls can be bypassed. With the new HSWx100+ devices it is a breeze for everyone to remember. A press and hold of either the top or bottom paddle makes the light stay on or off regardless of motion. A single press of either restores it.

                  When motion is enabled the lights will go out when there has been no motion for 5-15 minutes depending on the location.

                  In the exercise room for example, we press and hold the top paddle, disabling motion control while we are in the room, keeping the lights on. When we leave the room we turn the lights off which restores motion control.

                  Also we can press and hold the bottom paddle preventing the lights from coming on with motion, if desired.

                  All lights have housekeeping events that will turn them off after two hours with no motion, regardless of whether motion control is enabled or not and all motion control is enabled every morning at 4:00 AM.

                  Tis system satisfies all of our needs.

                  Before the HSWx100+ controls, we did the same with on-off-on or on-off at the switch.
                  HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                  Comment


                    #10
                    Originally posted by rprade View Post
                    All of our motion controls can be bypassed. With the new HSWx100+ devices it is a breeze for everyone to remember. A press and hold of either the top or bottom paddle makes the light stay on or off regardless of motion. A single press of either restores it.

                    When motion is enabled the lights will go out when there has been no motion for 5-15 minutes depending on the location.

                    In the exercise room for example, we press and hold the top paddle, disabling motion control while we are in the room, keeping the lights on. When we leave the room we turn the lights off which restores motion control.

                    Also we can press and hold the bottom paddle preventing the lights from coming on with motion, if desired.

                    All lights have housekeeping events that will turn them off after two hours with no motion, regardless of whether motion control is enabled or not and all motion control is enabled every morning at 4:00 AM.

                    Tis system satisfies all of our needs.

                    Before the HSWx100+ controls, we did the same with on-off-on or on-off at the switch.
                    I really like this idea and I have been ordering new switches as funds permit... but I am not sure how to do what you are doing with the dimmer switches which is primarily what I am buying. If I hold the button just to adjust the light level, but still want motion...

                    Comment


                      #11
                      Originally posted by waynehead99 View Post
                      I really like this idea and I have been ordering new switches as funds permit... but I am not sure how to do what you are doing with the dimmer switches which is primarily what I am buying. If I hold the button just to adjust the light level, but still want motion...
                      I have to admit that most of the switches we use this on regularly are binary. The dimmers work as well. All you have to do is to "punctuate" a brightness change with a tap (after waiting a second) which will restore motion control. We use default levels (day, twilight, night) on our dimmers, so we usually do not need to adjust their brightness. We are thinking of adding a "deep night" level to some rooms to set them at an even lower level after the house is put to "sleep". In the bathrooms where we will frequently override the defaults, it is not a problem that it disables motion control, because it is restored when we turn the lights off.

                      You probably could also use a timer to time how long it is between "key held" and "key released" to determine whether you were adjusting the dim level or just trying to initiate a "scene". I haven't played with the timing, but I would bet if the difference between the two is greater than 2 seconds it would represent a dim level change. I will play with that idea later today.
                      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Originally posted by rprade View Post
                        In the exercise room for example, we press and hold the top paddle, disabling motion control while we are in the room, keeping the lights on. When we leave the room we turn the lights off which restores motion control.
                        Randy,
                        How is this different from a manual light switch? In my experience, it's remembering to turn the light switch back off when leaving a room that is the biggest problem. When do you use motion control on the lights?
                        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


                          #13
                          Originally posted by waynehead99 View Post
                          I really like this idea and I have been ordering new switches as funds permit... but I am not sure how to do what you are doing with the dimmer switches which is primarily what I am buying. If I hold the button just to adjust the light level, but still want motion...
                          I do the same things as Randy, but use double clicks instead of press/hold. The double and triple clicks never control the load directly so you can use them for this type of thing without worrying if the user just wanted to control the load. The example I posted yesterday uses double click on to mean leave that light on and double click off to mean leave that light off. I had money to burn and installed HS-Wx100+ switches in the entire house, and every lighting control switch (some WS's, mostly WD's) all have events for the same double click functionality (not implemented the way I posted but same net result).

                          Comment


                            #14
                            Originally posted by Uncle Michael View Post
                            Randy,
                            How is this different from a manual light switch? In my experience, it's remembering to turn the light switch back off when leaving a room that is the biggest problem. When do you use motion control on the lights?
                            Generally we don't disable the motion control, because the timing is fine for normal activities. This is a multi purpose room and occasionally during exercise the lights may timeout because the motion is too close to the floor. There are also times when we might not want the lights to come on with motion. 99% of the time the lights just take care of themselves, it is just nice to have options when the automation does not fit a specific situation.

                            Also the lights still have housekeeping events that will catch us if we forget to turn them off and all of our lights are LED, so energy is not a real factor.
                            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                            Comment


                              #15
                              Originally posted by Uncle Michael View Post
                              Randy,
                              How is this different from a manual light switch? In my experience, it's remembering to turn the light switch back off when leaving a room that is the biggest problem. When do you use motion control on the lights?
                              Fair point. For us, motion control remains operational 98% of the time. Only on occasion do we want to disable it to leave it on or leave it off. When we do, the leave it on/off function is reset to normal nightly in case we failed to single click the switch to restore it manually. Randy described doing that after an hour.

                              Comment

                              Working...
                              X