I couldn't think of anything good for a subject sorry! Just a question, I have this working but wondering if this is the best way. I have a program that turns the front porch light on to 30% if we are home, and 50% if away (based on the variable set by my alarm, 0 for home, 1 for armed away), and if someone comes home while it is in away mode and then turn it off, it goes to 30% and so on. So at first I did:
Program 1
IF Time is from Sunset to Sunrise and Alarm_Armed = 0
THEN Front Porch = 30%
ELSE Front Porch = Off
Program 2
IF Time is from Sunset to Sunrise and Alarm_Armed = 1
THEN Front Porch = 50%
ELSE Front Porch = Off
If program 2 is running because the alarm is armed, so light is at 50%, and someone comes home and turns it off, setting the Alarm_Armed variable to = and running program 1, the problem is that the light goes immediately to 30%, but then the "ELSE" portion of program 1 runs and turns the light off.
So to solve it I did them like:
Program 1
IF Time is from Sunset to Sunrise and Alarm_Armed = 0
THEN Stop Program 'Program 2', Front Porch = 30%
ELSE Wait 10 seconds, Front Porch = Off
Program 2
IF Time is from Sunset to Sunrise and Alarm_Armed = 1
THEN Stop Program 'Program 1', Front Porch = 50%
ELSE Wait 10 seconds, Front Porch = Off
This solved the problem and works fine, but I'm just trying to improve my own skill and am wondering if this is how others would do this ,or if there's a better more efficient way? The issue I find is that it works, but if there's ever more than just 2 overlapping programs, then there would be a lot of code to stop all of them and keep watching them for updates and so on. Thanks!