In this paper, we consider the problem of energy and data control in energy cooperation networks powered by renewable energy. In such networks, nodes can provide data transmission service, and at the same time they have power lines to transfer the harvested energy to others. We develop an online algorithm called Energy and Data Aware (EDA) algorithm using Lyapunov analysis, which makes data admission control and decides energy allocation for traffic transmission and energy transfer. In our EDA algorithm, the node only needs to keep track of its own energy storage status and does not require any
knowledge of the energy harvesting process. We show that the proposed algorithm achieves a utility that is within O(ε) of the optimal, for any ε > 0, while ensuring that both the network data queue length and the capacity of energy storage devices are upper bounded by bounds of size O(1/ε).