In recent years, power systems have experimented a great development as a consequence of the apparition of the distributed generation. Renewable energy sources, active users and electric vehicles play a fundamental role in power systems, which has supposed a new topic research. In this scenario, the figure of prosumer has gained relevance due to the multiple advantages that they can contribute to improve the behavior of power systems and to achieve energy and cost savings. In particular, special attention is focus on photovoltaic (PV) arrays integrated in residential buildings with energy storage systems (ESSs), such as batteries or ultracapacitors (UCs) or even a combination of both in a hybrid energy storage system (HESS). This paper presents an energy management strategy to exchange energy between the batteries and the UCs that form a HESS installed with a PV array in a prosumer dwell in order to maintain its UC bank available to support the energy requirements during the most time possible.