This paper presents Hetero-Genius, a middleware architecture that enables construction and mediation in Internet of Things (IoT) systems. IoT systems are deployed across physical spaces such as urban parks, residential areas, and highways. The services provided by such IoT deployments are constrained to specific devices and deployment contexts. While existing interoperability solutions enable the design time development and deployment of IoT systems, it is often essential to dynamically compose systems that consist of other small scale IoT systems. To achieve this, post-deployment composition is needed, i.e., runtime composition of diverse IoT devices and capabilities. Hetero-Genius supports system and service discoverability, as well as automatic composability. We demonstrate this using a real-world Internet of Vehicles (IoV) scenario. Our experimental evaluation shows that developers can save up to 47% of their time when using Hetero-Genius, as well as improve code correctness by 55% on average.