In pervasive computing environments, wireless sensor networks (WSNs) play an important role, collecting reliable and accurate context information so that applications are able to provide services to users on demand. In such environments, sensors should be self-adaptive by taking correct decisions based on sensed data in real-time. However, sensor data is often faulty. Faults are not so exceptional and in most deployments tend to occur frequently. Therefore, the capability of self-healing is important to ensure higher levels of reliability and availability. We design a framework which provides self-healing capabilities, enabling a flexible choice of components for detection, classification, and correction of faults at runtime. Within our framework, a variety of fault detection and classification algorithms can be applied, depending on the characteristics of the sensor data types as well as the topology of the sensor networks. A set of mechanisms for each and every step of the self-healing framework, covering detection, classification, and correction of faults are proposed. To validate the applicability, we illustrate a case study where our solution is implemented as an adaptation engine and integrated seamlessly into the ClouT system. The engine processes data coming from physical sensors deployed in Santander, Spain, providing corrected sensor data to other smart city applications developed in the ClouT project.