Announcement

Collapse
No announcement yet.

EVENT order of execution...

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

    EVENT order of execution...

    Hi,

    I have an application which has 3 MOTION DETECTORS to turn on a light, so I create an EVENT and use IF, OR IF, OR IF to set up the MOTION DETECTORS to turn on the light. Of course, I don't want them coming on in the daylight, so I have an AND IF at the end to only enable the MOTION DETECTORS at night.

    In normal programming I would use parentheses to force an order/precendence of execution, (a + b + c) . d.

    How do I achieve this without resorting to a script ?

    Regards,
    BRIAN

    #2
    Each IF and OR IF trigger needs a separate AND IF condition.
    -Wade

    Comment


      #3
      Originally posted by Wade View Post
      Each IF and OR IF trigger needs a separate AND IF condition.
      Wade,

      Thanks for the reply. I should have suspected that. Guess it's time to bite the bullet and get scripting !

      Regards,
      BRIAN

      Comment


        #4
        Greetings brian_sadler,

        Try this out...

        Click image for larger version  Name:	3 Motion Event.PNG Views:	0 Size:	364.9 KB ID:	1450750

        So to answer your question on ordering, I believe this is how it is treated.

        IF (M1 + bNighttime) or (M2 + bNighttime) or (M3 + bNighttime) = True, Then Do Something.


        Note: (Motion_1 AND bNighttime) (bNighttime AND Motion_1)

        Be safe!

        Roger
        Last edited by Roger D; January 24, 2021, 07:22 AM. Reason: Changed graphic

        Comment


          #5
          Check out the "Event Clinic" for a more complete explanation on how events work.

          https://forums.homeseer.com/forum/ho...3-event-clinic

          Even though it was written for HS3, it still applies to HS4.

          Comment


            #6
            Originally posted by Roger D View Post
            Greetings brian_sadler,

            Try this out...

            Click image for larger version Name:	3 Motion Event.PNG Views:	0 Size:	364.9 KB ID:	1450750

            So to answer your question on ordering, I believe this is how it is treated.

            IF (M1 + bNighttime) or (M2 + bNighttime) or (M3 + bNighttime) = True, Then Do Something.


            Note: (Motion_1 AND bNighttime) (bNighttime AND Motion_1)

            Be safe!

            Roger
            Roger,

            Thanks for the explanation.

            Did you mean:
            IF (M1 . bNighttime) + (M2 . bNighttime) + (M3 . bNighttime) = True, Then Do Something, where "+" is OR and "." is AND ?

            I think the in-line code is OK and I'll give that a try

            I don't understand why "A and B", (A . B) is not the same as "B and A", (B . A). Another mystery to add to the big list

            Regards,
            BRIAN

            Comment


              #7
              Originally posted by aa6vh View Post
              Check out the "Event Clinic" for a more complete explanation on how events work.

              https://forums.homeseer.com/forum/ho...3-event-clinic

              Even though it was written for HS3, it still applies to HS4.
              David,

              Thanks for the reference.

              Regards,
              BRIAN (AI6MK)

              Comment


                #8
                Brian,

                "where "+" is OR and "." is AND" Yes, that is correct.



                As far as (Motion_1 AND bNighttime) (bNighttime AND Motion_1)…

                When used in the design of an "AND IF" Event, "Motion_1" is a "Trigger" and bNighttime is a "Condition." In other words,

                The "Condition" must already be True before the "Trigger" can fire.

                  Trigger      Condition
                    🠗           🠗
                (Motion_1 AND bNighttime) = Nighttime has to be active before motion can turn on the lights.

                (bNighttime AND Motion_1} = Motion has to be active before nighttime can turn on the lights. ❌


                Hope this helps,

                Roger D

                Comment


                  #9
                  Originally posted by Roger D View Post
                  Brian,

                  "where "+" is OR and "." is AND" Yes, that is correct.


                  As far as (Motion_1 AND bNighttime) (bNighttime AND Motion_1)…

                  When used in the design of an "AND IF" Event, "Motion_1" is a "Trigger" and bNighttime is a "Condition." In other words,

                  The "Condition" must already be True before the "Trigger" can fire.

                    Trigger      Condition
                      🠗           🠗
                  (Motion_1 AND bNighttime) = Nighttime has to be active before motion can turn on the lights.

                  (bNighttime AND Motion_1} = Motion has to be active before nighttime can turn on the lights. ❌


                  Hope this helps,

                  Roger D
                  Roger,
                  Thanks very much with the follow up. Yes that clears it up. Of course in boolean arithmetic there is no sense of TRIGGER and CONDITION.
                  Scratch one off the big list...it's a good day !
                  Regards,
                  BRIAN

                  Comment

                  Working...
                  X