Announcement

Collapse
No announcement yet.

Recurring trigger but only IF

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

    Recurring trigger but only IF

    Is there a way to run an event with a recurring trigger, say every 10 minutes, but only if a devices status changes first?
    Example, a virtual device changes to ON, then run another event every ten minutes.

    #2
    Use a separate event and enable/disable it automatically based on your virtual device state.

    Enable/disable event can be done either with Easytrigger or HS script command

    Comment


      #3
      Your question is intriguing because I think I understand what you are asking, but there's no easy answer without using a script is my first thought. I *always* figure out a way to put all of my automations in Events without having to resort to scripts (at least in HS4).

      It would me to help you if you could describe the use-case, ie, exactly what you are trying to accomplish?

      Comment


        #4
        Originally posted by Demusman View Post
        Is there a way to run an event with a recurring trigger, say every 10 minutes, but only if a devices status changes first?
        Example, a virtual device changes to ON, then run another event every ten minutes.
        Why not use the Virtual Device as a Condition? This Event will only run when the device is On.

        Click image for larger version

Name:	278D3D9F-862F-4A2F-9C10-0F531F2A35E4.jpg
Views:	142
Size:	20.7 KB
ID:	1586041

        HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          Originally posted by 123qweasd View Post
          Use a separate event and enable/disable it automatically based on your virtual device state.

          Enable/disable event can be done either with Easytrigger or HS script command
          Trying not to use scripting and don't have easy trigger. Still can't understand why it's not integrated in HS??
          I'm still contemplating both, usually like to stay away from scripts just to keep things neater but may go that way.... or I may buy easy trigger.

          Comment


            #6
            Originally posted by randy View Post
            Why not use the Virtual Device as a Condition? This Event will only run when the device is On.

            Click image for larger version

Name:	278D3D9F-862F-4A2F-9C10-0F531F2A35E4.jpg
Views:	142
Size:	20.7 KB
ID:	1586041
            Thought about that too. My only problem with it, and I may be wrong here, is the system this is running on only has 1 gig of RAM and a very weak processor.
            So I'm trying to minimize as much usage as I can (until I can get the owner to upgrade) and my understanding is that will still trigger every 10 minutes but won't run based on the condition. Does a recurring trigger put any stress on the system?

            Comment


              #7
              Originally posted by Demusman View Post

              Thought about that too. My only problem with it, and I may be wrong here, is the system this is running on only has 1 gig of RAM and a very weak processor.
              So I'm trying to minimize as much usage as I can (until I can get the owner to upgrade) and my understanding is that will still trigger every 10 minutes but won't run based on the condition. Does a recurring trigger put any stress on the system?
              A recurring Trigger (or any other Trigger) consumes practically no CPU, when any of the Conditions are False. Only when a Trigger and all Conditions are True, does an Event run. If the Trigger is True but any Condition is false, the system moves on after the quick test. Even at that, it will only test the Condition(s) once every 10 minutes. It will not affect CPU usage.
              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                Good to know! Thanks.

                Comment


                  #9
                  While Randy's suggestion will work, the problem is that the whatever it is that you're trying to kick-off to run every 10 minutes won't start the moment when your device changes state. suggestion will give you better granularity in that the 10 minute recurring cycle will happen exactly when the device changes state.

                  Comment


                    #10
                    Originally posted by TC1 View Post
                    While Randy's suggestion will work, the problem is that the whatever it is that you're trying to kick-off to run every 10 minutes won't start the moment when your device changes state. suggestion will give you better granularity in that the 10 minute recurring cycle will happen exactly when the device changes state.
                    This would depend on how HS handles a Recurring Trigger when an Event is disabled. Recurring Triggers are not suspended when an Event is Disabled.

                    When I ran the Event by turning the Virtual Device On, it ran 7.5 minutes later.

                    1/12/2023 11:48:12 AM HomeSeer Event Event Trigger "HomeSeer Demo Recurring "
                    1/12/2023 11:41:53 AM HomeSeer Device Control Device: HomeSeer Demo Virtual to On (100) by/from: CAPI Control Handler


                    When I enabled the Event at 11:53 it ran just over 5 minutes later.

                    1/12/2023 11:58:12 AM HomeSeer Event Event Trigger "HomeSeer Demo Recurring "

                    This shows that neither method will start the recurring process at exactly 10 minutes after the device goes On.

                    I suppose two answers are important:
                    1. Does the Event need to run at the moment the Virtual Device is on?
                    2. Do the recurring Triggers need to begin at exactly 10 minutes after the Device is turned On and every 10 minutes thereafter?
                    If the timetable is critical, the following Event will do it. The First Trigger and Condition set will run every 10 minutes, beginning after the first time. When the Event runs, the timer is restarted at 0, beginning the recurring aspect. .

                    Click image for larger version  Name:	capture.png Views:	0 Size:	33.3 KB ID:	1586091

                    This resulted in the Event running at the moment the Virtual Device is turned on and every 10 minutes thereafter.

                    1/12/2023 12:30:02 PM HomeSeer Event Event Trigger "HomeSeer Demo Recurring 1"
                    1/12/2023 12:20:01 PM HomeSeer Event Event Trigger "HomeSeer Demo Recurring 1"
                    1/12/2023 12:20:01 PM HomeSeer Device Control Device: HomeSeer Demo Virtual to On (100) by/from: CAPI Control Handler

                    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                    Comment


                      #11
                      randy thanks for verifying the behavior of enabling a recurring trigger event, I based my answer on a hunch and was going to do the actual experiment later. Thanks for doing the heavy lifting

                      Comment


                        #12
                        trying to optimize my events I looked at this tonight. I think what I came up with (screenshot below) is an updated version of Randy's suggestion for the nested When/If that covers starting / stopping the timer dependent on a virtual device (enabled/disabled) + if the target physical device(s) are a specific state - in my case, Open. Plus added a general notification for each windows, as they open if sends an updated list of all open windows.

                        FYI - my Composite Windows device (generated by a script I posted a while back) 'Status text' lists all open windows - thus the Pushover sends a list of all currently open windows, and has a link to Disable Alerts (set my 'System Alerts' device to off)

                        LMK if you see any errors or potential optimizations. thx!

                        Click image for larger version

Name:	image.png
Views:	120
Size:	104.5 KB
ID:	1615856
                        ​​​​
                        Last edited by Ltek; May 22, 2023, 01:21 AM. Reason: expanded the event

                        Comment

                        Working...
                        X