Announcement

Collapse
No announcement yet.

Run a script periodicaly as long as a devices value is set to a certain value

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

  • Run a script periodicaly as long as a devices value is set to a certain value

    I would like to do the following:

    When a device changes its value and becomes=1, then run a script once every minute as long as the device's value is a 1, but when the device's value changes and becomes = 0, then I need to stop running the script every minute. I have not found a way to stop the event from running once it starts.

  • #2
    Is this an immediate script in an event? And is it a script that runs quickly and completes/terminates, or does it continue for more than a minute?
    -Wade

    Comment


    • #3
      There may be more to this than I'm reading from your description, but it sounds like you simply need to use the device as a condition in the event that calls the script.

      IF the event will trigger every 1 minute
      AND IF device value = 1
      THEN run script

      If you don't want it to evaluate every minute when unneeded, you could use use Easy Trigger plugin to enable/disable the event via additional events.

      IF device has its value set and value <> 1
      THEN EasyTrigger Disable Event [event name]

      IF device value changes and becomes 1
      THEN EasyTrigger Enable Event [event name]
      -Wade

      Comment


      • #4
        Originally posted by cc4005 View Post
        IF the event will trigger every 1 minute
        AND IF device value = 1
        THEN run script
        +1

        If you don't want it to evaluate every minute when unneeded, you could use use Easy Trigger plugin to enable/disable the event via additional events.
        Aside from satisfying latent OCD tendencies, I suspect that disabling the event and re-enabling it is more effort than it's worth - and might even use more resources than letting HS simply not run it when the condition isn't satisfied.

        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

        Comment


        • #5
          I will disagree with that. I suspect little overhead when enabling/disabling an event. I suppose one factor though would be how often you enabled and disbled, and how long the enabled time lasts.

          But I approached this in a different way. I created a timer that expires at 1 minute. The event that fires at the one minute mark stops/resets the timer, then if the conditions are still true, does whatever needs to be done, and then starts the timer over again.

          Comment


          • #6
            A different approach...Assuming it is a straight action script like do A,B,C and we're done.

            This will run only if your device value is 1 and will not re-run for 1 minute. When your value goes back to 0 the event trigger will not be true anymore. It offers lots of timing flexibility with the has been for... and do not Re-run For...

            Click image for larger version

Name:	Capture.jpg
Views:	70
Size:	108.7 KB
ID:	1349571

            Comment


            • #7
              Originally posted by cc4005 View Post
              There may be more to this than I'm reading from your description, but it sounds like you simply need to use the device as a condition in the event that calls the script.

              IF the event will trigger every 1 minute
              AND IF device value = 1
              THEN run script
              I vote for this one. Compact, clean and low resources.

              Randy Prade
              Aurora, CO
              Prades.net

              PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

              Comment


              • #8
                As always, many ways to get the fur off a kitten. Great community here.
                -Wade

                Comment


                • #9
                  Thanks for all the responses, I am looking at all of them. The post from cc4005 looks good to me
                  I appreciate the help

                  Comment

                  Working...
                  X