Using solar power in wireless sensor networks (WSNs) requires adaptation to a highly varying energy supply. From an application's perspective, however, it is often preferred to operate at a constant quality level as opposed to changing application behavior frequently. Reconciling the varying supply with the fixed demand requires good tools for predicting supply such that its average is computed and demand is fixed accordingly. In this paper, we describe a probabilistic observation-based model for harvested solar energy, which accounts for both long-term tendencies and temporary environmental conditions. Based on this model, we develop a time-slot-based energy allocation scheme to use the periodically harvested solar energy optimally, while minimizing the variance in energy allocation. Our algorithm is tested on both outdoor and indoor testbeds, demonstrating the efficacy of the approach.