def main(): sensorName = "MCAM" dateTimeNow = datetime.datetime.now() path = mSR.getWritePathSnaps(sensorName,dateTimeNow) mSR.directoryCheck(path) print(path) onboardCapture = True # try: os.system("fswebcam -r 1280x720 --no-banner " + path) img = mpimg.imread(path,0) MCAMWrite(img,path,dateTimeNow)
def on_message(client, userdata, msg): print() print(" - - - MINTS DATA RECEIVED - - - ") print() # print(msg.topic+":"+str(msg.payload)) [nodeID,sensorID ] = msg.topic.split('/') sensorDictionary = decoder.decode(msg.payload.decode("utf-8","ignore")) dateTime = datetime.datetime.strptime(sensorDictionary["dateTime"], '%Y-%m-%d %H:%M:%S.%f') writePath = mSR.getWritePathMQTT(nodeID,sensorID,dateTime) exists = mSR.directoryCheck(writePath) sensorDictionary = decoder.decode(msg.payload.decode("utf-8","ignore")) print("Writing MQTT Data") print(writePath) mSR.writeCSV2(writePath,sensorDictionary,exists) print("Node ID :" + nodeID) print("Sensor ID :" + sensorID) print("Data : " + str(sensorDictionary))