Embedded networks are emerging in many application fields, such as the automotive or building and factory automation sector. Compared to other distributed systems, embedded networks offer a new challenge for developers: heterogeneity and resource constraints. The nodes contained in these networks can differ greatly w.r.t. their storage, processing and sensing/acting capabilities, ranging from very simple sensor devices with very limited resources over programmable logic controllers to very powerful nodes such as PCs. In order to achieve an efficient execution of applications running on such a network, a middleware is required that automatically adapts the embedded network to the requirements of the installed applications. In this paper, we will present a model driven development approach that allows the specification of application requirements, and a corresponding middleware solution that supports the automatic adaptation of the application execution based on these requirements and the characteristics of the underlying hardware.