Will this nighttime automation work?

See the sticky about code formatting.