Optimality of myopic scheduling and whittle indexability for energy harvesting sensors