Flexible and easily adjustable reasoning mechanisms are essential for rendering sensor and actuator rich indoor environments smart. Constraint-based solutions are a suitable approach for such systems. We propose an approach that allows users to specify the rules for a building's behavior, and uses context information to represent the rules and environment as a dynamic constraint satisfaction problem. The dependency graph data structure allows to find efficiently only the affected parts of the environment, thus minimizing the computational efforts after every event. We evaluate the system on a building implementation as a living lab, and with performance experiments. The testing proves the high efficiency and applicability of the approach for dynamic control of smart environments.