One way to do this with the ELK(in shorthand). Output Z can be turned on/off manually to use a longer time(60 min) for the case where you are using the room and motionless. I also added a section that will enable the longer timer if you turn the lights on manually soon after they are turned off by the timer.
Whenever (motion) is insecure (restart the longer timer if Z is on and motion)
and output Z is on
Then turn output X on for 60min, restart if running
Whenever (motion) is insecure (restart the shorter timer if Z is off and motion)
and output Z if off
then turn output X on for 10min, restart if running
Whenever output X turns off (when X expires, turn off, start 30 sec timer for manual override)
then turn light off
turn output Y on for 30 sec
Whenever (X lighting) is turned on (manually trigger 6hr of longer time if turning light on within 30 sec of auto-off)
and output Y is on
and output Z is off
then turn on output Z for 6 hours
Whenever (X lighting) is turned on (start the longer timer if Z is on)
and output Z is on
then turn on output X for 60min
Whenever (X lighting) is turned on (start the shorter timer if Z is off)
and output Z is off
then turn on output X for 10min
EDIT: Writing more complete rules. Untested, but closer to a working version
Okay so as I am reading this I adapted this rule to my scenario writing it out in rp text as well, but I am guess I am not seeing something (or it wasn't included). This rule set deals only with shutting off the light after a variable time limit with a manual override mode, but does not deal with turning on the light. Is this correct?
I am trying to create what you have here with the ability to also activate the light at various times of the early evening/night/early morning when motion is detected in the room. The problem I am having is that for whatever reason my coding does not allow the light to stay on even when motion is constantly detected. I have the timer set to reset when the sensor becomes not secure, but it doesn't seem to work.
Here is your coding updated with my zones/outputs and written in RP text:
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 40 STATE IS ON
THEN TURN Output 20 ON FOR 60 MINS, RESTART TIMER IF RUNNING
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 40 STATE IS OFF
THEN TURN Output 20 ON FOR 10 MINS, RESTART TIMER IF RUNNING
WHENEVER Output 20 STATE IS TURNED OFF
THEN SET Living Room - C (10 (A10)) OFF, FADE RATE = 3
THEN TURN Output 30 ON FOR 30 SECS
WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 30 STATE IS ON
AND Output 40 STATE IS OFF
THEN TURN Output 40 ON FOR 6 HRS
WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 40 STATE IS ON
THEN TURN Output 20 ON FOR 60 MINS
WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 40 STATE IS OFF
THEN TURN Output 20 ON FOR 10 MINS
And here is my current coding (without your stuff added yet)
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND THE TIME IS LATER THAN 20 MINUTES BEFORE SUNSET
AND TIME OF DAY IS EARLIER THAN 10:00 PM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 75% BRIGHT, FADE RATE = 3
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 10:00 PM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS EARLIER THAN 4:00 AM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 4:00 AM
AND THE TIME IS EARLIER THAN AT SUNRISE
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 40% BRIGHT, FADE RATE = 3
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND THE TIME IS LATER THAN AT SUNRISE
AND TIME OF DAY IS EARLIER THAN 10:00 PM
THEN TURN Output 20 ON FOR 10 MINS, RESTART TIMER IF RUNNING
WHENEVER Output 20 STATE IS TURNED OFF
THEN TURN Living Room - C [10 (A10)] OFF, FADE RATE = 3
Any help putting these together would be appreciated. Thank you