For the unexpected turning off, add a "turn off only between..." option along with the "turn on only"
I believe it's the same issue as this: