Abstract:User requirements are the fundamental driving force of smart services in Internet of Things (IoT). Today, many IoT frameworks such as IFTTT allow end users to use simple trigger-action programing (TAP) rules for programing. But these rules describe device scheduling instructions instead of user service requirements. Some IoT systems propose goal oriented requirement approaches to support service goal decomposition. But it is difficult to ensure the consistency of different services and completeness of service deployment. In order to achieve correct “user programming” in IoT systems and ensure consistency and completeness of user requirements, this study proposes an environment modeling based automatic approach to generate TAP rules. Based on the service requirements provided by users, required system behaviors are automatically extracted according to the environment model. After checking their consistency and completeness, TAP rules are generated, which realizes automatic generation from user service requirements to device scheduling instructions. The environment ontology of IoT application scenarios is constructed to model the environment, and the description method of service requirements is also defined. Finally, the accuracy, efficiency, performance of the approach and the time cost for building the environment ontology are evaluated with a smart home scenario. The results show that the accuracy, efficiency, and performance of this approach exceed the available threshold, and the time cost in building the environment ontology can be ignored when the number of requirements reaches a certain number.