• Developing a new stochastic-interval model for energy management in communities. • The developed model considers controllable demand, vehicle-to-grid and energy storage. • The developed model allows to adopt pessimistic or optimistic strategies. • Obtained results reveal the benefits on gathering prosumers on communities. • Community operation reduces the energy that must be acquired from the grid. With the advent of smart cities, residential consumers have evolved towards the concept of prosumers. This paradigm calls for new businesses like energy communities. Energy management of such frameworks is essential to maximize the collective welfare. This paper addresses this issue by developing an energy management framework that accounts for flexible demand, storage devices and electric vehicles. Its two-level structure allows to address the energy exchanging among prosumers in the 1st stage, while the 2nd stage focuses on optimally schedule the different collective assets. A novel stochastic-interval model is proposed to handle with uncertainties from demand, renewable generation, vehicles’ behaviour and energy pricing. A case study is performed on a six-prosumer community. Results serve to validate the new tool and analyse the importance of smart devices. In addition, the new proposal allows to adopt different operating strategies. Actually, the total operating cost may increase by 90% if a pessimistic point of view is adopted while the importance of the vehicle-to-grid capability is marginal otherwise. Furthermore, the energy purchased could be reduced by 7% when adopting a community arrangement, supposing an improvement in the economy and environmental indicators of the network. Other relevant aspects are identified and discussed in depth.