Industry 4.0 is a term used to refer to the fourth industrial revolution, characterized by the introduction of new technologies, such as the Internet of Things, Big Data, and artificial intelligence (AI). As the number of connected devices in industrial settings grows, energy optimization of such sensors becomes increasingly essential. This paper proposes an energy optimization framework for sensor nodes in Industry 4.0. The framework is based on energy efficiency, energy conservation, and energy harvesting principles. It is designed to optimize the energy consumption of sensor nodes while maintaining their performance. The framework includes dynamic power management, scheduling, and harvesting techniques to reduce energy consumption while maintaining performance. In addition, the framework provides a comprehensive approach to energy optimization, including advanced analytics and AI to predict energy consumption and optimize energy use. The proposed model reached 96.93% sensitivity, 91.36% false discovery rate, 11.28% false omission rate, 90.12% prevalence threshold, and 91.24% threat score. The proposed framework is expected to improve the performance of sensor nodes in Industry 4.0, enabling increased efficiency and cost savings.