This project aims to automatically control lights, cooling systems, exhaust fans, and doors in a room based on occupancy detection and environmental conditions. An ESP32 microcontroller is used to control the system based on inputs from ultrasonic entry/exit sensors, an MQ135 gas sensor to detect CO2 levels, a DHT sensor to measure temperature, and relay circuits to power devices. The system counts the number of people entering and leaving to determine occupancy and automatically turns lights and fans on or off accordingly. It also monitors CO2 and temperature to control exhaust fans and cooling to maintain comfortable conditions while minimizing energy usage.