Announcement

Collapse
No announcement yet.

Nested If/Then events?

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

    Nested If/Then events?

    Am I dating myself with this question?

    I got in to Home Automation with Time Commander and later Stargates. I didn't realize how much I did appreciate the WinEVM Software. I used Nested If/Then Events to keep things organized.

    Something like:



    Living Room Light


    If A1 goes ON

    or

    If A1 goes OFF


    Then:

    (( If A1 goes ON

    Then:

    B1 on )


    OR


    (If A1 goes OFF

    Then:

    B1 OFF)

    END)



    This meant when I wanted to edit the Living Room Light event, I didn't have to search for multiple events to edit. Nested If/Then's were nestable up to 3 or 6 deep. (It's been a while now).


    So, my question is, what's the equivalent method in HomeSeer?


    One thing I never liked about programming Omni's and their kind was that every event was stand-alone and required a new line.



    While I'm asking, what's the equivalent for a 'Flag' as well? I used flags all the time for status in WinEVM.



    Thanks,

    -Kyle
    Last edited by kpeters59; September 16, 2012, 09:33 PM.

    #2
    Originally posted by kpeters59 View Post
    Am I dating myself with this question?

    I got in to Home Automation with Time Commander and later Stargates. I didn't realize how much I did appreciate the WinEVM Software. I used Nested If/Then Events to keep things organized.

    Something like:



    Living Room Light


    If A1 goes ON

    or

    If A1 goes OFF


    Then:

    (( If A1 goes ON

    Then:

    B1 on )


    OR


    (If A1 goes OFF

    Then:

    B1 OFF)

    END)



    This meant when I wanted to edit the Living Room Light event, I didn't have to search for multiple events to edit. Nested If/Then's were nestable up to 3 or 6 deep. (It's been a while now).


    So, my question is, what's the equivalent method in HomeSeer?


    One thing I never liked about programming Omni's and their kind was that every event was stand-alone and required a new line.



    While I'm asking, what's the equivalent for a 'Flag' as well? I used flags all the time for status in WinEVM.



    Thanks,

    -Kyle
    For flags, you can set up a 'virtual' device to keep track of a flag's status.
    The way I handle your example is to set up an event that watches for a 'status' change of device A1 and then have a one liner script that says if A1 is ON, turn on B1 else turn off B1.
    Dick
    HS PRO 2.5.0.81, WinXP, IE8, Shuttle XS35V3, 2.13GHz, 4GB, 40GB SSD drive, AC-RF2, ADIOcelot, Message Server, TI103, SNEVL CID, pjcOutlook, MCSTemperature, Powertrigger, BLBackup, BLFloorplan, BLIcon, BLOccupied, BLRadar, BLRfid, BLLogMonitor, ACPUPSD, UltraECM, WeatherXML & Stipus' script connector. 500+ devices, 260+ events, 1-wire weather station + temp/humidity sensors & Oregon Scientific temp & humidity sensors & 2 Brultech ECM-1240s

    Comment


      #3
      If I understand correctly,

      A single event triggered on "Device Status Change" would be the trigger type you want in your example. You would choose "A1" as the Device (it will be listed by the device name, not the code) and "Changed To Any Status" as the status.
      Then under the Action Tab, select "Run Script". Select "Switch to Advanced View", then in the "OR Script Statement" box, enter &hs.Transmit "B1",hs.DeviceStatus("A1")

      This way B1 will follow the status of A1 any time A1 changes.

      Or
      As two separate Events:
      1. "Device Status Change", "Changed to On"
      Under the Action tab, select B1, Command = On
      2. Same thing except the trigger is "A1" Off and the command "B1 Off"

      For your example, I'd use the first option
      Real courage is not securing your Wi-Fi network.

      Comment


        #4
        I just run a script.

        Then you can do exactly what you are asking.

        --Dan
        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

        Comment


          #5
          Originally posted by kpeters59 View Post
          Am I dating myself with this question?
          I got in to Home Automation with Time Commander and later Stargates. I didn't realize how much I did appreciate the WinEVM Software. I used Nested If/Then Events to keep things organized.
          Kyle, I agree that the transition from an idling loop of if statements to an interrupt based list of seemingly disconnected 'events' is disorienting. But once you get past the initial reorientation, it actually isn't very different.

          One easy way to address your example, as Dan noted, is to use an event with the trigger, 'A1 changes to ANY', then have that event run a script with the rest of the logic in it.

          Another way, which uses events, is to use the same trigger, but then to call other events with conditions. That does lead to a proliferation of events, and as you note, that can become a bit confusing, but HS has tools to help organize the events. One that I find very useful is the ability to list all events that contain a particular device code. Another is to use the Search tool for any term you choose. You can also group events in categories, but I find that as the number of events multiplies, the groups themselves can become a bit difficult to manage.

          On the other side of the ledger, HS allows you to make all your changes 'on the fly' so there's no need to stop the event processing 'engine' and reload the entire schedule just to make a minor change. Plus, HS gives you the ability to integrate a wide variety of devices based on a very large and growing list of new technologies. And, of course, you can use the JDS plug-in to run Stargate in parallel with HS, so you can maintain your SG schedule as a core functionality that will run even if HS encounters a problem.
          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


            #6
            If you have several hundred lines of Stargate schedule (like I do), building HS events to accomplish the same thing, as discussed above, will keep you entertained for a very long time.

            The best bet is to learn scripting if you want to approximate the power of Stargate. If, Then, Else, and nesting is all available in vb.net. There is a learning curve, but I found it was well worth it in the long run. I have the Stargate mind-set as well, and for me, scripting is a powerful tool that provides short-cuts analogous to Stargate events, but can do so much more.

            Mark
            Mark

            Comment


              #7
              Last time I checked, it was ~2400 lines on the big system. Which is near capacity of a Stargate. I remember that I had to trim a bunch of notes and stuff in order to download the last 'Schedule'. The lingering TimeCommander had several hundred lines.

              I'll look in to scripting more. I'd been avoiding it with HomeSeer. I was afraid that was the deal. I did a bit of scripting way back when with some dang thing. It's not too hard to make it do something cool as I recall. And the more you learn, the cooler it is.

              Thanks for all the helpful replies! More are welcome...

              -Kyle

              Comment


                #8
                I don't know if you already have a 'grand plan' or not, but one of the basic parts of my transition from SG to HS has been to gradually move specific functionality from the SG schedule to HS events. My intention is to allow SG to continue to do what it does well and use HS to add functionality that the SG box cannot do. That has allowed me to avoid a wholesale conversion of my SG schedule to HS events so I can conduct the transition at my own pace. A side benefit is that I have HS and SG send signals back and forth on a regular basis so they can keep tabs on one another.
                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


                  #9
                  I use the same strategy as Uncle Michael. I plan to continue the HS-SG combination until either SG dies or the HS plug-in breaks under HS 3.0+. Then I need to find the next big thing.
                  Mark

                  Comment


                    #10
                    I sure don't have any grand plan!

                    I did those installs for others and they've all since been resold, so I don't really even maintain them anymore. Occasionally, I hear from the Stargate owners.

                    I do still have the TimeCommander+ that was removed to upgrade to the Stargate and have just ordered a 6-port RS-232 card to hook it up and see what I can make it do. Along with a Houselinc a couple Slink-e's and who knows what all else is in the boxes in the back.

                    I've set HomeSeer up for a few different people and was always surprised that I couldn't find the nested if/then's. I guess I knew it was going to be script's, but since I bill hourly, I always worked around it and never really got any complaints.

                    Thanks,

                    -Kyle

                    Comment


                      #11
                      Originally posted by kpeters59 View Post
                      I sure don't have any grand plan! I did those installs for others and they've all since been resold, so I don't really even maintain them anymore. Occasionally, I hear from the Stargate owners.
                      Ahhh! That's quite different than I assumed from your original post! (I know, never assume.)

                      I think the approach I'd take in your situation is to just go slowly. Break out bite-sized projects and learn how HS works as you proceed. I'm sure it will be frustrating at first, but if your experience is at all like mine (and based on your history, I bet it will be faster) you'll soon find "programming" using HS events to be every bit as comfortable as using Starglish.
                      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


                        #12
                        If it helps:

                        This is how I run just about my entire house. The only other things that have a script file are things I felt had nothing to do with this. So, HVAC has it's own script, my Whole House Audio system I built has it's own script. Heck, you might just be interested in the Helper Functions (Healper! - Misspelled it a while ago). The helper functions make it easier in the code, so you can make it more natural to read. Almost self documenting. For example, the date/time calculations. You can just put in if timeislessthanNowMinutes(5) then
                        stuff
                        end if

                        Instead of the crazy calculation needed to figure out that question.

                        http://forums.homeseer.com/showthread.php?t=150485
                        http://forums.homeseer.com/showthread.php?t=150483

                        I'm more than happy to help you with it as I have time to.

                        --Dan
                        Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                        Comment

                        Working...
                        X