added initial power measurement, relay and led control code