Occupancy behaviour in buildings can impact the energy performance and operation of heating, ventilation and air-conditioning (HVAC) systems. HVAC, which uses conventional control strategies or “fixed” setpoint schedules, could not adjust to the conditioned spaces' actual requirements, resulting in building spaces being over or under-conditioned. While the unintended opening of windows can lead to substantial heat loss and consequently raises energy consumption. To optimise building operations, it is necessary to employ solutions such as demand-driven controls, which can monitor the utilisation of indoor spaces and provide the actual thermal comfort requirements of occupants. This study presents a novel vision-based deep learning framework for occupancy activity detection and recognition including the manual window operations in buildings. A region-based Convolutional Neural Network (R-CNN) model was trained and deployed to a camera for real-time detection and recognition. Based on the field experiments conducted within a case study University building, overall accuracy of 85.63% was achieved for occupancy activity detection and 92.20% for window operation detection. Building energy simulation and various scenario-based cases were used to assess the impact of such an approach on the building energy demand and provide insights into how the proposed detection method can enable HVAC systems to respond to dynamic changes within indoor spaces. Results showed that the proposed approach could reduce the over-or under-estimation of occupancy heat gains compared with the use of “fixed” or static profiles. In addition, the approach can help alert building users or managers about windows left open unintentionally, which can reduce unnecessary ventilation heat losses. Furthermore, the approach can also predict the room CO2 concentration and advise occupants about a suitable natural ventilation strategy. The study highlighted the potential of the multi-purpose detection approach, but further development is necessary, including optimisation of the deep learning model, full integration with HVAC controls and further model training and field testing.