OK. I've been banging my head against this rule for weeks, and I just can't see what the problem is. Maybe fresh eyes will spot it.
What this rule does, in theory, is to control the kitchen lights based on mode and motion. When there is motion during the day, the light level is set based on lux. At night the light level is set to dim. Lights go out with no motion after 10 minutes during the day, or two minutes at night. During the day the lights are faded out over time. At night they just go out. If the lights have started to fade out and there is new motion, the lights should come back on again.
All that works, almost all the time. Every now and then, when the lights are in the middle of the fade, new motion does not trigger the lights to turn on again, and they continue the fade until they turn off. At that point, motion will again turn the lights on. You can actually see this in the logs. The lights are fading off, then at 6:34:11.746 there is motion, the lights say they are set to 100%, but then go on fading from where they left off.
Here's the rule. Sorry I had to split it up into two parts. I know that makes it hard to read.
Thanks for any help!