We consider the problem of online scheduling of jobs on unrelated machines with dynamic speed scaling to minimize the sum of energy and weighted flow time. We give an algorithm with an almost optimal competitive ratio for arbitrary power functions. (No earlier results handled arbitrary power functions for minimizing flow time plus energy with unrelated machines.) For power functions of the form f(s) = sα for some constant α> 1, we get a competitive ratio of O ( α logα), improving upon a previous competitive ratio of O(α2) by Anand et al. [3], along with a matching lower bound of Ω ( α logα). Further, in the resource augmentation model, with a 1 + speed up, we give