Announcement

Collapse
No announcement yet.

Dynamically set how often an event runs

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

  • Ltek
    replied
    I use a few devices that have a drop down with ten values. It works well

    Leave a comment:


  • Uncle Michael
    replied
    Originally posted by lbusch1313 View Post
    And it works!!! Right now I just click on the slider, not drag so only one event fires. The new interval registers, sets "Every X minutes" interval time to the new value.
    Great.
    BTW, have you considered using a drop list rather than a slider? That might prevent large changes from triggering the event multiple times, and a list with 10 values in it will display all the choices easily.

    Leave a comment:


  • lbusch1313
    replied
    And it works!!! Right now I just click on the slider, not drag so only one event fires. The new interval registers, sets "Every X minutes" interval time to the new value. Done for tonight I think. Next project, grouping my Big5 created devices (parent/child).

    Leave a comment:


  • lbusch1313
    replied
    Almost there!! Thanks to everyone for the help. In the end, I took bits and pieces from several suggestions to get the main routine working. Still some to do but I now can set an event interval from a script. Uncle Michael, you sent me down the path I eventually used..thanks. Logman, I may yet try an implementation of the timer. So...here's the t script that sets the event recurring time:

    Imports System.IO

    Sub Main(parm as object)
    Dim RefVal As Integer = hs.GetEventRefByName("Event Run Time")
    Dim dblTimerTime As Double = hs.DeviceValueEx(225)
    Dim dteTS As Timespan = TimeSpan.FromMinutes(dblTimerTime)
    hs.EventSetRecurringTrigger(refVal, dteTS, False, False)
    hs.SaveEventsDevices()
    End

    Still to do : string it all together. I can see a "got ya" if a big slider change calls the event multiple times. It's seems a little slow right now.
    Thanks again. I've been at this most of the day .. hey I have all of 5 days on this device and no VB or Net background to speak of.

    Leave a comment:


  • logman
    replied
    This would work:

    First, create a timer called "Slider Timer". Then create these 2 events:

    Click image for larger version  Name:	event1.png Views:	0 Size:	43.0 KB ID:	1309627
    Click image for larger version  Name:	event2.png Views:	0 Size:	46.8 KB ID:	1309628

    Note: Be sure to set Event 2 where it can't rerun for a few seconds (5 in my example) so that it doesn't refire several times in the milliseconds between the trigger firing and the timer resetting.

    --Barry

    Leave a comment:


  • Wadenut
    replied
    I don't see, off the bat. why it wouldn't. One way to find out...
    Might want to reset the timer along with the counter.
    Uncle Michael did offer a more elegant solution, but it would require a simple script.

    Leave a comment:


  • Wade
    replied
    Would this work?

    IF timer = 00:01:00
    THEN increment counter
    THEN restart timer

    IF counter >= slider
    THEN trigger HTTP get
    THEN reset counter to zero

    The >= (as opposed to equals) should trap a condition where the slider is manually lowered to below the counter value.

    Leave a comment:


  • Uncle Michael
    replied
    Originally posted by lbusch1313 View Post
    I sure get the challenging part . It's a bit simpler, I think. This is all happening in the HS3 web interface.
    Oops. Sorry. That does make it a bit simpler.
    I think an event that runs a script like the one below every time the interval device value changes should do what you want.
    Change '1388' to the RefID of your device (225, by my reckoning).
    Change '9212' to the EventID of the recurring event. (That is a bit more difficult to find. I use Jon00's Event Viewer.)

    Code:
    Public Sub Main(ByVal Parms As Object)
    
            Dim dblTimerTime As Double = hs.DeviceValueEx(1388)
            Dim dteTS As Timespan = TimeSpan.FromMinutes(dblTimerTime)
    
            hs.EventSetRecurringTrigger(9212, dteTS, False, False)
    
        End Sub

    Leave a comment:


  • lveatch
    replied
    Not a scripting option, however you could set up 10 duplicate events to run every minute and use your interval slider as a condition ( and if) to execute a 11th manually triggered common event containing your big 5 actions - if they are common.

    For each of the 10 events, expand the options and change the "cannot rerun" setting to the appropriate number of minutes.

    You can set up one event and copy 9 times editing the 9 to change the condition and cannot rerun settings.

    Leave a comment:


  • lbusch1313
    replied
    I sure get the challenging part . It's a bit simpler, I think. This is all happening in the HS3 web interface. I haven't even thought about HS Touch yet. I made a virtual device "slider" that goes from 1 to 10. I have an event named "Every X Minutes". It triggers a Big5 HTTP get for my PWS. It's currently set to 5 but I would like to set the "5 minutes" to whatever value is set by the "slider". I set up an "Interval Slider" event to fire on the "slider" change. All that remains is to figure out how to set the time interval in the "Every X Minutes" event when the "Interval Slider" event fires.
    Click image for larger version

Name:	Screenshot_2019-06-09 HomeSeer Web Control.png
Views:	257
Size:	33.8 KB
ID:	1309564
    Click image for larger version

Name:	Screenshot_2019-06-09 HomeSeer Web Control - Ev .png
Views:	258
Size:	18.9 KB
ID:	1309565
    Attached Files

    Leave a comment:


  • Uncle Michael
    replied
    I assume you are referring to a slider in HSTouch. If so, the only way I can think of that might work is to run a script (on a button press) with the value from the slider, and then have the script modify the recurring trigger value in the event. (You would need to supply the Event RefID, the frequency (From the slider) converted to a time span by your script, and two Logic values, presumably both 'False'.
    See the HS Help file, Scripting/Events/Modifying Events.

    Public Function EventSetRecurringTrigger(ByVal evRef As Integer, ByVal Frequency As TimeSpan, _
    ByVal Once_Per_Hour AsBoolean, _
    ByVal Reference_To_Hour AsBoolean) AsBoolean

    I haven't actually done this, mind you. But seems like it might do what you want. Could be a challenging project and "learning opportunity". [You could also ask Spud to add the capability to the plug-in, of course.]

    Leave a comment:


  • lbusch1313
    replied
    Same problem, can't figure out how to set the timer interval dynamically. Both the "Event will automatically trigger every..." option and the "Control a timer" >> "Set Timer" option end in the same static selection pick boxes. There ought to be a way but frankly I can't even get commands to run in the control panel. I'm new at this but migrated from Vera where I understood the Luup language and could have done this in about 1 minute. I'm hours in and no closer to an answer. I'm using the Sel-Pro box. and can't find a single example script that will run in the control panel. I've read the recommended scripting sections of the Homeseer manual, such as it is and no go. I can get some scripts to run in a local HS3 window and am now considering returning the SEL-Pro and maybe keeping an HS3 windows box up full time.

    Leave a comment:


  • Wadenut
    replied
    Maybe set a timer to the value of "Slider". When the timer reaches the value, trigger the event. Add an action to the event to restart the timer.

    Leave a comment:


  • lbusch1313
    started a topic Dynamically set how often an event runs

    Dynamically set how often an event runs

    I would like to dynamically set how often an event runs, say every 1 to 10 minutes. I created a virtual device "slider" that sets the interval value, but can't see how to assign that value to an event repeat interval in HS3. Is this possible? Seems like a reasonably useful event triggering option.

    I looked through the Easy Trigger User Guide examples but none seem to apply. Later posts suggest a lot has been added though.
Working...
X