Smart homes are pervasive environments to enhance the comfort, the security, the safety and the energy consumption of the residence. An ambient intelligence system uses information of devices to represent the context of the home and its residents. Based on a context database, this system infer the daily life activities of the resident. Hence, abnormal behavior or chronic disease can be detected by the system. Due to the complexity of these systems, a large variety of anomalies may occur and disrupt the functioning of critical and essential applications. To detect anomalies and take appropriate measures, an anomaly management system has to be integrated in the overall architecture. In this paper, we propose an anomaly management framework for smart homes. This framework eases the work of designers in the conception of anomaly detection modules and processes to respond to an anomaly appropriately. Our framework can be used in all heterogeneous environments such as smart home because it uses Semantic Web ontologies to represent anomaly information. Our framework can be useful to detect hardware, software, network, operator and context faults. To test the efficiency of our anomaly management framework, we integrate it in the universAAL middleware. Based on a reasoner, our framework can easily infer some context anomalies and take appropriate measures to restore the system in a full functioning state. (C) 2016 The Authors. Published by Elsevier B.V.