The increasing demand for food has raised the profile of the agricultural sector. The Internet of Things (IoT) is an important technology that is capable of solving many problems in modern agriculture. In traditional IoT communication technology, the operation technology of a single platform through remote or decentralized management is reasonably mature. In such an environment, all devices need to return the results of their execution tasks to the core server, and the server dispatches further script tasks to be performed. However, there is a problem in the mechanisms used for communication management of the devices at the same time when a large amount of data needs to be transmitted. The machine-to-machine (M2M) service platform has been standardized to enable the communication of devices, which is the basis for smart environments with IoT. Recently, the OneM2M standard communication mechanism has provided a way for devices to send messages to core servers and assign specific tasks to other devices, and a two-way communication mechanism capable of returning and sending instructions has been realized. In this study, an innovative label computing model combined with the M2M communication mechanism was proposed, and labels were used to record events in a standard way. By notifying all devices of the result of the labeling through the M2M mechanism, the cost of data transmission among the devices of a network can be reduced. The proposed model can also automatically determine how to assign and execute IoT operation tasks through the labeling mechanism. Finally, the proposed model was implemented in a smart agriculture environment to increase agricultural production. The execution time on a simulated smart agricultural system was reduced by about 30% compared with that on an existing system.