Smart cities represent a great advance in terms of sustainability, energy efficiency and being able to respond to the needs of enterprises, institutions and inhabitants. In this sense, smart grids contribute to the development of smart cities in the field of electrical energy, including concepts such as renewable energies, distributed generation, energy efficiency and smart homes and automation. In order to be able to implement all the functionalities of smart grids, it is necessary to have real-time information about the different installations. In this sense, IoT plays a fundamental role in developing smart grids. Cloud computing, which integrates the data obtained via smart electrical meters, smart electrical power analyzers and other intelligent metering devices, contributes to the availability of the measured data in real time and provides intelligence to existing electrical networks. Wireless communication networks, especially LPWANs, allow the construction of devices with low energy consumption and high operating autonomy, which can be installed in different locations, even those that are difficult to access. The massive implantation of the electric vehicle implies the construction of charging stations. These stations must use renewable energy sources that contribute to saving fossil fuels, reducing CO2 and increasing the sustainability of electric mobility.