Announcement

Collapse
No announcement yet.

Turn On device for X time period

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

    Turn On device for X time period

    Is this the preferred way to run a device for a specified amount of time? What I'm really looking for is a way to just code Turn On Device for X hours at the end of that time, turn it off.

    Thanks in advance.

    Click image for larger version

Name:	Capture.JPG
Views:	92
Size:	56.7 KB
ID:	1475760

    #2
    Not in my opinion if the times are fixed, known and pre-determined... In that use case where times are set and predefined, create two distinct events, one to turn on at 7:30 am and the other to turn off at 7:30 pm.

    Comment


      #3
      Unless your starting time sometimes changes and you always want it to run for 12 hours....I agree with Brientim above. Have an event for each.
      .

      Comment


        #4
        Originally posted by outbackrob View Post
        Unless your starting time sometimes changes and you always want it to run for 12 hours....I agree with Brientim above. Have an event for each.
        yes, it will likely be triggered by an offset of sunrise so it will be changing.

        Comment


          #5
          Then that is probably the closest thing to "turning on a device for X hours and at the end of that time, turn it off." Seems like the cleanest way to do it if the trigger is regularly changing.
          .

          Comment


            #6
            Originally posted by outbackrob View Post
            Then that is probably the closest thing to "turning on a device for X hours and at the end of that time, turn it off." Seems like the cleanest way to do it if the trigger is regularly changing.
            Can I use a variable value contained in a Virtual Device for the amount of time to wait before turning it off? It would be great if there was a WiKi about some common things I could do like this. Thanks.

            Comment


              #7
              Probably. My scripting days ended when HS3 came out. If I can't do it in the event engine, I can't do it. It would be AWESOME to calculate the average daily temperature and have the pump run time based on that. Could save a few hours of running each day.
              .

              Comment


                #8
                Originally posted by avpman View Post

                Can I use a variable value contained in a Virtual Device for the amount of time to wait before turning it off? It would be great if there was a WiKi about some common things I could do like this. Thanks.
                I do exactly that in my irrigation event because the irrigation device doesn't have variable times, just a set of fixed on times. So I turn it on for a fixed time, then use a virtual device to turn it off before that time ends. This is in HS3, but I can't see why HS4 would treat it differently. The middle line stops the event for the number of seconds defined by virtual device 1099 in my system. I keep these in a group called "Settings".

                This has been working without issue for years.

                Click image for larger version

Name:	Untitled.png
Views:	62
Size:	17.6 KB
ID:	1475879

                Comment


                  #9
                  Originally posted by mterry63 View Post

                  I do exactly that in my irrigation event because the irrigation device doesn't have variable times, just a set of fixed on times. So I turn it on for a fixed time, then use a virtual device to turn it off before that time ends. This is in HS3, but I can't see why HS4 would treat it differently. The middle line stops the event for the number of seconds defined by virtual device 1099 in my system. I keep these in a group called "Settings".

                  This has been working without issue for years.

                  Click image for larger version  Name:	Untitled.png Views:	0 Size:	17.6 KB ID:	1475879
                  How does your logic behave if there is a power outage during the runtime? I reset my Pi during the pool runtime yesterday and it lost track of the calculated off time and ran until I manually turned off the pump. Accounting for a power outage is not important for the pool pump because I can go back to a defined off time. Just wondering about the scheme of things...

                  Comment


                    #10
                    Originally posted by avpman View Post

                    yes, it will likely be triggered by an offset of sunrise so it will be changing.
                    Why not have an Off event triggered by an offset of sunrise which is 12 hours more than the trigger for the On event? So if your On event is 45 minutes after sunrise, make the off event 12 hours 45 minutes after sunrise.
                    Karl S
                    HS4Pro on Windows 10
                    242 Devices
                    56 Z-Wave Nodes
                    37 Events
                    HSTouch Clients: 3 Android, 1 iOS
                    Google Home: 3 Mini units 1 display

                    Comment


                      #11
                      Originally posted by ksum View Post

                      Why not have an Off event triggered by an offset of sunrise which is 12 hours more than the trigger for the On event? So if your On event is 45 minutes after sunrise, make the off event 12 hours 45 minutes after sunrise.
                      Thanks, that's the workaround to losing the delay I'm going to use. Was just wondering what others do when they lose power, or whatever, and HS loses track of a length of time.

                      Comment


                        #12
                        Originally posted by avpman View Post

                        How does your logic behave if there is a power outage during the runtime? I reset my Pi during the pool runtime yesterday and it lost track of the calculated off time and ran until I manually turned off the pump. Accounting for a power outage is not important for the pool pump because I can go back to a defined off time. Just wondering about the scheme of things...
                        The sprinkler value and controller both turn off due to the loss of power.


                        Sent from my Pixel 2 using Tapatalk

                        Comment


                          #13
                          Originally posted by mterry63 View Post
                          The sprinkler value and controller both turn off due to the loss of power.


                          Sent from my Pixel 2 using Tapatalk
                          Loss of HS power, reboot etc. Not mains power

                          Comment


                            #14
                            Though I have no evidence to back it up, my long term experience has created some superstitions:
                            • In general, automatic recovery schemes after power outage are not to be trusted.
                            • Long term delayed device control may not work as expected -- scheduled device changes sometimes get "lost".
                            • Issuing a Z-wave command to turn something off doesn't guarantee that it will happen.
                            To humor my superstitions, I would tackle the problem you describe with two events (as others have described): one to turn the pump on, and one to turn it off.

                            I would trigger the event that turns off the pump:
                            IF pool_pump has been On for at least 12 hours
                            THEN set pool-pump to Off

                            Some implications of this approach:
                            • HS is pretty good about remembering when something got turned on, even across shutdowns and power outages. It also knows reliably what time it is whenever it is running, regardless of interruption history. So, the suggested trigger is likely reliable.
                            • If the system happens to be down at the 12-hour running mark, then the pump will be turned off at the earliest opportunity, just after HS is again running.
                            • As previously indicated, a Z-wave device is not necessarily turned off just because an event tells it to. In this unlikely scenario, the "off" event triggers repeatedly, once per second, until the pump controlling Z-wave device reports that it has indeed switched to its "off" condition. I have seen many posters get into runaway event execution trouble by using "at least," when "exactly" is called for. In this case, however, it actually gives you a little extra protection.

                            Comment


                              #15
                              Originally posted by avpman View Post

                              Loss of HS power, reboot etc. Not mains power
                              For me, HS3 is on a UPS and running as a service. I'm on Windows 10 Pro with Group Policy set to never let updates reboot my machine without my interaction. HS3 is very stable, I can't say I've had this happen. If by chance it did, the Irrigation controller won't run a zone more than 30 minutes as a failsafe.

                              Comment

                              Working...
                              X