Announcement

Collapse
No announcement yet.

Event to check if a light should be turned off

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

    Event to check if a light should be turned off

    I have an event that will turn on the lights on the porch if the door opens after dark and will turn them off again 30 seconds after the door is closed again. So far so good.

    I've also got a ring doorbell that i use via MQTT to trigger motion and if the motion is after dark then the porch light goes on for 30 seconds and then turns off.

    I then discovered that if someone triggers motion and then i answer the door the light will turn off after 30 seconds so i changed the off event to check if the door was open.

    I.e. trigger the porch light off event which checks if the door and only turn off the light when the door is closed. Closing the door will trigger turning off the light event after 30 seconds.

    Click image for larger version

Name:	off event.png
Views:	159
Size:	220.8 KB
ID:	1427088

    The problem is that this event turns off the light regardless of whether the AND IF condition is satisfied. Am i missing something here as to my mind this should not turn off the lights when the sensor is set to open?

    #2
    When you run an event as an event action, you have to explicitly tell HS to check the event conditions or they will be ignored. Have you done that?
    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


      #3
      Originally posted by Feral View Post
      I have an event that will turn on the lights on the porch if the door opens after dark and will turn them off again 30 seconds after the door is closed again. So far so good.

      I've also got a ring doorbell that i use via MQTT to trigger motion and if the motion is after dark then the porch light goes on for 30 seconds and then turns off.

      I then discovered that if someone triggers motion and then i answer the door the light will turn off after 30 seconds so i changed the off event to check if the door was open.

      I.e. trigger the porch light off event which checks if the door and only turn off the light when the door is closed. Closing the door will trigger turning off the light event after 30 seconds.

      Click image for larger version

Name:	off event.png
Views:	159
Size:	220.8 KB
ID:	1427088

      The problem is that this event turns off the light regardless of whether the AND IF condition is satisfied. Am i missing something here as to my mind this should not turn off the lights when the sensor is set to open?
      Your first IF indicates that you have a different event that is triggering this event. If you want the “And If” in this event honored, you need to make sure that the event that calls this event has a check mark next to “Only if event conditions are true”. If that is not checked, then the first event will just trigger this event that you’ve posted and ignore all of your conditions.


      Sent from my iPad using Tapatalk
      HS3 3.0.0.548 &HSTouch Designer 3.0.71 with 996 Devices, 547 Events
      Plugin's:
      BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
      EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
      weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave 3.0.1.252

      Comment


        #4
        you could try this...

        If after dark and motion triggered
        or
        if after dark and door opened
        then turn on porch lights 'the time starts
        ----------------------
        if after dark and door is closed and light has been on for exactly 30 seconds
        then turn off the porch lights 'cannot shut off light if door open
        -------------------------
        if after dark and the door just closed
        then reset the porch lights time on to now
        &hs.setdevicelastchange(dev ref # porch light,now) 'This resets the on time so that it waits a full 30 seconds after the door closes.

        Stuart

        Comment


          #5
          Feral
          Is there a reason that you have another event that is triggering this event to turn the light off? I'm thinking you might have more events than you need which is causing them not to work as you expect.

          - To turn the light on:
          IF The door changes and becomes OPEN
          AND IF the time is night time
          AND IF the light is OFF

          OR IF Doorbell senses motion
          AND IF the light is OFF

          Then Turn on front door light

          - To turn the light off
          IF The door changes and becomes CLOSED
          AND IF Light status is ON

          OR IF Recurring Trigger every 30 seconds
          AND IF Motion sensor is NO MOTION
          AND IF Door is CLOSED
          AND IF Light is ON

          Then Set status of door light to OFF ( You could set it to off after 30 seconds if you wanted)
          HS3 3.0.0.548 &HSTouch Designer 3.0.71 with 996 Devices, 547 Events
          Plugin's:
          BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
          EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
          weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave 3.0.1.252

          Comment


            #6
            thanks all, i'll have a play and report back probably tomorrow.

            Comment


              #7
              Originally posted by The Profit View Post
              Feral
              Is there a reason that you have another event that is triggering this event to turn the light off? I'm thinking you might have more events than you need which is causing them not to work as you expect.

              - To turn the light on:
              IF The door changes and becomes OPEN
              AND IF the time is night time
              AND IF the light is OFF

              OR IF Doorbell senses motion
              AND IF the light is OFF

              Then Turn on front door light

              - To turn the light off
              IF The door changes and becomes CLOSED
              AND IF Light status is ON

              OR IF Recurring Trigger every 30 seconds
              AND IF Motion sensor is NO MOTION
              AND IF Door is CLOSED
              AND IF Light is ON

              Then Set status of door light to OFF ( You could set it to off after 30 seconds if you wanted)
              The reason for this was i added a ring doorbell and wanted to add motion events to trigger the lights as well as the existing turn the lights on when door opened, just organic planning rather than efficient. I've created your event and i'm also going to test the check conditions as suggested by the others.

              Comment


                #8
                I just realized that if you want to light to stay on if there is continued motion you would also want to
                do this "hs.setdevicelastchange(dev ref # porch light,now)" when the light is turned on otherwise you may
                have tripped the motion waited 20 seconds, then there is more motion and it would have shut off 10 seconds later.
                This way if the motion retriggering it will reset the time so its 30 seconds after the last motion. and you never need to
                create a separate timer.
                Stuart


                you could try this...

                If after dark and motion triggered
                or
                if after dark and door opened
                then turn on porch lights 'the time starts

                hs.setdevicelastchange(dev ref # porch light,now)

                ----------------------
                if after dark and door is closed and light has been on for exactly 30 seconds
                then turn off the porch lights 'cannot shut off light if door open
                -------------------------
                if after dark and the door just closed
                then reset the porch lights time on to now
                &hs.setdevicelastchange(dev ref # porch light,now) 'This resets the on time so that it waits a full 30 seconds after the door closes.

                Comment


                  #9
                  i couldn't test yesterday as for some reason the ring 2Fa token had to be regenerated which seemed to be a problem for my neighbour as well. I don't think i need to keep the light on as the motion trigger is only really used for the ring picture and if i open the door to answer then it should stay on. I'll test tonight now that motion is triggering again.

                  Comment


                    #10
                    was working and then i noticed a few times the light was staying on as if motion was triggered although i could not see any motion change on the ring device.
                    Click image for larger version

Name:	offevent.png
Views:	65
Size:	243.8 KB
ID:	1428058

                    Comment


                      #11
                      wondering if i just need to remove the motion condition.

                      Comment


                        #12
                        Originally posted by Feral View Post
                        wondering if i just need to remove the motion condition.
                        Yeah, I would try removing the Motion condition to see if your light turns off after 45 seconds. If it does, then your motion sensor must be triggering more often than every 30 seconds.

                        Also, check your motion device in HS and see if it has the check mark next to “Do not update device last change time if device value does not change”. Sometimes there are devices that send updates even if the value of the device does not change and could cause your Off event to not trigger. You wouldn’t be able to see this in the device value but the “Last Change” field would update. Also, check the sensitivity setting of the motion sensor.


                        Sent from my iPad using Tapatalk
                        HS3 3.0.0.548 &HSTouch Designer 3.0.71 with 996 Devices, 547 Events
                        Plugin's:
                        BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
                        EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
                        weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave 3.0.1.252

                        Comment


                          #13
                          removing motion fixed it. I'm using the ring doorbell which is battery powered for motion detection. I have a MQTT linked device which captures ring events and i need it to trigger when motion is applied, even if the last action was also motion. Thanks all for the help

                          Comment

                          Working...
                          X