Announcement

Collapse
No announcement yet.

Event Order of Execution (How to toggle a setting using a single scene button.)

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

    Event Order of Execution (How to toggle a setting using a single scene button.)

    Is the order of execution of events deterministic in some way?

    If a trigger (Scene button) triggers two events, is there any way to know which one of these will be executed first?

    The basic problem I am trying to solve is to have a scene button Toggle a setting. Press and the light turns on, and press again and the light turns off.

    IF SceneButton AND ToggleFlag is Off then
    ToggleFlag= On
    Turn Light On

    IF SceneButton AND ToggleFlag is On then
    Toggle= Off
    Turn Light Off

    If these are executed sequentially, BOTH conditions will execute when the SceneButton is pressed and the ToggleFlag is Off.

    Is there an easier, more accepted way of doing a toggle in HomeSeer?


    #2
    Originally posted by SeattleDavid View Post
    Is the order of execution of events deterministic in some way?

    If a trigger (Scene button) triggers two events, is there any way to know which one of these will be executed first?

    The basic problem I am trying to solve is to have a scene button Toggle a setting. Press and the light turns on, and press again and the light turns off.

    IF SceneButton AND ToggleFlag is Off then
    ToggleFlag= On
    Turn Light On

    IF SceneButton AND ToggleFlag is On then
    Toggle= Off
    Turn Light Off

    If these are executed sequentially, BOTH conditions will execute when the SceneButton is pressed and the ToggleFlag is Off.

    Is there an easier, more accepted way of doing a toggle in HomeSeer?
    The easiest way to do it is to use the condition (status) the Toggle flag alone.

    Tip: Try the EasyTrigger plugin by spud



    Eman.
    TinkerLand : Life's Choices,"No One Size Fits All"

    Comment


      #3
      I have already purchased EasyTrigger.

      But I don’t understand what you are suggesting to do with it in regards to this problem.

      Comment


        #4
        Originally posted by SeattleDavid View Post
        I have already purchased EasyTrigger.

        But I don’t understand what you are suggesting to do with it in regards to this problem.
        IF SceneButton pressed
        THEN EasyTrigger: Toggle Device

        then in the toggle action select your Light Device and On / Off controls

        Comment


          #5
          Ah, I didn’t realize/remember that there was a Toggle Device action. Yes, that would work and be clean.

          Then, I would still need two more events triggered by the device changing...one for what to do when on and one for what to do when off.

          Thanks for the suggestion.

          <Grumble>I don’t really understand why HS3 doesn’t have If/Then logic, it would really simplify many things and promote clarity</grumble>

          Comment


            #6
            I found that using wait statements can also resolve having both events possibly fire off:

            IF SceneButton AND ToggleFlag is Off then
            Wait 1 second
            ToggleFlag= On
            Turn Light On

            The wait allows both events to be evaluated before the tasks are started.

            Comment

            Working...
            X