In this paper, we consider the problem of operating a battery storage unit in a home with a rooftop solar photovoltaic (PV) system so as to minimize expected long-run electricity costs under uncertain electricity usage, PV generation, and electricity prices. Solving this dynamic program using standard techniques is computationally burdensome, and is often complicated by the difficulty of estimating conditional distributions from sparse data. To overcome these challenges, we implement a data-driven dynamic programming (DDP) algorithm that uses historical data observations to generate empirical conditional distributions and approximate the cost-to-go function. Then, we formulate two robust data-driven dynamic programming (RDDP) algorithms that consider the worst-case expected cost over a set of conditional distributions centered at the empirical distribution, and within a given Chi-square or Wasserstein distance, respectively. We test our algorithms using data from homes with rooftop PV in Austin, Texas. Numerical results reveal that DDP and RDDP outperform common existing methods with acceptable computational effort. Finally, we show that implementation of these superior operational algorithms significantly raises the break-even battery cost under which a homeowner is incentivized to invest in a residential battery rather than participate in a feed-in tariff or net energy metering program.