No announcement yet.

Weird one

  • Filter
  • Time
  • Show
Clear All
new posts

    Weird one

    Just in time for Halloween. I had this:
    front porchmotion
    front porch light 100%
    if it's halloween
    say "Happy Halloween kids. Boo" (outside speakers)
    end if
    hs.waitsecs 60
    lights back to 40%

    Here's what happened. Despite the fact that I told the event not to trigger for 60 secs, triggered again (and again).

    Waitsecs seemed to take much longer than 60 secs. The end result is that script timed out and HS began turning lights off at random. What a mess.

    Tomorrow I'm going to work on waitsecs.


    I have been using waitsecs in hs2 and recently found an interesting threading/scheduling issue.

    It appears that when you issue the call, the thread gives up control (as it should), but other threads which issue a waitsecs call will get control back before the original caller. It's as if the scheduler is making an error in the running order.

    What this means is that if you multi-thread a script (ie allow multiple copies to execute simultaneously) you may well see bad behaviour of the sort you observe.

    A fix (though I hate its inelegance!) is to use the check box when you set up the event that runs the script to say that the script should wait until it finishes. Try that. If it clear the issue, you were probably being hit by the same issue I was.

    one day when it gets fixed, you will be able to remove that limitation and exploit the multi-threading properly.



      Did you put in a trouble ticket on this?


        Rupp - never worked out how to! just assumed osmosis works :-)



          And I'm not sure exactly what I would say on a help ticket. I did change that script to look at:

          a. Instead of waiting, I added a timed event and
          2. If that event's there, ignore the trigger.

          I hope this will get it.