Announcement

Collapse
No announcement yet.

[VB.NET] updateEvent Discussion ThreadDiscussop

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

    [VB.NET] updateEvent Discussion ThreadDiscussop

    Code is here:
    http://forums.homeseer.com/showthread.php?p=985609
    Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

    #2
    NewtimEvent and seconds

    I just came across this thread searching "hs.NewtimEvent and seconds" in the forum.
    I just discovered that hs.NewtimEvent CANNOT create an event with seconds revolution, but hs.DelayTrigger does.
    Your trick was:
    " ' As an event cannot trigger itself in seconds of resolution
    ' while it would be noticable, just trigger the event with a
    ' seconds resolute function"
    wich I found not suitable for me.

    To have the seconds resolution in a new event I figured this:
    ====================
    delai_sec = 20 'delay in seconds
    event1 = "timer example" 'either an existing event or not

    'timer launching
    ' creates an event if does not exist
    if hs.EventExists(event1) =false then
    hs.NewEventGetRef(event1)
    end if
    'create delayed event
    hs.DelayTrigger(delai_sec, event1)
    ======================

    - If the "event1" event was not created it will just create a blank event, (this is just not to have an "event missing" error in the log). This is what I will use for regular seconds timers, just by checking if exists or not:
    if hs.EventExists(event1 & " (delayed event)") then do not retrigger


    - If the " event1" was already present it will be executed with all its params when the delay stops, with seconds resolution.

    Of course it will be easier if NewtimEvent could handle seconds, wich I consider as a bug...

    I hope this helps.
    Visit zee e-maison : http://www.e-maison.com

    Comment


      #3
      Pierre,

      That is what the code is doing ;-)

      It basically looks to see if the time you are trying to "run" the new event is less than a certain number of minutes...or if it is being set to an exact number of seconds. If either of those are true, it creates a new timed event for 20 minutes away. Then using a similar method you described, it created a delaytriggered event, which runs the realy event. That way you get seconds resolution, but only when necessary.

      I am sure the delay triggered events take more resources, so I tried to not use them unless necessary.

      --Dan
      Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

      Comment


        #4
        Testing now:
        Changed around updateevent.vb

        Now includes ability to time delay launch scripts and events! YEY!

        Was able to use this to give me a delay trigger for automatic turning the fan on after someone has been in the shower.

        Basically, if the shower sensor has been triggered 3x, then the door to the bathroom is opened, the fan would go off. This worked well 95% of the time. However, there was that case where my wife would come in to comb her hair or something.

        So, I added in the ability to DELAY execute the script. So, NOW what happens:
        -3x trigger in the shower allows the door to trigger code
        -The door trigger sets a delayed script execution, which will check that the door is STILL open in 10 seconds.
        -If the door is STILL open, THEN turn the fan on. If it is closed, remove the event.

        When I am done testing this, I'll post the new version to the script thread.
        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

        Comment

        Working...
        X