print 'Plant ID is: ' + plantId return plantId def getStatus(): jsonInfos = arduino.readAllInfos() print 'Status: ' + jsonInfos return jsonInfos firstConnection = False plantId = getId() jsonId = '{"id":"'+ plantId + '"}' print 'Connecting to the Arduino...' arduino = Driver(); arduino.init() print '---> Arduino connected!' print 'Connecting to the Server...' socketIO = SocketIO('growstuff.herokuapp.com', 80, Namespace) #socketIO = SocketIO('192.168.1.25', 8080, Namespace) while not firstConnection: socketIO.wait(seconds=1) while 1: try: socketIO.emit('status', getStatus()) socketIO.wait(seconds=60) except ValueError as e: print '---> Read infos failed!' print e.strerror