The present work proposes a stochastic approach for Day-Ahead operation of Home Energy Management Systems when batteries, solar photovoltaic resources and Electric Water Heaters are considered. The optimization problem minimizes the operation costs formed by energy procurement in the wholesale market and the equivalent cycling aging cost of the batteries, and also includes the uncertainty of the PV production and the load. The complete two-stage stochastic formulation results in a Mixed-Integer Nonlinear Programming problem that is decomposed using a Competitive Swarm Optimizer to handle the calculation of the battery cycling aging cost. A Storage Disaggregation Algorithm based on Lagrangian relaxation is used to reduce the problem size and to allocate individual State of Charge for the batteries. In addition, the advantages of considering a stochastic approach are shown by means of the Value of the Stochastic Solution. This methodology has been developed in the context of the Horizon 2020 project SENSIBLE as part of the tasks related to a use case that considers an aggregator that participates in the electricity market with a portfolio of prosumers with active demand capability.