Jim P Posted February 6, 2023 Posted February 6, 2023 (edited) I have this program... my intent is to increment a variable no more than 1 time per hour if a sMotionOff = 1 . (sMotionOff is set to 1 if all motion detectors are off and 0 if any motion detectors detect motion. My notify in the then section appears to run even if the time is not on the hour. What am I missing? Originally I put the sVariable first with the schedule times after like if sVariable <> 0 and time = 1 or time = 2 etc... but I felt like the program would be running a lot and if I put the times first it would only run once every hour... AllMotionSetCalcTime - [ID 0039][Parent 0032] If Time is 1:00:00AM Or Time is 2:00:00AM Or Time is 3:00:00AM Or Time is 4:00:00AM Or Time is 5:00:00AM Or Time is 6:00:00AM Or Time is 7:00:00AM Or Time is 8:00:00AM Or Time is 9:00:00AM Or Time is 10:00:00AM Or Time is 11:00:00AM Or Time is 12:00:00AM Or Time is 1:00:00PM Or Time is 2:00:00PM Or Time is 3:00:00PM Or Time is 4:00:00PM Or Time is 5:00:00PM Or Time is 6:00:00PM Or Time is 7:00:00PM Or Time is 8:00:00PM Or Time is 9:00:00PM Or Time is 10:00:00PM Or Time is 11:00:00PM Or Time is 12:00:00PM And $sMotionOff is 1 Then $sNomotion += 1 Run Program 'AutoVacationSet' (If) $iHourCount = $sNomotion Resource 'QuickGeneric' Else - No Actions - (To add one, press 'Action') iAllMotionOffCalcTime increments sNoMotion to number of hours that no motion has been detected. Used to determine how long since motion detectors have been All Off Edited February 6, 2023 by Jim P Clarify program by correcting variable name.
larryllix Posted February 6, 2023 Posted February 6, 2023 (edited) 13 minutes ago, Jim P said: I have this program... my intent is to increment a variable no more than 1 time per hour if a sMotionOff = 1 . (sMotionOff is set to 1 if all motion detectors are off and 0 if any motion detectors detect motion. My notify in the then section appears to run even if the time is not on the hour. What am I missing? Originally I put the sVariable first with the schedule times after like if sVariable <> 0 and time = 1 or time = 2 etc... but I felt like the program would be running a lot and if I put the times first it would only run once every hour... AllMotionSetCalcTime - [ID 0039][Parent 0032] If Time is 1:00:00AM Or Time is 2:00:00AM Or Time is 3:00:00AM Or Time is 4:00:00AM Or Time is 5:00:00AM Or Time is 6:00:00AM Or Time is 7:00:00AM Or Time is 8:00:00AM Or Time is 9:00:00AM Or Time is 10:00:00AM Or Time is 11:00:00AM Or Time is 12:00:00AM Or Time is 1:00:00PM Or Time is 2:00:00PM Or Time is 3:00:00PM Or Time is 4:00:00PM Or Time is 5:00:00PM Or Time is 6:00:00PM Or Time is 7:00:00PM Or Time is 8:00:00PM Or Time is 9:00:00PM Or Time is 10:00:00PM Or Time is 11:00:00PM Or Time is 12:00:00PM And $sMotionOff is 1 Then $sNomotion += 1 Run Program 'AutoVacationSet' (If) $iHourCount = $sNomotion Resource 'QuickGeneric' Else - No Actions - (To add one, press 'Action') iAllMotionOffCalcTime increments sNoMotion to number of hours that no motion has been detected. Used to determine how long since motion detectors have been All Off Put an AND pair of parentheses arround all your OR logic lines. It is in the upper edit box. If [ Time is 1:00:00AM Or Time is 2:00:00AM Or Time is 3:00:00AM Or Time is 4:00:00AM Or Time is 5:00:00AM Or Time is 6:00:00AM Or Time is 7:00:00AM Or Time is 8:00:00AM Or Time is 9:00:00AM Or Time is 10:00:00AM Or Time is 11:00:00AM Or Time is 12:00:00AM Or Time is 1:00:00PM Or Time is 2:00:00PM Or Time is 3:00:00PM Or Time is 4:00:00PM Or Time is 5:00:00PM Or Time is 6:00:00PM Or Time is 7:00:00PM Or Time is 8:00:00PM Or Time is 9:00:00PM Or Time is 10:00:00PM Or Time is 11:00:00PM Or Time is 12:00:00PM ] And $sMotionOff is 1 Then Edited February 6, 2023 by larryllix
Jim P Posted February 6, 2023 Author Posted February 6, 2023 Thanks larryllix I seldom have a need to use parenthesis .. and frankly forgot they were available .... The great thing about getting old is that you get the learn so much every day .... even if you learned it yesterday !!!!
Recommended Posts