RichTJ99 Posted August 18, 2009 Posted August 18, 2009 Hi, I just finished two scripts. I am hoping for some feedback. I am looking to make it so when my front door motion sensor goes off, it will make the Entry light (KPL) turn on for 5 minutes, then shut itself off. If the Front porch light, or the Entry KPL light is on, it should do nothing. Any ideas on how to make this more streamlined? Thanks, Rich Front Door Timeout: If Time is Last Run Time for 'Front Door Motion' + 5 minutes And Status 'Upstairs: Entry KPL' is On Then Wait 5 seconds Set 'Upstairs: Entry KPL' Off Else - No Actions - (To add one, press 'Action') Front Door Motion: If Control 'Motion: Front Door Motion' is switched On And Status 'Outside: Front Porch' is Off And Status 'Upstairs: Entry KPL' is Off Then Set 'Upstairs: Entry KPL' On Else - No Actions - (To add one, press 'Action') Hrmmm, something isnt right...
mozman Posted September 6, 2009 Posted September 6, 2009 First, I presume that you have NOT linked the motion detector directly to your entry light (KPL), but are using the ISY to effect the desired light changes. (Otherwise, the motion detector will normally send an OFF command after a certain period of no motion.) I think your code will have the following issue: Say you turn the entry light on manually. Later, when the motion detector senses motion, the Door Motion program runs, even though it doesn't do anything (the If clause is false since one of the lights is on). Nevertheless, this updates the Last Run Time for this program, which will then cause the Door Timeout program to run in 5 minutes, turning off the Entry light. However, this can be fixed pretty easily. Even though the Door Motion program ran, its Status will be False (the If clause evaluated to false). So, just add another And Condition to your Door Timeout If clause: And Program Door Motion Is True. This will cause Door Timeout to run only if the Door Motion program actually turned on the entry light. BTW, as you have it set up, if the porch light is on, the motion detector will do nothing.
Recommended Posts