# Instance of Levels and Thresholds ce = CurrentTime() th = Timer() while True: # Get Timer Changes and Current Time th.setTimer(fb) ce.checkCurrent() # Create timestamp string for timelapse picture timestamp = time.strftime('%m%d%Y_%H%M%S') # Check Timer if (ce.getHour() >= th.getTimeOn() and ce.getHour() < th.getTimeOff()): # Start Camera camera.start_preview() time.sleep(2) # Capture Timelapse camera.capture('/home/pi/Pictures/Reaper - ' + timestamp + '.jpg') time.sleep(2) # Capture Current Snapshot camera.capture('/home/pi/Pictures/currentpicture.jpg') # Upload to Firebase current_picture = bucket.blob('currentpicture.jpg') current_picture.upload_from_filename( filename='/home/pi/Pictures/currentpicture.jpg') time.sleep(30) # Wait 30 Seconds
def testSetTimeOff(self): timer = Timer() t = datetime.time(hour=22, minute=30, second=15, microsecond=250) timer.setTimeOff(t) s = timer.getTimeOff() self.assertEqual(t, s)