I can't seem to get this to work with Rule Machine...
If the basement lights are OFF and motion is detected, turn ON basement lights and keep the lights ON until motion stops, then start a timer that will turn lights OFF after 5 minutes, if motion is detected again reset the timer to keep the lights ON.
I'm not sure if I should use Define a Rule, Define a Trigger, or Define a Trigged Rule to accomplish this. I tried several rules including the one below but nothing works the way I want.
I am just learning here too, but wanted to add, take into account what the timeout is directly in the motion sensor. You can end up with one timeout making the other somewhat irrelevant.
The idea is, if there is motion during the 5 minutes the rule is waiting after the initial motion stops, the 5 minute counter will restart. This continues to happen until there has been no motion for a full five minutes after the last motion has stopped. As noted in the messages above, this may be more than 5 minutes as the sensor may take some time to switch to inactive.
A triggered rule is not the right type. You need a normal rule for motion active. Actions when true, turn on the light. Actions when false...theres two choices that will work. First is the one @Eric.C.Miller posted above. Second is to add a delay of 5 minutes (select the cancel on truth change slider), turn light off.
I tried a rule like Eric suggested but the lights still turn off after five minutes regardless if the motion sensor is tripped again durning the 5 minute period. I think it has something to due with the "Basement Stair Lights off" now being in the ON state.
Take the Light Off condition out of the rule. As soon as the light turns on, the rule changes to false and your timer starts, regardless of motion status. You don't need to check the status of the light before you turn it on.
I took the "Light Off" condition out of the rule and the rule worked as expected but there is a problem. If the lights are turned on physically with the switch, or turned on remotely with the Dashboard app and the motion detector subsequently detects motion the rule will trigger and turn "off" the lights after 5 minutes.
I do not want the rule to run if the lights are already ON even if motion is detected.
I had to do mine with RM because I wanted different off timers depending on which lights were on. For example, in the kitchen, if the dining area lights were on, I wanted a motion timeout of 30 minutes. But if just the overhead was on, I wanted a timeout of 5 minutes. Also, I wanted to be able to "override" the motion off with dimmer levels in certain rooms. For example, if the bathroom lights are at 100%, motion won't turn them off. This is only possible in RM.
If you are trying to keep the lights on you need to have the delayed action with cancel on Truth change. And then in the true part of the rule you should add Stop Action for THIS RULE (it'll be at the top).