For the tinkerers here I've decided to move away from the Ardunio Nano and ESP8266 to Single Board Computer (SBC) to control the chicken coop automation. Please spare me your tales of whipping out your CC and ordering a door. I went with the Raspberry pi 3 and I'm quite happy with the device and the programming. So much easier to program than the Nano and ESP8266.
I've tried to attach the code but can't figure out how so I put it in the message for now.
	
	
	
		
JT
	
		
			
		
		
	
				
			I've tried to attach the code but can't figure out how so I put it in the message for now.
		Code:
	
	#!/usr/bin/env python
# GPIO.VERSION '0.6.3'
# Raspberry Pi 3 Model B Rev 1.2
import RPi.GPIO as GPIO
import schedule
import astral
import datetime
from pytz import timezone
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(True)
GPIO.setup(4, GPIO.OUT) # Motor FWD
GPIO.output(4, False)
GPIO.setup(5, GPIO.OUT) # Motor REV
GPIO.output(5, False)
GPIO.setup(6, GPIO.OUT) # Door Lock
GPIO.output(6, False)
GPIO.setup(7, GPIO.OUT) # Lights
GPIO.output(7, False)
GPIO.setup(26, GPIO.IN,pull_up_down=GPIO.PUD_DOWN) # Up Door Switch
GPIO.setup(27, GPIO.IN,pull_up_down=GPIO.PUD_DOWN) # Down Door Switch
# Construct our location.  Longitude west and latitude south are negative
coordinates = ["Poplar Bluff", "USA", 36.763084, -90.413871, "US/Central", 110]
pbmo = astral.Location(info=(coordinates))
pbmo.solar_depression = "civil"
egglight = 840 # minutes of daylight desired
timeformat = "%I:%M %p"
sunrise = timezone('US/Central').localize(datetime.datetime.now())
sunset = timezone('US/Central').localize(datetime.datetime.now())
lighton = timezone('US/Central').localize(datetime.datetime.now())
def update():
    global sunrise
    global sunset
    global lighton
    sunrise = pbmo.sunrise(datetime.date.today())
    sunset = pbmo.sunset(datetime.date.today())
    # amount of daylight in HH:MM:SS
    daylight = sunset - sunrise
    print "Daylight {}".format(daylight)
    lightmin = daylight.seconds / 60
    if egglight > lightmin:
        extralight = egglight - lightmin
        lighton = sunrise - datetime.timedelta(minutes=extralight)
    now = timezone('US/Central').localize(datetime.datetime.now())
    print "Lights On {}".format(lighton.strftime(timeformat))
    print "Sunrise {}".format(sunrise.strftime(timeformat))
    print "Sunset {}".format(sunset.strftime(timeformat))
def status(runtime):
    global sunrise
    global sunset
    global lighton
    now = timezone('US/Central').localize(datetime.datetime.now())
    #print now.tzinfo
    #print lighton.tzinfo
    print(datetime.datetime.now().strftime("%H:%M"))
    #print lighton < now
    #print now < sunrise
    #print now > sunrise
    #print now < lighton
    #print now > sunset
    if lighton < now and now < sunrise:
        print "The light should be on"
        GPIO.output(7, True) # Lights
    if now > sunrise:
        print "The light should be off"
        GPIO.output(7, False) # Lights
    if lighton < now and now < sunset:
        if not GPIO.input(26) and runtime < 60: # Up Door Switch
            print "The door is opening"
            GPIO.output(4, True) # Motor FWD
            GPIO.output(6, True) # Door Lock
    if now < lighton or now > sunset:
        if not GPIO.input(27) and runtime < 60: # Down Door Switch
            print "The door ise closing"
            GPIO.output(5, True) # Motor REV
            GPIO.output(6, True) # Door Lock
    if GPIO.input(26): # Up Door Switch
        print("The Door is Open")
    else:
        print("Pin 26 is LOW")
    if GPIO.input(27): # Down Door Switch
        print("The Door is Closed")
    else:
        print("Pin 27 is LOW")
    if GPIO.input(4): # Motor FWD
        print "GPIO 4 is HIGH"
def motor(): # monitor the motor when moving
    pass
update()
runtime = 0
schedule.every(1).minutes.do(status, runtime)
schedule.every().hour.do(update)
schedule.every().day.at("02:00").do(update)
try:
    while True:
        schedule.run_pending()
        #global runtime
        if GPIO.input(6): # the door lock is on meaning the door is moving
            runtime += 1
            print runtime
        if runtime >= 60:
            GPIO.output(4, False) # Motor FWD
            GPIO.output(5, False) # Motor REV
            GPIO.output(6, False) # Door Lock
        if GPIO.input(4) and GPIO.input(26): # Motor FWD and Up Door Switch
            GPIO.output(4, False) # Motor FWD
            GPIO.output(6, False) # Door Lock
            runtime = 0
        if GPIO.input(5) and GPIO.input(27): # Motor REV and Down Door Switch
            GPIO.output(5, False) # Motor REV
            GPIO.output(6, False) # Door Lock
            runtime = 0
        if not GPIO.input(4) and not GPIO.input(5) and not GPIO.input(6):
            if GPIO.input(26) or GPIO.input(27):
                runtime = 0
        time.sleep(1)
except KeyboardInterrupt:
    # here you put any code you want to run before the program
    # exits when you press CTRL+C
    print "\nKeyBoard Interrupt"
except Exception,e:
    # this covers all other exceptions
    print str(e)
finally:
    GPIO.cleanup() # this ensures a clean exit
	JT
	
			
