Pervasive computing requires the ability to detect user activity in order to provide situation-specific services. Case-based reasoning can be used for activity recognition by using sensor data obtained from the environment. Pervasive computing systems can grow to be very large, containing many users, sensors, objects and situations, thus raising the issue of scalability. This paper presents a case-based reasoning approach to activity recognition in a smart home setting. An analysis is performed on scalability with respect to case storage, and an ontology-based approach is proposed for case base maintenance. We succeeded in reducing the casebase size by a factor of one thousand, while increasing the accuracy in recognising some activities.