No announcement yet.

Why Doesn't This Event Work? Problem with IF Statements?

  • Filter
  • Time
  • Show
Clear All
new posts

    Why Doesn't This Event Work? Problem with IF Statements?

    Hi everyone. Still using HS3, on a RPi. I created an event to control a small heater in my office. When the temperature goes above a certain point (69.5) based on a Flex sensor, and it's a weekday, and it's between 6 AM and 5PM, a Z-wave module should turn off. But it doesn't.

    I can turn the heater off and on via Homeseer, and the flex sensor now shows a temperature of 70.7 (started out this morning at about 62), but the event doesn't trigger. Here's what it looks like (See attached pic - Not loading as a pasted image in this message - Sorry). Any ideas? Thanks in advance.


    This would be a lot easier if I knew what I was doing...

    This is the holy grail of figuring out how events work:

    In this instance, my quick start guide would be to change your trigger (first line) to "if the temperature changes and is greater than... " and the following 3 "triggers" will be conditions. IOW, when the temperature goes too high, evaluate the conditions and then "do something" if the conditions are met.

    You can move triggers with your left mouse button and that may make retyping unnecessary.
    HomeSeer Version: HS3 Pro Edition
    Operating System: Microsoft Windows 10 Pro - Work Station

    Enabled Plug-Ins: AmbientWeather | BLLock | BLUPS | Device History | EasyTrigger | MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | weatherXML | Z-Wave | 3.0.51: HS Touch Designer | Z-Seer+


      ewkearns is entirely right, that change should work as expected.

      The way I always think of my initial trigger is it has to be a discrete item that triggers once. Ie if the time is 7am is good. If the time is 7am to 10am is bad; it would create a storm of triggers 7am, 7am and 1 ms, 7am and 2 ms etc... For the most part HS will not let you create storms like that. Under the hood it's converting things to discrete points of time. Ie your 'if the days of the week are weekdays' will trigger once daily at 12:00:01 am Monday, 12:00:01 am Tuesday, etc. Your next condition if > 6am will never be true so things stop there.

      Once I have my initial trigger I add in further conditions to narrow things down.

      Some advanced gotchas. If you use 'Or If' it's a new set of discrete triggers. if 7am and temp < 70, or if 8am. will not work as expected. it would have to be if 7am and temp < 70, or if 8am and temp < 70. 'Or if' basically lets you set up two or more trigger paths that then have the same actions taken.

      You'll see 'if manually triggered' This means 'ignore all other conditions and just run' It's common to make the event using manually triggered and call it from another event and be surprised your carefully crafted conditions aren't used. There is an option when you use 'run another event' where you can check 'check conditions on target event' that overrides that behavior.

      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.


        The way I think about it is the condition that I want to use to trigger the event (in this case the temperature) has to be first. Then the underlying conditions can follow.


          Basically, the IF and OR statements need to be tracking a CHANGE, e.g.
          • the time becomes 7:00:00am
          • the temperature changes and becomes x
          • the device x turn on...

          The AND statement are checking on the current STATE of something
          • the time is after 7:00:00am
          • the temperature is > x
          • the device x is on


            The event as written is corrupt. It is likely caused by a bug in HS3. The day of the week is a weekday is not a trigger. It is a condition. The only way to get an event to look like this is to delete the trigger so the first condition looks like it becomes the trigger. . .but it doesn't.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition, NUC i3

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


              Hi All,

              Thanks for the thoughts, corrections, and ideas. Here's how I fixed it.

              I set up a virtual device called "working hours". It turns on 2-3 hours before I get to my office, and turns off at the normal time I'm done.
              Then, I use only two conditions:
              • Whether or not the virtual device for "working hours" is on
              • The Temperature of the room (based on a Homeseer Flex sensor)
              When the temperature reaches the "high limit", the power to the heater turns off (Event 1)
              When the temperature reaches the "low limit", the power to the heater turns on (Event 2)
              Limits vary by only 0.5 degree F, and even then the heater cycles only 2-3 times/day at current outdoor temps (mid-40's day, down to about 32 at night, so far).
              WORKS LIKE A CHARM!

              I created two other events for "Off Hours", to keep the temperature within a separate (lower) range at night and on weekends. Also works great.

              Using this, I keep a very tiny, well-insulated office that overlooks the lake at a very comfortable temperature using only a portable, oil-filled electric radiator heater. Based on my heat loss calculations, I'm good down to about -15F due to the small size and insulation.

              Anyway, thanks for the help!


              This would be a lot easier if I knew what I was doing...