I have a program that turns on path lighting, for a little over 10 minutes, if it is nighttime and a vehicle has driven onto the driveway. I am not currently using scenes, but will in the final. This is the first ISY program I've written which makes use of a Wait command, so I may be missing understanding on how it works.
In general, what I'm trying to do is straight forward, but the programs for managing the path lighting are a bit more complex than the other programs I've written. I am using variable called int_PrcsdSafetyLoops which is to limit execution of the code that turns the lights on to one time - even if there are multiple triggers each time a vehicle drives down the driveway. I also have some sidewalk lights which are scheduled to come on each night for 4 hours (after sunset), which should ignore the command to turn off when someone drives down the driveway and it's still within the 4 hour scheduled time period.
Reason for int_PrcsdSafetyLoops var:
There actually are two safety loops, and right now I have taken both their contact outputs and wired them to the I/O Linc module. So, if I drive the car out of the driveway and back during my testing, I will get 4 closures of the I/O Linc. The goal is to trigger off the first contact closure and ignore the remaining 3. At some point, I may add direction info, so the lights only come on when we arrive at the property, but I may not worry about that issue. The wiring will be changed so it only takes input from the Outside Safety loop, but this will involve more time than I had between rain storms. Plus, I should be able to write code that only looks at the first occurrence - I'm guessing it's something simple, but for the life of me, I can't see why it won't ignore.
The lights turn on fine, but the lights fail to turn off, and the flag int_PrcsdSafetyLoops never changes from the value 0. int_TestVar3 increments by a count of 4 each time I drive over the two loops going out the driveway, and back over the loops coming back on the property.
int_TestVar also increments by a count of 4, which I believe happens when I drive past the loops - going from a contact closure state to an open state.
Int_TestVar2, Int_TestVar4 and Int_TempPathLightsOn never changes, which could be confirmation the code after the WAIT command never executes.
Any ideas on where I'm going astray? Is there a log that displays not only the events, but also lists variable change of state?
Michale
================== main code pieces ==============
Program TempPathLightsOn
If
$sIsDark is 1
And Status 'Gate Outside Safety Loop Sens' is On
And $int_PrcsdSafetyLoops is 0
Then
$int_PrcsdSafetyLoops = 1
Set 'Garage Outside West' On
Set 'Garage Outside North' On
Set 'Out Mod A' On
$Int_TestVar3 += 1
Wait 10 minutes and 15 seconds
$Int_TempPathLightsOn = 1
Run Program 'Temp Path Lights Off' (If)
$Int_TestVar2 += 1
Else
$int_TestVar += 1
Comments:
Mod A controls the sidewalk lights. They can be turned on anytme (while dark), but they won't be turned off if the time is during their normal "On" time period (as controlled by sLightPathOnVar.
Var int_PrcsdSafetyLoops is to protect against multiple triggers from the two safety loops. The "Then" section should only execute once when a vehicle drives accross the safety loops, turn on the desired lights,
and turn the lights back off after the wait period has timed out. Then reset the vars.
Program TempPathLightsOff
If
$Int_TempPathLightsOn is 1
Then
Set 'Garage Outside West' Off
Set 'Garage Outside North' Off
Run Program 'Sidewalk Lights Temp Off' (If)
$int_PrcsdSafetyLoops = 0
$Int_TempPathLightsOn = 0
$Int_TestVar4 += 1
Else
- No Actions - (To add one, press 'Action')
Comments:
Mod A controls the sidewalk lights. They can be turned on anytme (while dark), but they won't be turned off if the time is during their normal "On" time period (as controlled by sLightPathOnVar)