Announcement

Collapse
No announcement yet.

If then else never

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

    If then else never

    I have one question and one observation:

    I have an even with If/then.

    Question: How do I add an Else
    Observation: The task set to Never is also executed (which sort of defeats NEVER).
    Attached Files

    #2
    Originally posted by kbuth View Post
    I have an even with If/then. Question: How do I add an Else
    The equivalent of an Else If is a separate event with the appropriate conditions and actions.
    Observation: The task set to Never is also executed (which sort of defeats NEVER).
    That sounds like a malfunction. I've never had that happen. How are you testing your event?
    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


      #3
      The equivalent of an Else If is a separate event with the appropriate conditions and actions.

      I was taught duplication is bad.... So that is whyu I would prefer an ELSE.

      I essentially testen by triggering the event. It was intended to say "DEVICE ON or DEVICE OFF. But now it says either nothing (if the device is OFF) or it says "DEVICE ON DEVICE OFF".

      Comment


        #4
        Originally posted by kbuth View Post
        I was taught duplication is bad.... So that is whyu I would prefer an ELSE.
        I understand. The need to create another event results from the fact that an HS event can have only one set of actions. If you want something else to happen, you need another event.
        I essentially testen by triggering the event. It was intended to say "DEVICE ON or DEVICE OFF. But now it says either nothing (if the device is OFF) or it says "DEVICE ON DEVICE OFF".
        I am suspicious that there is a problem with your event - possibly a database glitch while it was being saved. If you create it again from scratch I would expect the odd behavior to go away.
        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


          #5
          Kbuth,
          You need to do what Mike is suggesting if you want to do an else in in an event. Its the way the engine was coded, and it works really well.

          The other option you have (which is what I normally do), create scripts for more complicated events that are triggered by an event.

          This isn't really duplication, its just the way it works.

          Also NEVER shouldn't be activated. I use this a lot when testing notifications and remove my wife's phone during testing. What version of HS are you on? I don't think anything has been done to the event engine in recent months.

          Comment


            #6
            NEVER is a poor label. It is actually DISABLE. It disables the action of the event.


            Sent from my iPad using Tapatalk
            HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
            2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

            Comment


              #7
              Recreate worked

              Thanks so much. Recreating the even fixed it.

              Comment


                #8
                Originally posted by kbuth View Post
                The equivalent of an Else If is a separate event with the appropriate conditions and actions.

                I was taught duplication is bad.... So that is whyu I would prefer an ELSE.

                I essentially testen by triggering the event. It was intended to say "DEVICE ON or DEVICE OFF. But now it says either nothing (if the device is OFF) or it says "DEVICE ON DEVICE OFF".
                You can't have an "Else" unless you want that else to fire about every second. Remember a Trigger is not checking if something is true at a given moment in time (That is a "Condition" in homeseer) a trigger is the exact moment something happens. So if you are checking "If light changes and becomes "ON"", when would you consider the else? Is it when the light is not changing? Is it when it changes, but it isn't ON?

                In your example, you are checking if a device set or has changed, so then you want the else to fire every moment in time that it has not. It would never stop speaking "It is off" except the moment it says "It is on".

                What is being suggested is not duplication. It is clearly stating your If statements.

                So, in stead of

                If a device changes and becomes ON
                Then Do Y
                Else Do Z

                (which the Else is ambiguous as I've already stated) You would have :

                If a device changes and becomes ON
                Then Do Y

                If a device changes and becomes OFF
                Then Do Z

                That removes the ambiguity of the else since you are explicitly stating when you want the second action to occur.

                Comment


                  #9
                  Frank,

                  You are correct and I posted a screenshot after playing around and it is indeed not a good idea to have an else in that sample.

                  The original sample had a two line "tope: The foirst line as TRIGGER, thge second as a comparison.

                  I agree an ELSE on a trigger is very strange....

                  But I also had the problem the NEVER did fire regardless so I played and accidently posted the wrong screenshot. The "always fire" was fixed by deleting the event and recreating it.
                  Attached Files

                  Comment


                    #10
                    Originally posted by Steve Q View Post
                    NEVER is a poor label. It is actually DISABLE. It disables the action of the event.
                    And I would like to add that IF is also a poor label. I think of it as WHEN.
                    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


                      #11
                      Originally posted by lveatch View Post
                      And I would like to add that IF is also a poor label. I think of it as WHEN.


                      There is a long programming history of "if, then". I think it is the accepted and conventional terminology. "When" also works, but I don't see the need to change.

                      Steve Q


                      Sent from my iPad using Tapatalk
                      HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
                      2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

                      Comment


                        #12
                        Originally posted by Steve Q View Post
                        NEVER is a poor label. It is actually DISABLE. It disables the action of the event.
                        Originally posted by lveatch View Post
                        And I would like to add that IF is also a poor label. I think of it as WHEN.
                        People with skills in technical fields often do not take the time to consider nuances of meaning when making word choices. It's an irony that strikes me repeatedly, because 'sloppy' word choices often obscure or even detract from the elegance of the underlying technical work.
                        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
                          And I would like to add that IF is also a poor label. I think of it as WHEN.
                          +1000
                          I always thought WHEN would be much better than IF, I even suggested the change 2 years ago:
                          https://forums.homeseer.com/showthread.php?t=176618

                          Comment


                            #14
                            Originally posted by Uncle Michael View Post
                            People with skills in technical fields often do not take the time to consider nuances of meaning when making word choices. It's an irony that strikes me repeatedly, because 'sloppy' word choices often obscure or even detract from the elegance of the underlying technical work.
                            That's my point. My first programming experience was Fortran 4 on punch cards, then onto cobol on punch cards. I've lost track of the number of languages I've programmed in.

                            I'm do not think that I'm programming on the HS interface, I'm doing configuration. "When" vs "if" eliminates the ELSE thought process, at least for me.... "when this occurs and this is true / in effect then do something".
                            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


                              #15
                              Originally posted by spud View Post
                              +1000
                              I always thought WHEN would be much better than IF, I even suggested the change 2 years ago:
                              https://forums.homeseer.com/showthread.php?t=176618
                              Great minds think alike?
                              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

                              Working...
                              X