Optimizing Power Consumption by Analyzing Sensor Data