This paper introduces a Smart Energy Management System capable of controlling energy and smart home devices to optimize the power consumption of several buildings individually and smooth consumption peaks by means of a central system. The proposed model consists of two main systems; the Energy Storage Units and the Central Energy Management System. The first ones are able to store energy, communicate with X10 devices and transmit information regarding household consumption. Finally, the Central System is in charge of controlling the Energy Storage Units, analyzing the information provided through data mining techniques and deciding the best operation strategy for each unit, so that they can smooth their load curves. The strategy consists of a set of semantic rules, based on sequential patterns, which aim to avoid peaks by shutting down low-priority X10 devices and using properly the energy stored.