Wireless Sensor Networks (WSNs) are playing more and more a key role in several application scenarios such as healthcare, agriculture, environment monitoring, and smart metering. Furthermore, WSNs are characterized by high heterogeneity because there are many different proprietary and non-proprietary solutions. This wide range of technologies has delayed new deployments and integration with existing sensor networks. The current trend, however, is to move away from proprietary and closed standards, to embrace IP-based sensor networks using the emerging standard 6LoWPAN/IPv6. This allows native connectivity between WSN and Internet, enabling smart objects to participate to the Internet of Things (IoT). Building an all-IP infrastructure from scratch, however, would be difficult because many different sensors and actuators technologies (both wired and wireless) have already been deployed over the years. After a review of the state of the art, this paper sketches a framework able to harmonize legacy and new installations, allowing migrating to an all-IP environment at a later stage. The Building Automation use case has been chosen to discuss potential benefits of the proposed framework.