Announcement

Collapse
No announcement yet.

IF-THEN-ELSE Action

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

    #61
    Aside from the rescinded road map that mentions something about what I interpreted to be an If-Then-Else-ish feature (I recall rereading the offering and concluded it wasn't really what it sounded like), wouldn't a real fix to this be proper and complete documentation for scripting? It seems to have all we need to accomplish the myriad tasks, but remains in the occult realm since there is no documentation. The, too, there is the recurring whispered rumor that vb.net is going away.
    HomeSeer Version: HS4 Pro Edition 4.2.19.0 (Windows - Running as a Service)
    Home Assistant 2024.3
    Operating System: Microsoft Windows 11 Pro - Desktop
    Z-Wave Devices via two Z-Net G3s
    Zigbee Devices via RaspBee on RPi 3b+
    WiFi Devices via Internal Router.

    Enabled Plug-Ins
    AK GoogleCalendar 4.0.4.16,AK HomeAssistant 4.0.1.23,AK SmartDevice 4.0.5.1,AK Weather 4.0.5.181,AmbientWeather 3.0.1.9,Big6 3.44.0.0,BLBackup 2.0.64.0,BLGData 3.0.55.0,BLLock 3.0.39.0,BLUPS 2.0.26.0,Device History 4.5.1.1,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,HSBuddy 4.51.303.0,JowiHue 4.1.4.0,LG ThinQ 4.0.26.0,ONVIF Events 1.0.0.5,SDJ-Health 3.1.1.9,TPLinkSmartHome4 2022.12.30.0,UltraCID3 3.0.6681.34300,Z-Wave 4.1.3.0

    Comment


      #62
      Originally posted by George View Post

      For sure,

      I'm not questioning the ability to add greater flexibility but it has to be balanced against the probability of significantly increasing the technical support load on HST because of the point mentioned above. Unintended actions or triggers on complex events.

      <snip>
      Point taken but not having if-else if-else if-else constructs (or conditional ifs) also makes things more complex, cumbersome and confusing. The event engine is the brain of any home automation system!! As such, HS really should put more effort into it. EasyTrigger is something that should not be necessary. That should be built into the HS. Same goes for conditional actions (or if-else if-else if-else constructs). And to make it easier to know what is going on in such constructs you can just put timestamps on each of those or if an event was triggered mark the items that were executed in green and the ones that were not executed in red. Actually, thinking about it, this color coding would also be great for triggered events and then color code which conditions were met and which ones were not. This resulted in this post https://forums.homeseer.com/forum/ho...dition-was-met

      I really encourage people to ask for those if-else if-else if-else constructs by opening a feature request at https://dev.homeseer.com/servicedesk/customer/portals HS won't do anything unless we let them know what we need.

      Comment


        #63
        Originally posted by ewkearns View Post
        ... too, there is the recurring whispered rumor that vb.net is going away...
        I hope this is NOT true.

        Comment


          #64
          Supposedly HS is discussion larger changes to the event engine. So if you have any feature request (like if-else if-else if-else) then it's a great time to submit those feature requests here https://dev.homeseer.com/servicedesk/customer/portals

          Comment


            #65
            Originally posted by mulu View Post
            Supposedly HS is discussion larger changes to the event engine. So if you have any feature request (like if-else if-else if-else) then it's a great time to submit those feature requests here https://dev.homeseer.com/servicedesk/customer/portals
            While I have no need for this as I use multi-event executed from a single event with conditions being checked; however, Isn't the ask more of a If-if-else vs if-else? Meaning if-else conditional capabilities only after a trigger has been met?
            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


              #66
              Yes, what I meant is "if" - "else if" - "else if" ... "else" how how you call it if-if-else.

              Comment


                #67
                Originally posted by mulu View Post
                Yes, what I meant is "if" - "else if" - "else if" ... "else" how how you call it if-if-else.
                The first "if" is the condition that fires the event.

                Comment


                  #68
                  Originally posted by mulu View Post
                  Yes, what I meant is "if" - "else if" - "else if" ... "else" how how you call it if-if-else.
                  Nope. Very different logic.

                  "if" - "if else" - "if else" - "if else" ....

                  The first "if" is the trigger, the rest are conditions. An "else" for a trigger is as problematic as those recurring triggers that was removed from HS4.
                  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


                    #69
                    lveatch Yes, the "if else" are not meant as additional triggers but as additional conditions. Conditional actions might be less confusing but can get more complex because they allow for more flexibility.
                    In any case, I still encourage everybody to provide your suggestions/feature requests to the event engine at https://dev.homeseer.com/servicedesk/customer/portals

                    Comment


                      #70
                      Originally posted by Wade View Post

                      Is this what you're asking about?

                      Click image for larger version

Name:	Capture.JPG
Views:	329
Size:	52.6 KB
ID:	1532846
                      It's available with Set Device to Expression and Set Group of Devices to Expression.
                      Sorry, just getting around to look at this. I see the option to set expression.

                      What do I use in the expression field to turn on a light. For example, turn on this light if it is not already on? Thanks.

                      Comment


                        #71
                        Originally posted by simonmason View Post

                        Sorry, just getting around to look at this. I see the option to set expression.

                        What do I use in the expression field to turn on a light. For example, turn on this light if it is not already on? Thanks.

                        Here's an example where I'm turning off a large group of devices--over 50. Before spud added the "Send command only if..." option, 1 or 2 would often get missed in the flood of z-wave traffic. A similar IF statement will work for turning a group on, as long as the entire group has the same "on" value. If not, you'll probably need a separate group and action for each on value. By the way, the 3rd argument of the IF expression is the ELSE value. It's irrelevant in this usage since no command is sent if the resultant is false, but something has to be there. It could just as well have been zero or any other number.

                        Click image for larger version  Name:	Capture.jpg Views:	0 Size:	65.4 KB ID:	1537119

                        In a number of events I set individual devices in this way, too, where for one reason or another I don't want a command sent if the device value won't change. One thing to keep in mind about logging though. The event will have run (and logged, if logging is on, and date stamp updated) even if the expression evaluated such that the device wasn't updated--i.e., the action didn't fire. An additional action to write an info line to the log could help if this is a problem for you. In most cases I don't bother.


                        edit: re-reading your question I see I didn't exactly answer your question. For your example, assuming Off=0 and On=100 it would be:

                        Set [select device]
                        to
                        if($DEVICEVALUE = 0, 100, $DEVICEVALUE)
                        -Wade

                        Comment


                          #72
                          Thanks - very helpful. Could I not include an expression - just put in "0" to turn off? Also, I think turning on might be a little more complicated as some lights are 100 and some are 255.

                          Comment


                            #73
                            Originally posted by simonmason View Post
                            Also, I think turning on might be a little more complicated as some lights are 100 and some are 255.
                            You can control a comma separated list of devices using the JSON API call controldevicebycontroluse. This will scan each device for the control value that matches the control label you specify.

                            There is a whole list of control commands available, but in your case the command for "On" is 1 and the command for "Off" is 2. To turn all the lights on, regardless of their control values, you would use the following JSON call as an immediate script command:

                            Code:
                            &hs.URLAction("http://192.168.5.xxx/JSON?request=controldevicebycontroluse&ref=XXXX,XXXX,XXXX,XXXX,XXXX,XXXX&controluse=1", "GET", "", "")
                            Of course you'd use your actual IP for the Homeseer host machine and replace "XXXX" with your device reference numbers that you wish to control.

                            --Barry

                            Comment


                              #74
                              Originally posted by simonmason View Post
                              Thanks - very helpful. Could I not include an expression - just put in "0" to turn off?
                              Yes you're right. I was overcomplicating the solution based on a more involved use case I was drawing from.
                              -Wade

                              Comment

                              Working...
                              X