• An IoT-based framework for data collection and context modelling has been developed. • Extended Kalman Filter (EKF) approach is used to deal with inaccuracies, missing data and eliminate errors. • The EKF-derived indoor pollutant concentrations are employed in context reasoning for proposing a new index. • An adaptive neuro-fuzzy inference system (ANFIS) uses the percent of dissatisfied people (PPD), ventilation rate (VR), and AQI data to identify the present state of IAQ and the percentage of time when the air quality in the classroom is unhealthy. For a productive and healthy life, air quality plays an important role. This paper addresses the requirements to develop a system capable of providing real-time information, predictions, and alerts about the indoor environment using context-awareness. The proposed IoT system serves for data collection, pre-processing, defining rules, and forecasting the predicting states of the indoor environment by giving information to the end-user about the alerts and recommendations. A novel approach based on the indoor pollutants T, RH, CO 2 , PM 2.5 , PM 10 , and CO for the determination of the status of the environment is proposed. The pre-processing is used for filtering data using and extended Kalman filter. Further, the system uses an adaptive neuro-fuzzy inference system (ANFIS) and discrete-time Markov chains (DTMC) to predict the state of the indoor environment with the help of daily air pollution concentrations and environmental parameters. The ANFIS model predictor considers the value of indoor pollutants to form a new index: State of indoor air (SIA). For analysis and forecasting of the new index SIA, the DTMC model is used. The collected and measured data is stored in the IoT cloud using the sensing setup, and sensed information is used to develop the SIA transfer matrix, generating return durations corresponding to each SIA and providing alerts based on the data to the end-user. The models are assessed using the expected and actual return durations. The most frequent interior ventilation states, according to the predictions, are poor and moderate. Only 0.08 percent of the time does the IAQ remain in a good state. Two-thirds of the time (66%), the indoor ventilation is severe (poor, very poor, or hazardous); 19% of the time it is very bad, and 15% of the time it is hazardous, suggesting and warning that there is a very high probability of unhealthy AQI in educational institutions in the Delhi-NCR region. Performance is measured by the comparison between actual and forecasted return periods, and the forecast error for our system is low, with an absolute forecast error of 3.47% on an average.