The security measures of IoT devices used in intelligent buildings are one of the ways by which energy efficiency can be accomplished. IoT devices are very important for data collecting and monitoring in intelligent buildings, but a lack of security could result in errors in energy consumption decisions that result in energy waste. To ensure the success of the control systems used for energy optimization, it is necessary to address the security of IoT devices in order to avoid illegal access, data manipulation, and disruptions. This work proposes a research idea and scheme for energy-saving optimization of intelligent buildings by assuring the security of IoT devices used in intelligent buildings. First of all, we defined several parameters that are related to IoT devices’ security, energy consumption, and occupant comfort in the intelligent building environment. Secondly, we collected data for each of these parameters by utilizing IoT devices such as actuators, sensors, and other control systems. The niche genetic algorithm (NGA) refers to a particular class of genetic algorithms that is used to tackle problems involving many optimization objectives. We focused on optimizing both energy consumption and occupants’ comfort; therefore, we used an NGA for the preprocessed data with the goal of evaluating the data for the purpose of ensuring the comfort of occupants and protection of the security of IoT devices, which eventually leads to energy optimization. Finally, the results of the proposed approach are analyzed and carefully compared with earlier work, demonstrating that our proposed approach is significantly more effective and energy-optimized than earlier approaches. The results show that the total power consumption of the intelligent building system after using our proposed model is generally reduced by more than 18% compared with that before optimization, which shows that the intelligent building system-adaptive optimization control model can effectively optimize the operating parameters of the energy-saving system and achieve the security of IoT devices.