def tcpServer(self, host, port): if host is not None: if port is not None: self.sock.settimeout(10) self.sock.bind((host, port)) self.sock.listen() conn, addr = self.sock.accept() with conn: print('Connected by', addr) while True: data = conn.recv(1024) if not data: break conn.sendall(data) self.sock.close() return True else: errCode = "MISSING PORT" errMsg = "No port was given to the function." deviceLog().errorLog(errCode, errMsg) print("MISSING PORT") return False else: errCode = "MISSING HOST" errMsg = "No host was given to the function." deviceLog().errorLog(errCode, errMsg) print("MISSING HOST") return False
def readSerial(ser, code): if ser is not None: if ser.writable(): #Read/Write serial ser.reset_output_buffer() ser.reset_input_buffer() statusBit = str.encode(str(code) + "\r\n") ser.write(statusBit) #time.sleep(0.1) reading = ser.readline() #time.sleep(0.1) return reading else: errCode = "SERIAL NOT WRITABLE" errMsg = "Serial device was not in a writable state" deviceLog().errorLog(errCode, errMsg) print("SERIAL NOT WRITABLE") reading = None return reading else: errCode = "NO SERIAL GIVEN" errMsg = "No serial value provided." deviceLog().errorLog(errCode, errMsg) print("NO SERIAL GIVEN") reading = None return reading
def tcpMSG(self, host, port, msg): if host is not None: if port is not None: if msg is not None: self.sock.settimeout(10) self.sock.connect((host, port)) self.sock.sendall(str.encode(msg)) data = self.sock.recv(len(msg) + 2) if str(data).replace('b', '').replace("'", '') == msg: return True else: errCode = "ICORRECT MESSAGE" errMsg = "TCP return message did not match origonal message." deviceLog().errorLog(errCode, errMsg) print("ICORRECT MESSAGE") return False else: errCode = "MISSING MESSAGE" errMsg = "No message was given to the function." deviceLog().errorLog(errCode, errMsg) print("MISSING MESSAGE") return False else: errCode = "MISSING PORT" errMsg = "No port was given to the function." deviceLog().errorLog(errCode, errMsg) print("MISSING PORT") return False else: errCode = "MISSING HOST" errMsg = "No host was given to the function." deviceLog().errorLog(errCode, errMsg) print("MISSING HOST") return False
def closeSerial(ser): if ser is not None: if ser.isOpen(): ser.close() time.sleep(0.5) else: print("SERIAL NOT OPEN") return False else: errCode = "NO SERIAL GIVEN" errMsg = "No serial value provided." deviceLog().errorLog(errCode, errMsg) print("NO SERIAL GIVEN") return False
def initalizeOut(self, pin): if pin is not None: try: GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, False) #Initalize as off time.sleep(0.1) return True except Exception as e: errCode = "ERROR INITALIZING OUTPUT" errMsg = "Unable to set GPIO pin " + str(pin) + " as output." deviceLog().errorLog(errCode, errMsg) print("ERROR INITALIZING OUTPUT") return False else: return False
def initalizeIn(self, pin): if pin is not None: try: GPIO.setmode(GPIO.BCM) GPIO.setup(pin, GPIO.IN) time.sleep(0.1) return True except Exception as e: errCode = "ERROR INITALIZING INPUT" errMsg = "Unable to set GPIO pin " + str( pin ) + " as input. The following error code appeared; " + str(e) deviceLog().errorLog(errCode, errMsg) print("ERROR INITALIZING INPUT") return False else: return False
def sensorValue(self, sensor, unit, reading): if sensor is not None: if unit is not None: if reading is not None: try: #Processing of serial reading = reading.decode("utf-8").replace("\\r", "") reading = reading.replace("\\n'", "") reading = reading.replace("b'", "") reading = reading.split(",") bank = [] for line in reading: hold = line.split("=") bank.insert(len(bank), hold) #Parsing of data for sensor value for value in bank: if str(value[0]) == str(sensor): sens_val = float(value[1].replace( str(unit), "")) break else: sens_val = "ERROR" return sens_val except Exception as e: errCode = "ERROR FINDING SENSOR" errMsg = "Error finding sensor " + str( sensor ) + ". The following error code appeared; " + str(e) deviceLog().errorLog(errCode, errMsg) print("ERROR FINDING SENSOR") sens_val = "ERROR" return sens_val else: errCode = "NO READING GIVEN" errMsg = "No reading provided for finding sensor " + str( sensor) + "." deviceLog().errorLog(errCode, errMsg) print("NO READING GIVEN FOR SENSOR " + str(sensor)) sens_val = "ERROR" return sens_val else: errCode = "NO UNIT GIVEN" errMsg = "No unit provided for sensor " + str(sensor) + "." deviceLog().errorLog(errCode, errMsg) print("NO UNIT GIVEN FOR SENSOR " + str(sensor)) sens_val = "ERROR" return sens_val else: errCode = "NO SENSOR GIVEN" errMsg = "No sensor value provided." deviceLog().errorLog(errCode, errMsg) print("NO SENSOR GIVEN") sens_val = "ERROR" return sens_val
def captureIMG(fileName): if fileName is not None: if os.path.isfile(fileName): os.remove(fileName) time.sleep(0.1) cameraPi = PiCamera() rawCapture = PiRGBArray(cameraPi) time.sleep(0.1) cameraPi.capture(rawCapture, format="bgr") image = rawCapture.array cv2.imwrite(fileName, image) cameraPi.close() return True else: errCode = "NO FILE NAME PROVIDED" errMsg = "No file name was provided for the photo to be saved as." deviceLog().errorLog(errCode, errMsg) print("NO FILE NAME PROVIDED") return False
def wAverage(self, valueBank, weightBank): if valueBank is not None: if weightBank is not None: if len(valueBank) == len(weightBank): count = 0 value = 0 for x in range(len(valueBank)): if type(valueBank[x]) is not str: try: value = value + (int(valueBank[x]) * weightBank[x]) count = count + 1 except: pass if count == 0: value = "NA" errCode = "SYSTEM FAILURE" errMsg = "Unable to process values failed while calculating weighted average for valueBank " + str( valueBank) + "." deviceLog().errorLog(errCode, errMsg) print("SYSTEM FAILURE - CALCULATION FAILURE") else: value = value / count return value else: value = "NA" errCode = "BANKS ARE NOT SAME LENGTH" errMsg = "Banks supplied are different sizes." deviceLog().errorLog(errCode, errMsg) print("BANKS ARE NOT SAME LENGTH") return value else: value = "NA" errCode = "NO WEIGHT BANK PROVIDED" errMsg = "No weight bank list was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO WEIGHT BANK PROVIDED") return value else: value = "NA" errCode = "NO VALUE BANK PROVIDED" errMsg = "No value bank list was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO VALUE BANK PROVIDED") return value
def Mister(self, pin, humidity, humidity_sp): if pin is not None: if humidity is not None: if humidity_sp is not None: init = self.initalizeOut(pin) if init == True: try: if int(humidity) < int(humidity_sp): GPIO.output(pin, True) return 0 #ON else: GPIO.output(pin, False) return 1 #OFF except Exception as e: errCode = "ERROR CONTROLING MISTER" errMsg = "Error occured when trying to control the mister on GPIO pin " + str( pin ) + ". The following error code appeared; " + str( e) deviceLog().errorLog(errCode, errMsg) print("ERROR CONTROLING MISTER") return 2 #ERROR else: #Could not initalize return 2 #ERROR else: errCode = "NO HUMIDITY SETPOINT GIVEN" errMsg = "No humidity setpoint value was provided for GPIO pin " + str( pin) + "." deviceLog().errorLog(errCode, errMsg) print("NO HUMIDITY SETPOINT GIVEN") return 2 #ERROR else: errCode = "NO HUMIDITY GIVEN" errMsg = "No humidity value was provided " + str(pin) + "." deviceLog().errorLog(errCode, errMsg) print("NO HUMIDITY GIVEN") return 2 #ERROR else: errCode = "NO PIN GIVEN" errMsg = "No pin value provided for the mister." deviceLog().errorLog(errCode, errMsg) print("NO PIN GIVEN FOR THE MISTER") return 2 #ERROR
def Light(self, pin, light): if pin is not None: if light is not None: init = self.initalizeOut(pin) if init == True: try: #Handling of day Ligh light = light.split(",") offset = light[0] dayLight = light[1] lightEnd = int(offset) + int(dayLight) hour = strftime("%H", gmtime()) if int(hour) > int(offset) and int(hour) <= int( lightEnd): GPIO.output(pin, True) return 0 #ON else: GPIO.output(pin, False) return 1 #OFF except Exception as e: errCode = "ERROR CONTROLING LIGHT" errMsg = "Error occured when trying to control light on GPIO pin " + str( pin ) + ". The following error code appeared; " + str(e) deviceLog().errorLog(errCode, errMsg) print("ERROR CONTROLING LIGHT") return 2 #ERROR else: #Could not initalize return 2 #ERROR else: errCode = "NO LIGHT VALUE GIVEN" errMsg = "No light value was provided on GPIO pin " + str( pin) + "." deviceLog().errorLog(errCode, errMsg) print("NO LIGHT VALUE GIVEN") return 2 #ERROR else: errCode = "NO PIN GIVEN" errMsg = "No pin value provided for the light." deviceLog().errorLog(errCode, errMsg) print("NO PIN GIVEN FOR THE LIGHT") return 2 #ERROR
def Pump(self, pin, ws, amount, flowRate): if pin is not None: if ws is not None: init = self.initalizeOut(pin) if init == True: try: #Handaling of water pumps if int(ws) >= 200: runTime = time.time() + ( 60.00 * (float(amount) / float(flowRate))) while time.time() <= runTime: GPIO.output(pin, True) return 0 #ON else: GPIO.output(pin, False) return 1 #OFF except Exception as e: errCode = "ERROR CONTROLING PUMP" errMsg = "Error occured when trying to control pump on GPIO pin " + str( pin ) + ". The following error code appeared; " + str(e) deviceLog().errorLog(errCode, errMsg) print("ERROR CONTROLING PUMP") return 2 #ERROR else: #Could not initalize return 2 #ERROR else: errCode = "NO WATER SENSOR GIVEN" errMsg = "No water sensor value was provided for GPIO pin " + str( pin) + "." deviceLog().errorLog(errCode, errMsg) print("NO WATER SENSOR GIVEN") return 2 #ERROR else: errCode = "NO PIN GIVEN" errMsg = "No pin value provided for the pump." deviceLog().errorLog(errCode, errMsg) print("NO PIN GIVEN FOR THE PUMP") return 2 #ERROR
def hotPlate(self, pin, output): if pin is not None: if output is not None: init = self.initalizeOut(pin) if init == True: try: #Handling of hot plate if output == True: GPIO.output(pin, GPIO.LOW) return 0 #ON elif output == False: GPIO.output(pin, GPIO.HIGH) return 1 #OFF except Exception as e: errCode = "ERROR CONTROLING HOTPLATE" errMsg = "Error occured when trying to control hotplate on GPIO pin " + str( pin ) + ". The following error code appeared; " + str(e) deviceLog().errorLog(errCode, errMsg) print("ERROR CONTROLING HOTPLATE") return 2 #ERROR else: #Could not initalize return 2 #ERROR else: errCode = "NO OUTPUT STATE GIVEN" errMsg = "No output state was provided for GPIO pin " + str( pin) + "." deviceLog().errorLog(errCode, errMsg) print("NO OUTPUT STATE GIVEN") return 2 #ERROR else: errCode = "NO PIN GIVEN" errMsg = "No pin value provided for the hotplate." deviceLog().errorLog(errCode, errMsg) print("NO PIN GIVEN FOR THE HOTPLATE") return 2 #ERROR
def openSerial(): USB0 = '/dev/ttyACM0' #/dev/ttyACM0 location of serial device USB1 = '/dev/ttyUSB0' #/dev/ttyUSB0 location of serial device if os.path.exists(USB0): if serial.Serial(USB0): ser = serial.Serial(USB0, 9600, timeout=0.5) time.sleep(1.7) return ser else: errCode = "CONNECTION FAILURE" errMsg = "Serial device was unnable to connect with " + str( USB0) deviceLog().errorLog(errCode, errMsg) print("NO SERIAL CONNECTION") ser = None return ser elif os.path.exists(USB1): if serial.Serial(USB1): ser = serial.Serial(USB1, 9600, timeout=0.5) time.sleep(1.7) return ser else: errCode = "CONNECTION FAILURE" errMsg = "Serial device was unnable to connect with " + str( USB1) deviceLog().errorLog(errCode, errMsg) print("NO SERIAL CONNECTION") ser = None return ser else: errCode = "NO SERIAL" errMsg = "No serial communication device unpluged." deviceLog().errorLog(errCode, errMsg) print("NO SERIAL CONNECTION") ser = None return ser
def Fire(sensor): errCode = "FIRE" errMsg = "Fire was detected with fire sensor " + str(sensor) deviceLog().errorLog(errCode, errMsg) GPIO.cleanup() return True
def atmMain(self, humiditySP, carbonSP, tempatureSP, mainLight, potLight1, potLight2, potLight3, elecSP, ser): if humiditySP is not None: if carbonSP is not None: if tempatureSP is not None: if mainLight is not None: if potLight1 is not None: if potLight2 is not None: if potLight3 is not None: if elecSP is not None: if ser is not None: if ser.isOpen() == True: #Output Pin variables L1_Pin = 2 #Light GPIO 8 L2_Pin = 3 #Light GPIO 9 L3_Pin = 4 #Light GPIO 7 L4_Pin = 17 #Light GPIO 0 L5_Pin = 27 #Light GPIO 2 F1_Pin = 22 #Circulation fan GPIO 3 F2_Pin = 10 #Exhaust fan GPIO 12 F3_Pin = 9 #Intake fan GPIO 13 F4_Pin = 11 #Transition fan GPIO 14 F5_Pin = 5 #Electrical exhaust fan GPIO 21 F6_Pin = 6 #Electrical intake fan GPIO 22 M1_Pin = 26 #Mister GPIO 10 sensorBank1 = network.readSerial( ser, 1) sensorBank3 = network.readSerial( ser, 3) #Temp sensors thIndex = 11 tBank = [] for x in range(5): tempHold = deviceControl( ).sensorValue( "T" + str(x + thIndex), "C", sensorBank1) #Main box tBank.insert( len(tBank), tempHold) tempWeight = [1, 1, 1, 1, 1] temp = deviceControl( ).wAverage(tBank, tempWeight) print("temp = " + str(temp)) #Humidity sensors hBank = [] for x in range(5): humidHold = deviceControl( ).sensorValue( "H" + str(x + thIndex), "%", sensorBank1) #Main box hBank.insert( len(hBank), humidHold) humidWeight = [1, 1, 1, 1, 1] humid = deviceControl( ).wAverage(hBank, humidWeight) print("humidity = " + str(humid)) #Electrical box sensors t6 = deviceControl( ).sensorValue( "T6", "C", sensorBank1 ) #Electrical box try: elecTemp = int(t6) print( "Electircal Box Tempature = " + str(elecTemp)) except: elecTemp = "NA" print( "SYSTEM FAILURE - ELECTRICAL BOX SENSORS OFFLINE" ) #Carbon sensors c1 = deviceControl( ).sensorValue( "C1", "%", sensorBank1) try: carbon = int(c1) print( "Carbon contentent = " + str(carbon)) except: carbon = "NA" print( "SYSTEM FAILURE - CARBON SENSORS OFFLINE" ) #Fire sensors fIndex = 11 fBank = [] for x in range(5): fireHold = deviceControl( ).sensorValue( "F" + str(x + fIndex), "C", sensorBank3 ) #Fire sensore in bix fBank.insert( len(fBank), fireHold) try: fire = 0 for value in fBank: if value != "NA": fire = fire + int( value) if fire == 0: fire = "NA" print( "SYSTEM FAILURE - FIRE SENSORS OFFLINE" ) else: print( "Fire levels are = " + str(fire)) except: fire = "NA" print( "SYSTEM FAILURE - FIRE SENSORS OFFLINE" ) #Output control fireLevel = 1000 if fire == "NA": return False elif int(fire) <= int( fireLevel ) and fire != "NA": #If fire is not detected deviceControl().Light( L1_Pin, mainLight) #Light deviceControl().Light( L2_Pin, potLight1) #Light deviceControl().Light( L3_Pin, potLight2) #Light deviceControl().Light( L4_Pin, potLight3) #Light deviceControl().Fan( F1_Pin, True) #Circulation if float(elecSP) <= float( elecTemp ) and elecTemp != "NA": #Electrical box to hot if float( tempatureSP ) <= float( temp ) and temp != "NA": #Too hot if float( carbonSP ) <= float( carbon ) and carbon != "NA": #Too much carbon dioxide deviceControl( ).Fan( F2_Pin, True ) #Exhaust deviceControl( ).Fan( F3_Pin, True ) #Intake deviceControl( ).Fan( F4_Pin, False ) #Circulation deviceControl( ).Fan( F5_Pin, True ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[1,1,0,1,1]" ) elif float( carbonSP ) > float( carbon ) and carbon != "NA": #Too little carbon dioxide deviceControl( ).Fan( F2_Pin, False ) #Exhaust deviceControl( ).Fan( F3_Pin, True ) #Intake deviceControl( ).Fan( F4_Pin, True ) #Circulation deviceControl( ).Fan( F5_Pin, False ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[0,1,1,0,1]" ) elif carbon == "NA": #Carbon sensors offline return False elif float( tempatureSP ) > float( temp ) and temp != "NA": #Too cold if float( carbonSP ) <= float( carbon ) and carbon != "NA": #Too much carbon dioxide deviceControl( ).Fan( F2_Pin, False ) #Exhaust deviceControl( ).Fan( F3_Pin, False ) #Intake deviceControl( ).Fan( F4_Pin, False ) #Circulation deviceControl( ).Fan( F5_Pin, True ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[0,0,0,1,1]" ) elif float( carbonSP ) > float( carbon ) and carbon != "NA": #Too little carbon dioxide deviceControl( ).Fan( F2_Pin, True ) #Exhaust deviceControl( ).Fan( F3_Pin, False ) #Intake deviceControl( ).Fan( F4_Pin, True ) #Circulation deviceControl( ).Fan( F5_Pin, False ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[1,0,1,0,1]" ) elif carbon == "NA": #Carbon sensor offline return False elif temp == "NA": #Tempature sensors offline return False elif float(elecSP) > float( elecTemp ) and elecTemp != "NA": #Electrical box ok if float( tempatureSP ) <= float( temp ) and temp != "NA": #Too hot if float( carbonSP ) <= float( carbon ) and carbon != "NA": #Too much carbon dioxide deviceControl( ).Fan( F2_Pin, True ) #Exhaust deviceControl( ).Fan( F3_Pin, True ) #Intake deviceControl( ).Fan( F4_Pin, False ) #Circulation deviceControl( ).Fan( F5_Pin, False ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, False ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[1,1,0,0,0]" ) elif float( carbonSP ) > float( carbon ) and carbon != "NA": #Too little carbon dioxide deviceControl( ).Fan( F2_Pin, True ) #Exhaust deviceControl( ).Fan( F3_Pin, False ) #Intake deviceControl( ).Fan( F4_Pin, True ) #Circulation deviceControl( ).Fan( F5_Pin, False ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[1,0,1,0,1]" ) elif carbon == "NA": #Carbon sensor offline return False elif float( tempatureSP ) > float( temp ) and temp != "NA": #Too cold if float( carbonSP ) <= float( carbon ): #Too much carbon dioxide deviceControl( ).Fan( F2_Pin, False ) #Exhaust deviceControl( ).Fan( F3_Pin, False ) #Intake deviceControl( ).Fan( F4_Pin, True ) #Circulation deviceControl( ).Fan( F5_Pin, True ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, False ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[0,0,1,1,0]" ) elif float( carbonSP ) > float( carbon ) and carbon != "NA": #Too little carbon dioxide deviceControl( ).Fan( F2_Pin, True ) #Exhaust deviceControl( ).Fan( F3_Pin, False ) #Intake deviceControl( ).Fan( F4_Pin, True ) #Circulation deviceControl( ).Fan( F5_Pin, False ) #Electrical exhaust deviceControl( ).Fan( F6_Pin, True ) #Electrical intake print( "[f2,f3,f4,f5,f6]" ) print( "[1,0,1,0,1]" ) elif carbon == "NA": #Carbon sensor offline return False elif temp == "NA": #Tempature sensors offline return False elif elecTemp == "NA": #Electical sensors offline return False deviceControl().Mister( M1_Pin, humid, humiditySP) #Mister return True elif int(fire) > int( fireLevel ) and fire != "NA": if int(fBank[0] ) > fireLevel: deviceControl().Fire( "F1") elif int(fBank[1] ) > fireLevel: deviceControl().Fire( "F2") elif int(fBank[2] ) > fireLevel: deviceControl().Fire( "F3") elif int(fBank[3] ) > fireLevel: deviceControl().Fire( "F4") elif int(fBank[4] ) > fireLevel: deviceControl().Fire( "F5") return False else: errCode = "SERIAL CLOSED" errMsg = "The serial instance was closed when provided for the machine." deviceLog().errorLog( errCode, errMsg) print("SERIAL CLOSED") return False else: errCode = "NO SERIAL PROVIDED" errMsg = "No serial instance was provided for the machine." deviceLog().errorLog( errCode, errMsg) print("NO SERIAL PROVIDED") return False else: errCode = "NO ELECSP PROVIDED" errMsg = "No electrical setpoint was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO ELECSP PROVIDED") return False else: errCode = "NO POTLIGHT 3 PROVIDED" errMsg = "No pot light 3 percentage value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO POTLIGHT 3 PROVIDED") return False else: errCode = "NO POTLIGHT 2 PROVIDED" errMsg = "No pot light 2 percentage value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO POTLIGHT 2 PROVIDED") return False else: errCode = "NO POTLIGHT 1 PROVIDED" errMsg = "No pot light 1 percentage value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO POTLIGHT 1 PROVIDED") return False else: errCode = "NO MAIN LIGHT PROVIDED" errMsg = "No main light percentage value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO MAIN LIGHT PROVIDED") return False else: errCode = "NO TEMPATURE SETPOINT PROVIDED" errMsg = "No tempature setpoint value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO TEMPATURE SETPOINT PROVIDED") return False else: errCode = "NO CARBON SETPOINT PROVIDED" errMsg = "No carbon setpoint value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO CARBON SETPOINT PROVIDED") return False else: errCode = "NO HUMIDITY SETPOINT PROVIDED" errMsg = "No humidity setpoint value was provided for the machine." deviceLog().errorLog(errCode, errMsg) print("NO HUMIDITY SETPOINT PROVIDED") return False
* @modifiedby BB * @brief testing playground to try out classes */ """ import time from atmSequence import atmosphere #from pumpSequence import pumps from networking import network from logger import deviceLog from filer import filer if __name__ == "__main__": startTime = time.time() plantName = "Plant1" plantStrain = "Kush" index = deviceLog().findIndex("dayLog.txt", plantName) print(index) elecSP = 40 phSP = 50 fullSP = deviceLog().findSP("autoSP.csv", int(index)) tempatureSP = fullSP[0] humiditySP = fullSP[1] carbonSP = fullSP[2] mainLight = fullSP[3] potLight1 = fullSP[4] potLight2 = fullSP[5] potLight3 = fullSP[6] ser = network.openSerial() stats = ["Tempature=20"] deviceLog().dayLog(index, plantName, plantStrain, stats)