Modern Smart Environments (SmE) are equipped with a multitude of devices and sensors aimed at intelligent services. The variety of devices has raised a major problem of managing SmE. An increasingly adopted solution to the problem is the modeling of goals and intentions, and then using artificial i ntelligence to control the respective SmE accordingly. Generally, the solution advocates that the goals can be achieved by controlling the evolution of the states of the devices. In order to automatically reach a particular state, a sophisticated solution is required through which the respective commands, notifications and their correct sequence can be discovered and enforced on the real devices. In this paper, a comprehensive methodology is proposed by considering a) the composite nature of the state of an individual device; b) the possible variation of specific commands, notifications and their sequence based on the current states of the devices. The methodology works at two levels: design-time and runtime. At design-time, it constructs the extended data and control flow behavioral graphs of the devices by using the concepts of a model checking approach. Then, at runtime, it uses these graphs for finding the reliable evolution through which the desired goal can be fulfilled. The proposed methodology is implemented over the Domotic Effects framework and a home automation system, i.e. Domotic OSGi Gateway (Dog). The implementation and experimentation details indicate the effectiveness of the proposed approach.