Announcement

Collapse
No announcement yet.

Nesting events, or using a single trigger with multiple condition paths

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

  • Nesting events, or using a single trigger with multiple condition paths

    Many users find that the IF, OR IF, AND IF structuring becomes too cumbersome with multiple paths that can be taken after a given trigger. There is a way you can have multiple OR IF branches off of a single trigger or group of triggers without having to build an unmanageably large event. You simply create multiple events with different conditions and nest them under events with still more conditions and/or triggers.


    Below I will post a series of screenshots and descriptions of some nested events I use for complex thermostat programming. In our Colorado climate we have extremely cold winter temperatures and normally cold winter temperatures, plus we can see radical swings in a half a day. This affects the amount of time it takes for the heat to return from a daytime or nighttime setback. The morning may need additional time to recover from setback, but the next afternoon may not. My wife also works one of three different shifts, affecting the time we return from night and day setbacks. I also turn the heat up in her bathroom about 30 minutes before she goes in to shower on work days. We also use different setback temperatures when we are home on a normal work day. On weekends when we are housebound we disable weekend setbacks during the day. All of this is controlled by a set of virtual devices below.





    The devices are just as I described above. The weekend setback allows us to disable daytime setback temperatures when we are homebound. The Schedules are Vacation, Non-Work, Work-Early, Work-Mid and Work-Late. The programming control virtual device lets us suspend automatic schedule changes, essentially locking temperatures where they are. The Extreme Cold Offset is controlled by outside temperatures to change the recovery time from setback based on how cold it is. The Thermostat Mode Override is not used in this series of events.

    All of those virtual devices can be set manually, or controlled by scheduling events or by temperature changes. What we need to do is to load the correct schedules in the thermostats based upon those variables. While I am certain that scripts could be written to take care of thermostat programming changes, this is all event driven.

    The first thing we need is the triggering event. It is based upon any of three virtual devices being changed. We need to detect those changes, then load the correct schedules based upon the values of those 4 devices.





    You will notice that the above event has 3 separate triggers, all based on any change in status of the three involved devices. If the outside temperature changes the Extreme Cold Offset device or if we make manual or programmed changes to either of the other two devices, this event will run. We need to continually monitor these devices for change so that any change loads the new appropriate programming. The only Action in this event is to call the next event "Thermostat Programming Thermostat Programming Check". Advanced options tell the Event Engine to respect the conditions in the event being called.





    The above event will then call ALL of the possible changes to thermostat programming, but since the conditions in the called events are being respected only one of the long list will be true. This makes it possible to have a bunch or "OR IF" possibilities all based upon the trigger or group of triggers in the first event.

    Below are two examples of the actual program loading events used. You will note that each of them has three conditions based upon the virtual devices used in the initial triggering event.








    While this is a very complex example, the illustration is still valid for a means of having multiple paths that can be taken by a single trigger. There may be a practical limit to how deep you can nest events, there really isn't a physical one. Also remembering that HomeSeer is capable of multi-threading, despite the fact that I am calling 18 events from the second one, only the ones where all of the conditions are met will actually run, the rest of the threads will end as soon as one of the conditions is not met. That means that though it looks like a lot is going on, very little processor overhead is needed.

    Remember that each branch of the flow can have additional conditions, allowing for very complex evaluation of a series of conditions in a very systematic fashion.
    Randy Prade
    Aurora, CO
    Prades.net

    PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

  • #2
    I used to live in Aurora Co. I lived-in the ghetto off Mississippi ave apartments.. It was a strange time in my life at what seemed to me a very strange place. Besides that, this example looks a little dreadful. Is this something that has evolved to its current galactic state, or was this the intention from the first line?

    I was looking for something that had two potential triggers with a common set of (AND IF's).. So I have an IF and then an OR IF, AND IF, THEN....

    Will the first IF in the event, if it is true, skip the AND IF, located after the OR IF and go straight to THEN?
    I looked through the huge list you have, but I didnt see anything similar ..

    I dont have curtains so when anybody is in the kitchen at night, the outside lights come on so we can see everything out side. Thanks for the posting.
    Click image for larger version

Name:	Screen Shot 2015-05-01 at 1.04.24 AM.jpg
Views:	1
Size:	40.1 KB
ID:	1178419

    Comment


    • #3
      Or do I need to make a second set of AND IF's? For example
      Click image for larger version

Name:	Screen Shot 2015-05-01 at 1.15.52 AM.jpg
Views:	1
Size:	50.9 KB
ID:	1178420


      Will these two examples function the same?

      Comment


      • #4
        Originally posted by Name View Post
        I used to live in Aurora Co. I lived-in the ghetto off Mississippi ave apartments.. It was a strange time in my life at what seemed to me a very strange place. Besides that, this example looks a little dreadful. Is this something that has evolved to its current galactic state, or was this the intention from the first line?

        I was looking for something that had two potential triggers with a common set of (AND IF's).. So I have an IF and then an OR IF, AND IF, THEN....

        Will the first IF in the event, if it is true, skip the AND IF, located after the OR IF and go straight to THEN?
        I looked through the huge list you have, but I didnt see anything similar ..

        I dont have curtains so when anybody is in the kitchen at night, the outside lights come on so we can see everything out side. Thanks for the posting.
        [ATTACH]45879[/ATTACH]
        If the first trigger is true, the event will run, ignoring the second trigger and its associated conditions. The second trigger (the OR IF) will evaluate the conditions directly below it. Each IF (or OR IF) begins a fresh trigger/condition set that is evaluated individually, if the trigger and conditions within that trigger's group are all true, the event will run. That gap created between an IF statement, with any directly associated conditions, is HomeSeers way of conveying it is a completely separate block from the next group started by the OR IF trigger, which can have ist own set of conditions.


        This thread attempts to explain how it all works.
        Randy Prade
        Aurora, CO
        Prades.net

        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

        Comment


        • #5
          Originally posted by Name View Post
          Or do I need to make a second set of AND IF's? For example
          [ATTACH]45880[/ATTACH]


          Will these two examples function the same?
          This is the correct method. This event will apply the same pair of conditions to either trigger. The two examples will NOT function the same.
          Randy Prade
          Aurora, CO
          Prades.net

          PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

          Comment


          • #6
            I see, thanks I really appreciate the new found clarity. I dont think it could not have been explained any better..

            Comment


            • #7

              Comment

              Working...
              X