During the operation of HVAC (Heating, Ventilation, and Air-Conditioning) systems, precise energy consumption prediction plays an important role in achieving energy savings and optimizing system performance. However, the HVAC system is a complex and dynamic system characterized by a large number of variables that exhibit significant changes over time. Therefore, it is inadequate to rely on a fixed offline model to adapt to the dynamic changes in the system that consume tremendous computation time. To solve this problem, a deep neural network (DNN) model based on Just-in-Time learning with hyperparameter R (RJITL) is proposed in this paper to predict HVAC energy consumption. Firstly, relevant samples are selected using Euclidean distance weighted by Spearman coefficients. Subsequently, local models are constructed using deep neural networks supplemented with optimization techniques to enable real-time rolling energy consumption prediction. Then, the ensemble JITL model mitigates the influence of local features, and improves prediction accuracy. Finally, the local models can be adaptively updated to reduce the training time of the overall model by defining the update rule (hyperparameter R) for the JITL model. Experimental results on energy consumption prediction for the HVAC system show that the proposed DNN-RJITL method achieves an average improvement of 5.17% in accuracy and 41.72% in speed compared to traditional methods.