Yes. You are converting between forms of energy. You are converting kinetic energy of the moving weight into electrical current. The magnetic field is nothing but a go-between. You could eliminate it and have the weight movement converted to current by other means (as a spurious example, direct contact with a piezo-electric crystal) It doesn't matter how you convert the energy. The point is that any energy used to create current will come from the KE/PE of the weight, slowing it down. There is no extra energy you can use. Your device will work for one swing of the weight, just like dropping an apple. The apple does not contain any energy to lift itself back up. And neither gravity nor magnetism nor a magnetic apple will change that. This is what thermodynamics is about. You might want to at least skim the definition of it before assuming its about "hot and cold". It isn't. It is what powers the universe.