Announcement

Collapse
No announcement yet.

How would you write this event

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

    How would you write this event

    Lets say you have a door opening triggering a light on. Then a three minute timer turns the light out after the door closes.

    Now during that three minutes, the door is opened again so you want the timer stopped until the door closes, then have the three minute timer again.
    -Tim

    HSPro - 3.XXX - Dell mini W7 x32
    Way2 Call
    Elk M1 Gold
    UPB HAI switches
    HAI RC2000 Thermostat

    #2
    Do you have one event to turn the light on and then off after three minutes or are you running two events, one for open and one for close?

    I think I would start the event by removing the delayed device actions for the light, then turn the light on, then turn the light off after three mins..do all of that in the one event, if you re-trigger the event it should remove the already existing timer and start it again

    In theory anyway I think that will work...you can find the remove delayed device action in the action drop down list

    Comment


      #3
      Thanks. That makes sense.

      I originally had a wait command after the light on. I changed it to the delay. I wonder what the difference is.
      -Tim

      HSPro - 3.XXX - Dell mini W7 x32
      Way2 Call
      Elk M1 Gold
      UPB HAI switches
      HAI RC2000 Thermostat

      Comment


        #4
        I have an event that runs once a minute that runs a script. One of the things it does is check to see if the closet light has been on for more then 3 minutes, and if so, turns it off. Each time the door comes open and turns the light on (even if it is already on) the device time restarts.

        tenholde
        tenholde

        Comment


          #5
          Interesting. Forgive me because I don't know anything about scripts.

          Why would you run this as a script instead of just an action?
          -Tim

          HSPro - 3.XXX - Dell mini W7 x32
          Way2 Call
          Elk M1 Gold
          UPB HAI switches
          HAI RC2000 Thermostat

          Comment


            #6
            I have a whole series of devices that I want to operate for a certain duration, ie anytime a bathroom light is turned on, the fan in that room runs for 15 minutes. I find it easier to have one script that controls all of these scenarios instead of having many events.

            tenholde
            tenholde

            Comment


              #7
              Originally posted by email68 View Post
              TI originally had a wait command after the light on. I changed it to the delay. I wonder what the difference is.
              When you use the wait command, your event sits and waits, and all subsequent actions are held up.

              When you use delay, the action with the delay actually creates a new temporary event. That event has an absolute time trigger that is the current time plus the delay. When the trigger time is reached, the temporary event executes and then HS deletes it. That allows HS to manage resources more efficiently, and is almost always a better choice than wait if the time involved is more than a few seconds.

              To 'reset the timer' (there is no actual timer, just the master clock) you tell HS to delete all delayed events associated with a device, and then execute a new delayed action (which will create a new delayed event with the trigger time reset).

              FWIW, Tenholde is a professional software expert. Writing scripts for him is like breathing for you and me. I suspect that's part of the reason he is inclined to use scripts more frequently than most of us.
              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
                I assume you're using a door sensor to turn the light on, right? So, why not just create one conditional event that turns off the light when the door has been closed for at least 3 minutes? Can it be that simple or am I missing something?

                Here's an example of a conditional event that turns a light off after it's been on at least 3 minutes. Just substitute the door sensor being closed for at least 3 minutes in the trigger.
                Attached Files
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  Mark,
                  I think the problem is that if the light is in an area that gets repeated traffic, then there may be times when you want it to remain on longer than three minutes. You really need to have the condition keep track of some measure of traffic. In this case, I think turning the light off when the closet door has been closed for three minutes, might be the way to go. Unless, of course, there are kids in the house. Then the door state may not be a useful measure either, hence the need to turn the light off automatically in the first place.
                  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


                    #10
                    Since I can't script very well I do it all by events. These are the events that run my Powder room. Maybe they will help you with ideas for your own. The trigger is a I/O module that is connected to a door contact to sense opened and closed.
                    Attached Files
                    Marty
                    ------
                    XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
                    Playing with HS3 a bit but it's just play at this point.

                    Comment


                      #11
                      Marty,
                      You are starting to make HS dance!

                      FWIW, if all you want to do is turn a light on and off, I've found that motion sensing light switches (Lowe's, Home Depot) work reliably, are easy to install, allow you to adjust on time, reset automatically if new motion is detected, and don't depend on a computer running. The only requirement is that to work this way, they need to be located inside the subject area. Unfortunately, standard practice puts light switches outside closet doors, so unless you move the switch inside (which kind of negates the easy to install part), the scheme doesn't work for the one application where it is most useful. (Current models also don't work with CFLs, but I expect that will change....someday.)
                      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


                        #12
                        Originally posted by email68 View Post
                        Lets say you have a door opening triggering a light on. Then a three minute timer turns the light out after the door closes.

                        Now during that three minutes, the door is opened again so you want the timer stopped until the door closes, then have the three minute timer again.
                        I'm just addressing the initial request... not trying to second guess any other possibilities... FYI
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment


                          #13
                          Originally posted by macromark View Post
                          I'm just addressing the initial request... not trying to second guess any other possibilities... FYI
                          Oops. I was responding to your suggested event, not what you wrote in the message. I think there is a typo in the event. It has the condition set as the time the light has been on, rather than time the door has been closed.
                          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


                            #14
                            Originally posted by Uncle Michael View Post
                            Oops. I was responding to your suggested event, not what you wrote in the message. I think there is a typo in the event. It has the condition set as the time the light has been on, rather than time the door has been closed.
                            That's why I wrote "Just substitute the door sensor being closed for at least 3 minutes in the trigger."
                            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                            Comment


                              #15
                              I run the following script every 60 seconds. It would be easy to adapt to your needs. Seems simpler than building and maintaining 15 individual events, but that is the beauty of HS -- many ways to accomplish what you need.

                              Code:
                              Sub Main(ByVal Parms As Object)
                                      '' Basement Cedar Closet Door
                                      If hs.IsOn("]6") Then
                                          '' Cedar Closet Open
                                          If hs.DeviceTime("]6") > 15 Then
                                              hs.Speak("The cedar closet door is open")
                                          End If
                                      End If
                                      '' Jack and Jill Bathroom Fan
                                      If hs.IsOnByName("J and J Bath Ceiling Fan") Then
                                          If hs.DeviceTimeByName("J and J Bath Ceiling Fan") > 45 Then
                                              hs.ExecX10ByName("J and J Bath Ceiling Fan", "Off")
                                          End If
                                      End If
                                      '' Master Bathroom Fan and Heat
                                      If hs.IsOnByName("Master Bath Fan") Then
                                          If hs.DeviceTimeByName("Master Bath Fan") > 45 Then
                                              hs.ExecX10ByName("Master Bath Fan", "Off")
                                          End If
                                      End If
                                      If hs.IsOnByName("J and J Bath Ceiling Heat") Then
                                          If hs.DeviceTimeByName("J and J Bath Ceiling Heat") > 30 Then
                                              hs.ExecX10ByName("J and J Bath Ceiling Heat", "Off")
                                          End If
                                      End If
                                      '' Basement Bathroom Fan and Heat
                                      If hs.IsOnByName("Basement Bath Fan") Then
                                          If hs.DeviceTimeByName("Basement Bath Fan") > 30 Then
                                              hs.ExecX10ByName("Basement Bath Fan", "Off")
                                          End If
                                      End If
                                      If hs.IsOnByName("Basement Bath Heat") Then
                                          If hs.DeviceTimeByName("Basement Bath Heat") > 30 Then
                                              hs.ExecX10ByName("Basement Bath Heat", "Off")
                                          End If
                                      End If
                                      '' Guest Bathroom Fan
                                      If hs.IsOnByName("Guest Bathroom Fan") Then
                                          If hs.DeviceTimeByName("Guest Bathroom Fan") > 30 Then
                                              hs.ExecX10ByName("Guest Bathroom Fan", "Off")
                                          End If
                                      End If
                                      '' Hot Tub Fan
                                      If hs.IsOnByName("Basement Hot Tub Fan") Then
                                          If hs.DeviceTimeByName("Basement Hot Tub Fan") > 90 Then
                                              hs.ExecX10ByName("Basement Hot Tub Fan", "Off")
                                          End If
                                      End If
                                      '' UPS
                                      If hs.DeviceValueByName("tenHsPower AC Line Status") <> 1 Then
                                          hs.Speak("UPS Offline, Battery Level is " & hs.DeviceValueByName("tenHsPower Battery Life Percent") & " Percent")
                                      End If
                                  End Sub
                              tenholde
                              tenholde

                              Comment

                              Working...
                              X