In energy harvesting communications, the transceivers have to adjust the data transmission to the energy scavenged during the course of communication. The performance of the transmission depends on the channel conditions which vary randomly due to mobility and environmental changes. In this paper, we consider the problem of power allocation taking into account the energy arrivals over time and the quality of channel state information (CSI) measured at the transmitter, in order to maximize the throughput. Differently from previous work, we focus on energy harvesting communications where the CSI at the transmitter is not perfect and may include estimation errors. In the present paper, we introduce a Markov process that models the energy arrival process. Indeed, we solve the throughput maximization problem with respect to energy harvesting constraints. We show that the optimal online power policy can be found using dynamic programming. Furthermore, we study the asymptotic behavior of the communication system at low and high average recharge rate (ARR) regime. Selected numerical results are provided to support our analysis.