Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • 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.

    Madcodger

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

    #2
    This is the holy grail of figuring out how events work: https://forums.homeseer.com/forum/ho...le-of-contents


    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 3.0.0.500
    Operating System: Microsoft Windows 10 Pro - Work Station

    Enabled Plug-Ins:
    2.1.0.119: AmbientWeather | 3.0.21.0: BLLock | 2.0.24.0: BLUPS | 1.3.6.0: Device History | 3.0.0.56: EasyTrigger | 3.1.0.7: MeiHarmonyHub | 3.0.6681.34300: UltraCID3 | 3.0.6644.26753: UltraLog3 | 3.0.6554.33094: UltraMon3 | 3.0.0.91: weatherXML | 3.0.1.245: Z-Wave | 3.0.51: HS Touch Designer | 3.0.0.40 Z-Seer+

    Comment


      #3
      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.

      Comment


        #4
        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.

        Comment


          #5
          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

          Comment


            #6
            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.
            https://forums.homeseer.com/forum/ho...-event-trigger
            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


              #7
              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!


              Madcodger

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

              Comment

              Working...
              X