This is the rule I have setup. It uses time periods so the light comes on at 100% during the day, 30% at night, and not at all if we're sleeping.
The problem I have has to do with the variable that prevents the light from turning off if I am working from home. I have a separate rule that sets it to true if the plug reports > 100W and false when it drops below.
Here is the log for the rule that set the variable to False after I put my computer to sleep.
The plug is a Kasa HS110 connected via wifi. It is polled every 5 minutes. So when it polled at 8:35 the power was 123W. When it polled again at 8:40 the power was 22W. So the computer was turned off sometime between 8:35 and 8:40.
Here is the log for the RL instance above during the same time period.
If I turn off the computer and walk out of the room, the light will not turn off until someone walks in and then leaves again. When the variable becomes false and turning off is re-enabled, I want it to check the means to turn off and see if there has been no motion for 2 minutes.