How to get and record energy data