theedudenator Posted October 1, 2022 Posted October 1, 2022 I have a motion on the back of my house that is running though my ELK M1 I have an ISY program to turn a light on when motion is sensed. The problem is the motion sensor seems too sensitive, not sure if bugs or birds are triggering it. Is there options in a program to sense multiple motion events with a time limit to trigger the lights?
MrBill Posted October 1, 2022 Posted October 1, 2022 (edited) On 9/30/2022 at 9:16 PM, theedudenator said: Is there options in a program to sense multiple motion events with a time limit to trigger the lights? Create a integer variable and use several programs, such as: Program MotionSense If Motion is switched on And $iMotionCount < 5 then $iMotionCount += 1 Run Program MotionLightExpireMotion (if) Run Program MotionLightOn else (none)Program MotionLightON If $iMotionCount = 5 then turn light on else (none) Program MotionLightExpireMotion If $iMotionCount > 0 then wait 10 seconds $iMotionCount -= 1 Run Program MotionLightExpireMotion else Turn Light Off Disclaimer: I don't have an ELK M1 and don't know how often motions can retrigger. The wait and motion count above also may need adjustment based on that answer and personal preference. When I started writing this example I assumed it would use a State variable rather than an integer variable, but the solution is much more complicated using a state variable. Since the 2nd and 3rd programs only have an integer variable in the If statement they will never run unless called by another program. The first program is triggered on motion and only continues to accumulate the value if the motion value is less that 5. Since the second and third program won't run on their own, it runs them. The second program has one job only when the motion count gets to 5 it turns the light on. the third program expires motion and anytime the value reaches 0 turns the light off (it may not be on but this minor inefficiency shouldn't cause problems, a fourth program could be used to turn off the light when the variable returns to 0 but it would need to be run from the else that currently turns the light off.) Edited October 5, 2022 by MrBill fix the typo pointed out by @larryllix
theedudenator Posted October 5, 2022 Author Posted October 5, 2022 I am a bit lost on how this is made, and how does it count? $iMotionCount < 5
larryllix Posted October 5, 2022 Posted October 5, 2022 (edited) 40 minutes ago, theedudenator said: I am a bit lost on how this is made, and how does it count? $iMotionCount < 5 $iMotionCount =+ 1 Probably would be listed as $iMotionCount += 1 Edited October 5, 2022 by larryllix 1
MrBill Posted October 5, 2022 Posted October 5, 2022 (edited) 10 hours ago, theedudenator said: I am a bit lost on how this is made, and how does it count? $iMotionCount < 5 as pointed out by @larryllix I typo'd the numeric operator, but to add to what he said let's take a second look, I've empathized where the motion count goes up and down. So the first program counts motion the second program handles the actually switching, and the third program expires the motion. Program MotionSense If Motion is switched on And $iMotionCount < 5 then $iMotionCount += 1 Run Program MotionLightExpireMotion (if) Run Program MotionLightOn else (none)Program MotionLightON If $iMotionCount = 5 then turn light on else (none) Program MotionLightExpireMotion If $iMotionCount > 0 then wait 10 seconds $iMotionCount -= 1 Run Program MotionLightExpireMotion else Turn Light Off Edited October 5, 2022 by MrBill
Recommended Posts