Announcement

Collapse
No announcement yet.

How to run event only when device wasn't already on.

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

  • How to run event only when device wasn't already on.

    So I currently have an event that monitors 3 garage door sensors and when one opens my garage lights turn on and 5 minutes after they are all reporting closed the lights shut off.

    The annoying part I'm running into is if I'm in the garage working and have the lights on and someone walks into the garage and then leaves the lights shut off on me after 5 minutes.

    How can I set this event up so that if the lights in the garage were already on it won't shut them off on me while I'm working.

    I attached photos to show how I have the event setup now, I'm sure there is probably a better, cleaner way but I didn't know how else to do it. Click image for larger version

Name:	Screenshot_20200329-145639.jpg
Views:	89
Size:	59.6 KB
ID:	1373672

    Click image for larger version

Name:	Screenshot_20200329-145700.jpg
Views:	78
Size:	55.8 KB
ID:	1373673
    Thanks in advance for any ideas.

  • #2
    There are a lot of different ways of doing this. What I would probably do is create a virtual switch. When I turned on the garage lights manually, the virtual switch would also be set. The motion detection events would then check to see if this virtual switch is set (as a condition), and if so, do not run the motion detection event. When the garage light gets turned off, reset that virtual switch, and the motion detection events would then be "armed" again.

    Comment


    • #3
      I'll look into this, never used virtual switches before

      Comment


      • #4
        Yeah that’s probably the way to go. You can hide the virtual switch from the UI, or you can crease a floor or room called “virtual switches” for keeping them easy to find but out of the way. I use them for lots of conditional things like this.

        Comment


        • #5
          If I understand your events, when you enter the garage the lights will come on when you open the door. How do you prevent them from going off if you stay in the garage to work?

          A virtual switch is a straightforward way to handle the problem, so I have no disagreement with that approach, but if you can identify some pattern that HS could detect that indicates that the garage is occupied after the doors are closed, you might be able to totally automate the process - and avoid the possibility that you forget to turn off the lights when you leave and they stay on indefinitely.

          A motion sensor in the garage might do the trick. But you may be able to come up with a better way.
          With a motion sensor, you could reset a virtual 'occupancy' device every time the motion sensor detects motion, then after some period of time turn off the lights unless the device is reset in the mean time.
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

          Comment


          • #6
            If you have a zwave device that reports its level is really easy to use. The motion sets the lights on. probably 99. So if you come into the garage and after the lights go on, you just press the on switch once and have Hs then change its level to something other than 99, So 98, 97,96 or whatever where you cannot see the difference in brightness. then when its time for the motion to shut off the lights if level is other than 99 it stays on. you would only have to add a condition if the light is being triggered by the motion and is already on (such as not 99, then not to change the level.).

            If motion triggered and garage lights are less than level 90, then turn on lights
            then wait 15 minutes run then run another event
            another event: If garage lights level is 99 then shut off lights.

            Stuart

            Comment


            • #7
              Thought some more about this when I was BBQing my lunch (and still using the virtual switch idea):

              I think you might consider using a timer rather than a wait statement inside your motion event, as follows:

              MotionEvent:

              If Motion Detected
              Then
              Stop Timer
              Reset Timer
              Start Timer
              Turn on light

              TimerExpires event:

              If Timer becomes exactly 15m
              Then
              Stop Timer
              If event conditions are true, run event LightOff

              LightOff event:

              If manually triggered
              AndIf virtual switch is off
              Then
              Turn off light

              The above events would have the advantage that if new motion is detected during that 15m, the timer would get restarted. And if you manually turn on the light during those 15m, the light would not go off when the timer expires.

              If your light is on a single ZWave switch, then you are going to need a way to determine if the light was turned on by the motion event, or by the paddle. I would recommend the WS200 (Homeseer) ZWave switch, as it can trigger an event when the paddle is pressed, along with turning the light on (the event of course would turn on that virtual switch).

              Comment


              • #8
                Aa6vh btw here I'm N1fbg.

                Any time I can spare using a plugin or a virutal flag or a timer I will build this into the logic. works well with the Hsws100 and hsdw200 switches. I preset lights to come on either by motion or by user and assign different levels that change throughout the day. I also will set the devicelastchange time sometimes in the future and in the past to create multiple timeouts on one light triggered by multiple motion. 30 secs for this hallway 20 seconds to the door and 40 seconds from the last bedroom, etc... without any external timer.

                MotionEvent:

                could make this a little easier
                If Motion Detected --------------------------If motion detected
                ---------------------------------------------------Then then turn on light
                Stop Timer ------------------------------------then &hs.setdevicelastchange (dev id, now) whatever time reverts back to 0 this is done and ----------------------------------------------------if time goes on and say 12 minutes, as soon as its seen by motion the time resets to 0, no --timer to deReset Timer--------------------- no timer to rest
                Start Timer ------------------------------------timer was already reset and started above
                Turn on light -----------------------------------light is still on

                TimerExpires event:

                If Timer becomes exactly 15m --------------------If light has been on for 15 minutes then shut off light. done
                Then ------------------------------------------------------no then
                Stop Timer ----------------------------------------------no stop timer
                If event conditions are true, run event LightOff

                LightOff event:

                If manually triggered
                AndIf virtual switch is off
                Then
                Turn off light
                Last edited by Stuart; March 29th, 2020, 11:03 PM. Reason: didnt like my spacing

                Comment


                • #9
                  Thanks for the ideas, I'll try these and see which I like best.

                  Comment

                  Working...
                  X