Cancel Fade of Lights

lights

#1

I have seen many threads discussing cancelling a fade once it starts. I have had similar issues, but found a way to cancel the fade inside the same piston.

I have a bearded dragon that lives in our basement / den. A lot of days nobody is down there until after dinner and I don’t want him to sit in the dark (even though his cage lights are on). I also wanted the lights to fade on over the course of 45 minutes, similar to the sun rising. However, I have sleep issues some some days I do go down to the dark quiet basement to see if I can get an extra hour after the family wakes up. When I do, the lights are fading on and I can’t stop them, until now.

I created a second if statement that says if the switch is turned to off, cancel all pending tasks and it seems to work fine.

I hope this helps someone.