This paper presents PlanIoT, a middleware approach for enabling adaptive data flow management in IoT-enhanced spaces (e.g., buildings) using automated planning methodologies. Today’s sensorized spaces deploy applications falling to diverse categories such as analytics, real-time, transactional, video streaming and emergency response. Depending on the category, applications have different QoS requirements related to timely delivery, networking resources, accuracy, etc. Typically, state-of-the-art data exchange systems introduce policies for bandwidth allocation or prioritization for specific data types and applications (e.g., camera data). PlanIoT introduces a generic QoS model to evaluate the performance of data flowing in Edge infrastructures and generates their performance metrics dataset. Such a dataset is used as input to automated planning representations to intelligently satisfy QoS requirements of deployed applications. The experimental results show that PlanIoT improves the end-to-end response time of time-sensitive flows by more than 50%, especially with an overloaded Edge infrastructure. We also show the adaptivity of our approach by considering emergency cases that require Edge infrastructure reconfiguration.