application of IoT is not limited to a specific field, and a considerable contribution of small-scale applications to large-scale applications such as e-commerce [16], coal mining [17], smart farming [18], laboratory monitoring [19], public service [20], crowd sensing [21], and many other areas have been shown, and, in general, this technology enables the monitoring and operation of devices by different methodologies in any part of the world using only an Android application. As the demand for electricity increases, smart homes have become a research area to remotely control home appliances using the IoT [22; 23; 24; 25]. Also, the significant benefits gained from wireless sensors and nanotechnology, among others, have fundamentally changed the way information technology and communication environments work. While IoT is still a growing and expanding platform, the current research in privacy and security shows that there needs to be more integration and unification of security and privacy, which may affect user adoption of the technology because of fear of personal data exposure [26]. The last two decades have experienced a steady rise in the production and deployment of sensing-and-connectivity-enabled electronic devices, replacing \"regular\" physical objects. The resulting IoT will soon become indispensable for many application domains [27]. The smart home is the proper integration of information technology and services using home networks in various home appliances for the convenience of the elderly and disabled people, and generally improving the quality of life [28; 29; 30]. Smart homes will allow users to perform actions such as adjusting the temperature of the house, turning lamps on and off, etc., without any physical connection [31]. Another critical issue noted in this article is the response to demand. Energy consumption has increased significantly, causing an increase in energy demand. Companies and industries spend thousands of dollars on energy and millions of dollars to find ways to conserve energy. Therefore, saving energy is one of the main goals of all technological innovations toward energy conservation. One of the ways through which technology helps in saving energy is the home automation system based on the IoT. Home energy management systems (HEMS) are optimal for providing energy management services to effectively manage energy production, storage, and consumption in smart homes. Therefore, users can optimize energy consumption by applying schedules based on their home appliances' demand-response programs. Figure 1 shows the general architecture of a HEMS. HEMS should be more flexible in planning, managing, and controlling smart home appliances to save energy. In addition, active control services can be delivered to smart home users, such as providing accurate information about electricity consumption and energy pricing in HEMS-based smart homes. Also, users can plan and manage the service time of each smart home piece of equipment. Figure 2 shows the regular operation of a smart HEMS center with four main functions. The communication platforms in smart homes can be divided into wireless and wired, which is fully described in Section 3. Wireless technology introduces various connections such as Bluetooth, IoT, Wi-Fi, GSM, etc., each of which has its advantages, disadvantages, applications, and specifications [32]. These connections offer home appliance control utilizing an Android app that helps overcome the disadvantages of conventional home control, although the personal computers that use them consume more energy and require more money. On the other hand, the benefit of using Android as a platform is that it is simple and easy to use. It can also use any media, such as Bluetooth, IoT, and Wi-Fi, to execute commands given by the user [33; 34]. The smart home system consists of three layers of sensors, operators, and controllers.