Announcement

Collapse
No announcement yet.

Event: If Then Else

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

    Event: If Then Else

    Trying to figure out how to do an If Then Else Event.
    This should be a fairly common scenario

    If Trigger X is true
    then
    Run Event A
    Else Run Event B

    The only way that I can figure out how to do this without scripting would be to use several events using group conditions.

    Anyone have examples?
    DSteiNeuro

    HS3Pro

    MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

    Enabled Plug-Ins
    BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

    #2
    OK Got it (Thanks Randy)

    Takes 3 events. One to trigger dependent on the conditions set in the individual events to run and the 2 actual events, each with a true/false condition.

    Can be expanded to multiple events each with a separate condition.
    The key is to run Run Only If Other Event Conditions are True

    --------------------


    Event 1
    Trigger Manual
    Condition is And If: This is the case IF is True
    Then run Event A

    Event 2
    Trigger Manual
    Condition is And If: This is the case IF is False (else)
    Then Run Event B


    Trigger Event to run events (If Then)

    Trigger Manual (or whatever)
    Then Run Event 1
    (Run Only If Other Event Conditions are True)
    Then Run Event 2
    (Run Only If Other Event Conditions are True)

    Only one of the two events will run dependent on the condition (true or false) set in the individual events

    DSteiNeuro
    DSteiNeuro

    HS3Pro

    MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

    Enabled Plug-Ins
    BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

    Comment


      #3
      That'e exactly how it is supposed to work.

      I'm glad the threads made sense.
      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Originally posted by rprade View Post
        I'm glad the threads made sense.
        Yes. helpful!

        The part about the "Run Only If Other Event Conditions are True" is not overly intuitive.
        I originally thought that this referred to the Group Conditions. This way is much more powerful.
        DSteiNeuro

        HS3Pro

        MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

        Enabled Plug-Ins
        BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

        Comment


          #5
          I get the logic, but fail to see how it works for me

          Hi,

          I see how this works, but in my situation, I have a virtual device to determine if a set of lights and devices are On or Off. The core control in the picture, triggers other events that switch the devices, update the status of the Cooper scene controllers and update the interfaces on the devices where HSTouch is deployed (currently 3 x Android, 2 x iOS and 1 x windows).

          What I cannot figure out is how to stop a perpetual loop. Event 1 when Virtual Device GoodMorning in ON, switches the lamps etc and sets the virtual device to Off, then Event 2 assesses Virtual Device GoodMorning and it is now Off and goes ahead and switches all the devices On.

          This is not as explicit as a true if-then-else or a case statement, or am I getting the logic mixed up?

          Any pointers would help.

          The reason for doing this is to ensure that all HSTouch devices and the scene controllers have their status correct since they do not update in a passive fashion.

          Steve
          Attached Files

          Comment


            #6
            Originally posted by crossedswords View Post
            I see how this works, but in my situation, I have a virtual device to determine if a set of lights and devices are On or Off. . . .What I cannot figure out is how to stop a perpetual loop.
            Have you tried your events and actually get a loop? Based on your description, I would not expect a loop to develop.

            If the event that triggers these two events has specified that the conditions need to be true, only the event that corresponds to that current state of your virtual device should run. The other event will not run, even though the virtual device changes state, because the decision to run is made before the state change occurs.

            If you do see a loop, please post a screen shot of the event that triggers these two.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition 3.0.0.548, NUC i3

            HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

            Comment


              #7
              Will Try

              Thanks Uncle Michael for your quick response. I will give it a try and see what happens. I guess I am failing to see the hierarchy of the commands when both events are called in sequence as per the example earlier in this thread.

              Will update after a trial.

              Steve

              Comment


                #8
                Finally Figured it out

                Thanks for the advice again Uncle Michael. Spent the morning and persisted with the logic and I now have a working system.

                I had to separate the trigger actions from the scene controller into an event group, the trigger actions from the HSTouch devices into an event group and the actions I needed from the triggers into an event group.

                So now, a scene on from either of the 2 scene controllers or 5 HSTouch devices trigger the correct event actions and similarly for an event off, although pressing the scene button to turn off does not appear to work, the All Off button on the Cooper controllers does and the HSTouch modules work correctly.

                Personally, I would still prefer to have a single page of commands rather than individual snippets cross-referencing each other.

                But that is just me.

                Again, Many thanks for the feedback.

                Steve

                Comment


                  #9
                  Originally posted by crossedswords View Post
                  Personally, I would still prefer to have a single page of commands rather than individual snippets cross-referencing each other.

                  But that is just me.
                  Steve
                  Not just you-- it is standard programming practice. Events should be able to have an else in them. I see it as a lacking feature.
                  HS3 Pro Edition 3.0.0.435 (Windows Server 8.1 on ESXi box)

                  Plug-Ins Enabled:
                  Z-Wave:,RaspberryIO:,AirplaySpeak:,Ecobee:,
                  weatherXML:,JowiHue:,APCUPSD:,PHLocation:,Chromecast:,EasyTr igger:

                  Comment


                    #10
                    Originally posted by DSteiNeuro View Post

                    --------------------


                    Event 1
                    Trigger Manual
                    Condition is And If: This is the case IF is True
                    Then run Event A

                    Event 2
                    Trigger Manual
                    Condition is And If: This is the case IF is False (else)
                    Then Run Event B


                    Trigger Event to run events (If Then)

                    Trigger Manual (or whatever)
                    Then Run Event 1
                    (Run Only If Other Event Conditions are True)
                    Then Run Event 2
                    (Run Only If Other Event Conditions are True)

                    Only one of the two events will run dependent on the condition (true or false) set in the individual events

                    DSteiNeuro

                    I am still having issues with this logic. The above triggers both events for me. For example, I am trying to manually trigger the following:

                    (Event #1) IF Device = ON, Turn Off,

                    (Event #2) If Device = OFF, Turn ON (Dim 17%)


                    Event #3 is the Trigger Event and calls both Event #1 and Event #2 (in that order). All events are set to run manually.

                    Let's say the Device is currently OFF. When I trigger Event #3, it calls Event #1 and doesn't do anything. It then runs Event #2 and turns the device ON.

                    Good so far.... but....

                    Now that the device is ON, when I manually trigger Event #3 again it runs Event #1 and turns the Device OFF (good) but it then continues on to Event#2 and turns the device right back ON (bad).

                    This is why we need true ElseIf capabilities in HS3.

                    The only other way I can see around this (without having to create virtual devices which still need multiple events) is with scripting which is fine for me but not very user friendly for the average Joe.

                    Comment


                      #11
                      Originally posted by ramshaklez View Post
                      I am still having issues with this logic. The above triggers both events for me. For example, I am trying to manually trigger the following:

                      (Event #1) IF Device = ON, Turn Off,

                      (Event #2) If Device = OFF, Turn ON (Dim 17%)


                      Event #3 is the Trigger Event and calls both Event #1 and Event #2 (in that order). All events are set to run manually.

                      Let's say the Device is currently OFF. When I trigger Event #3, it calls Event #1 and doesn't do anything. It then runs Event #2 and turns the device ON.

                      Good so far.... but....

                      Now that the device is ON, when I manually trigger Event #3 again it runs Event #1 and turns the Device OFF (good) but it then continues on to Event#2 and turns the device right back ON (bad).

                      This is why we need true ElseIf capabilities in HS3.

                      The only other way I can see around this (without having to create virtual devices which still need multiple events) is with scripting which is fine for me but not very user friendly for the average Joe.
                      I am not experiencing the same as you are describing.

                      I *think* the problem is that in event 1 the device is being checked for on while in event 2 the device is set to 17%. "On" is not equal to "17%".

                      This fully toggles the light in my test events.
                      Attached Files
                      Len


                      HomeSeer Version: HS3 Pro Edition 3.0.0.435
                      Linux version: Linux homeseer Ubuntu 16.04 x86_64
                      Number of Devices: 633
                      Number of Events: 773

                      Enabled Plug-Ins
                      2.0.54.0: BLBackup
                      2.0.40.0: BLLAN
                      3.0.0.48: EasyTrigger
                      30.0.0.36: RFXCOM
                      3.0.6.2: SDJ-Health
                      3.0.0.87: weatherXML
                      3.0.1.190: Z-Wave

                      Comment


                        #12
                        Originally posted by ramshaklez View Post
                        I am still having issues with this logic.

                        Now that the device is ON, when I manually trigger Event #3 again it runs Event #1 and turns the Device OFF (good) but it then continues on to Event#2 and turns the device right back ON (bad).
                        Can you post a screen shot of your events? I think that would help me to better understand the way your events are set up.
                        Mike____________________________________________________________ __________________
                        HS3 Pro Edition 3.0.0.548, NUC i3

                        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                        Comment


                          #13
                          Originally posted by lveatch View Post
                          I am not experiencing the same as you are describing.

                          I *think* the problem is that in event 1 the device is being checked for on while in event 2 the device is set to 17%. "On" is not equal to "17%".

                          This fully toggles the light in my test events.
                          In your forum event 1 you have the following two lines.

                          Then If the Event Conditions are True, Run Event_forum testing forum event 1
                          Then If the Event Conditions are True, Run Event_forum testing forum event 2

                          I see no way to create those "Then" commands.

                          EDIT:

                          I figured it out. This requires Easy Trigger to work.
                          Last edited by Timon; October 23, 2017, 11:39 AM. Reason: Figured out what's going on.
                          HomeSeer Version: HS3 Standard Edition 3.0.0.548
                          Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
                          Number of Devices: 484 | Number of Events: 776

                          Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
                          3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
                          4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
                          3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

                          Z-Net version: 1.0.23 for Inclusion Nodes
                          SmartStick+: 6.04 (ZDK 6.81.3) on Server

                          Comment


                            #14
                            Originally posted by Timon View Post
                            In your forum event 1 you have the following two lines.

                            Then If the Event Conditions are True, Run Event_forum testing forum event 1
                            Then If the Event Conditions are True, Run Event_forum testing forum event 2

                            I see no way to create those "Then" commands.

                            EDIT:

                            I figured it out. This requires Easy Trigger to work.
                            Those are not Easy Trigger actions, they are standard HomeSeer actions, with an advanced function enabled.

                            .


                            This thread may help.
                            HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

                            Comment


                              #15
                              Originally posted by rprade View Post
                              Those are not Easy Trigger actions, they are standard HomeSeer actions, with an advanced function enabled.

                              .


                              This thread may help.
                              Thanks, I totally missed that one.

                              However, I have a question. It seems for this to work the current condition of all of the test must be done before the actual calls to the events are done if not it would still fail.

                              I need to find the description for this in the helpful guides.
                              Last edited by Timon; October 23, 2017, 04:37 PM.
                              HomeSeer Version: HS3 Standard Edition 3.0.0.548
                              Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
                              Number of Devices: 484 | Number of Events: 776

                              Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
                              3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
                              4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
                              3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

                              Z-Net version: 1.0.23 for Inclusion Nodes
                              SmartStick+: 6.04 (ZDK 6.81.3) on Server

                              Comment

                              Working...
                              X