Announcement

Collapse
No announcement yet.

Is there a way to do an IF THEN ELSE?

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

    Is there a way to do an IF THEN ELSE?

    Hi,

    Is there anyway to create an IF THEN ELSE without having to create two events?

    Thanks

    #2
    Originally posted by NC-Lou View Post
    Hi,

    Is there anyway to create an IF THEN ELSE without having to create two events?

    Thanks
    The easiest way to get around that obstacle is to use a virtual device then create your events with "OR IF"


    Eman
    TinkerLand : Life's Choices,"No One Size Fits All"

    Comment


      #3
      Short answer; no you cannot create if then else events.

      The homeseer event engine is set up around discrete triggers that are true for a specific short interval preforming a specific action. IE If the Time is 7am do X is true at 7am and X gets executed once. If you tried to add an If Then Else Y the event would be true for every time except 7am. So every millisecond Y would be executed. Say Y is turning off a light; imagine the network traffic sending an off command to that light every millisecond.

      The event engine is similar to programming, and like any other programming languages there are rules that need to be followed. While it might remind you of another language you are familiar with, there are differences and nuances.
      HS4 Pro on Shuttle NC10U, Win10; Z-NET
      Number of Devices: 449
      Number of Events: 210

      Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

      External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

      Comment


        #4
        Thank you, I totally understand that example for timed events. I was hoping there was an easy way without have to create a ton of events.

        While I have your ear, it seems that in the Then clause, if you kick off other events they are all done in parallel, is there any way to force serial execution? (the only way I came up with was to WAIT for 1 second, between each event kickoff.)

        Thanks

        Comment


          #5
          How are you firing off the other events? If you use the Run Event after x Time, the x Time is measured from when the original event was triggered.

          Also, running an event actually just schedules the running of that event. By putting in the 1 second wait time, the system will then (usually) have time to kick off that second event while the first one is paused.

          Examining the system (Homeseer) log will show you what is happeing.

          Comment


            #6
            HS was going to implement conditional actions/THENs which in effect would be an If-then-else. Unfortunately, they dropped it from the upcoming features list. If that is something you would like to have then send them a feature request. https://dev.homeseer.com/servicedesk/customer/portals

            Comment


              #7
              Originally posted by mulu View Post
              HS was going to implement conditional actions/THENs which in effect would be an If-then-else. Unfortunately, they dropped it from the upcoming features list. If that is something you would like to have then send them a feature request. https://dev.homeseer.com/servicedesk/customer/portals
              I'm not sure that's a viable option. I'm sure there is more than one way to do it, but what immediately comes to mind is to use the HS database and only send out a command/make a change if it's indicated. That solves the network congestion/command spamming problem. The main drawback with this solution is what happens if the database is out of sync. With newer devices this is less of a problem but it can and does still happen. It would definitely be an issue for people with 300 series zwave switches/dimmers as that was before widespread instant status reporting. There is certainly more than one way to skin a cat... I'd be interested in other peoples thoughts on how to implement if-then-else.

              NC-Lou; yep, you hit the nail on the head, putting a wait 1 sec will set up serial execution.
              HS4 Pro on Shuttle NC10U, Win10; Z-NET
              Number of Devices: 449
              Number of Events: 210

              Plug-Ins: Arduino, BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, WeatherXML, Worx Landroid, Z-Wave

              External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

              Comment


                #8
                I go around difficult constructions and extra devices by just using one event and that event calls a script. In the script i use a suitable scripting language that can handle IF/THEN/ELSE structures.
                - Bram

                Send from my Commodore VIC-20

                Ashai_Rey____________________________________________________________ ________________
                HSPro 3.5.0
                PIugins: ZMC audio | ZMC VR | ZMC IR | ZMC NDS | RFXcom | AZ scripts | Jon00 Scripts | RFXCOM | BLRadar | BLBackup

                Comment


                  #9
                  Conditional action capability is available with EasyTrigger. Here's a simple example where devices 123's and 234's values are condition for setting of a device value. If 123 = 1 and 234 = 0 then set device = 100 else set to device 345's value.

                  IF [whatever]
                  THEN set [device] to expression IF($$DVR:123: = 1 AND $$DVR:234: = 0; 100, $$DVR:345)

                  Nested expressions are allowed so adding another IF in the 3rd expression parameter provides for ELSE IF. Operators can be used as well. If logging is important you'll need to add it manually, as standard HS event logging gives no indication of whether the conditional action fired--only that the event ran.

                  https://forums.homeseer.com/forum/ul...in-easytrigger
                  -Wade

                  Comment


                    #10
                    Thank you, I will try the EasyTrigger solution.

                    Comment

                    Working...
                    X