Ambient intelligent systems such as Home and Building Automation Systems (HBAS) are becoming evermore accepted and capable of actuating automatically on behalf of users to fulfil their requests or enable activities. However, when multiple users interact with such systems, the requirements of activities often interfere resulting in conflicting actuations which HBAS ought to automatically detect and resolve. Yet, despite recent advances in HBAS, no ambient intelligent solution has been reported that is adequately grounded on knowledge analysis. The contributions of this article are twofold. First, it reviews relevant literature on Ambient Intelligence, conflict detection, conflict resolution and knowledge representation in HBAS. Second, it proposes and validates an ontological framework for conflict detection and resolution backed by knowledge-based analysis. Effectively, the proposed solution performs automatic environment actuations maximizing users comfort and energy efficiency. (C) 2014 Elsevier Ltd. All rights reserved.