My outdoor lighting scenario (Night- and door triggered)

Hi guys.

Inspired by the PLEG Basics document I decided to automate my outdoor lightning.

The light turns on at sunset and turns off at a specific time depending on day of week. Vera also turns on the outdoor lights if the door is opened during the night (unless it’s already on) and keep it on for a while after the door is closed. (No motion detector is involved in my lighting scenario)

I just managed to get it working as desired (to my knowledge) but I’m eager to learn how my code can be improved or simplified if you have some ideas.

I’ve attached the results of my efforts in a PDF file.