This paper presents an adaptive platform that can simulate the centralized control of different smart city areas. For example, public lighting and intelligent management, public zones of buildings, energy distribution, etc. It can operate the hardware infrastructure and perform optimization both in energy consumption and economic control from a modular architecture which is fully adaptable to most cities. Machine-to-machine (M2M) permits connecting all the sensors of the city so that they provide the platform with a perfect perspective of the global city status. To carry out this optimization, the platform offers the developers a software that operates on the hardware infrastructure and merges various techniques of artificial intelligence (AI) and statistics, such as artificial neural networks (ANN), multi-agent systems (MAS) or a Service Oriented Approach (SOA), forming an Internet of Services (IoS). Different case studies were tested by using the presented platform, and further development is still underway with additional case studies.