To resolve the problems of data transmission protocols inconsistency, system integration difficulty, long R&D cycles and high R&D costs during Internet of things (IoT) upgrade for products, a highly operational, scalable, and portable software and hardware bidirectional interactive IoT data transmission method is proposed and implemented. Based on the ESP8266 Wi-Fi chip, the MQTT protocol, as well as EasyStudio message middleware platform, a highly compatible, efficient, and stable electrical IoT application system is designed and developed. According to the data messages obtained by the electrical appliance of the IoT and the test results of the opening and closing of the control appliances, it shows that the proposed method can realize the real-time, accurate and comprehensive collection, forwarding and storage of electrical data, as well as two-way communication for real-time control of hardware controllers, the rapid upgrading of IoT, data visualization of electrical appliances. It is of great practical significance for enterprises to save energy and reduce emissions.