def main(): logWrite("Started the raspiGrow system") sens1 = cfg.get("Sensors", "sensor1") sens2 = cfg.get("Sensors", "sensor2") sens3 = cfg.get("Sensors", "sensor3") lightStatus = None fanStatus = 0 while True: try: # Get settings and values reReadConfig() intake = float(temp.read(sens1)) water = float(temp.read(sens2)) exhaust = float(temp.read(sens3)) time = int(strftime("%H")) # Light commands lightStatus = lightSwitch(time, lightStatus) # Fan commands fanStatus = adjustFan(int(intake), fanStatus) # Temperature log logg.inputTMP("{!s},{!s},{!s}".format(intake, water, exhaust)) sleep(int(cfg.get("System", "interval"))) except KeyboardInterrupt: logg.inputSYS("Program terminated by user!") exit()
def logWrite(string): logg.inputSYS(string)