## 4 Conclusions  
In this study, a ZigBee-based WSN system which consists of three layers was proposed, and it proved to be accurate and effective in assisting with microclimate management in a commercial gestating sow confinement building by monitoring four environmental parameters in real-time.  
The proposed WSN system underwent three-day consecutive observations in a 10 min interval, reported 16,371 records from its 41 indoor slave nodes, thus achieving an overall data packet loss rate of 4%. A series of preprocessing steps was applied to cope with the null records and interpolation before analyzing the distribution condition of abnormal observations among four types of sensors. The corresponding analysis results showed that all the sensors were working well except for the CO\({}_{2}\) which performed an average outlier rate of 6.5%. Apart from the above systematic performance, it is straightforward and useful to evaluate its practical contribution to monitoring the microclimate from both spatial and temporal perspectives. A daytime high temperature (above 24 \({}^{\circ}\)C) starting from 10:00 to 16:00 in this commercial gestating sow house was found, however, it is yet acceptable in the thermoneutral zone. However, the relative humidity showed inverse diurnal variation patterns compared with that of temperature variation both spatially and temporally. Although the CO\({}_{2}\) concentration inside this pig house was above 1500 mg/m\({}^{3}\) for the whole time, there merely existed two periods when the CO\({}_{2}\) levels exceeded the 2700 mg/m\({}^{3}\), namely: ranging from 07:00 to 08:00 and from 14:00 to 15:00. Additionally, the overall NH\({}_{3}\) concentration in the swine building was maintained in a relatively low-level range with a maximal value of less than 8 mg/m\({}^{3}\). In sum, by deploying the WSN system in this gestating sow house, real-time monitoring and timely intervention could be attained thus making it possible to provide effective suggestions about when and where the climatic adjustment and human labor should be adapted.  
Methane (CH\({}_{4}\)) and nitrous oxide (N\({}_{2}\)O) are greenhouse gases that need to be taken into consideration. Therefore, as a further study, our team will work on the implementation of new series of sensors that are especially devised to measure the emissions of both previously mentioned gases and thus include these extremely important parameters in our WSN monitoring system in the gestating sow house.  
All authors contributed to the conceptualization. [PERSON] and [PERSON] performed the formal analysis, original draft preparation, and visualization. [PERSON] reviewed and undertook relative editing. [PERSON] contributed to the visualization. [PERSON] contributed to the supervision. [PERSON] provided resources. All authors have read and agreed to the published version of the manuscript.  
This research was funded by National Key Research and Development Program (2018 YFD0701002), National Natural Science Foundation of China (31901736, 31971806), Guangdong Province's 2019 Provincial Agricultural Technology Innovation and Extension Project (2019 KJ101), Guangdong Province Key Field Research and Development Program Funding (2019B020225001) and Guangdong Provincial Animal Science Open Fund Project of the Key Laboratory of Poultry Disease Research (YDWS1904).  
**Institutional Review Board Statement:** Ethical review and approval were waived for this study, due to the research subject focusing only on the indoor environmental conditions.  
**Informed Consent Statement:** Not applicable.  
**Data Availability Statement:** The study did not report any data.  
**Acknowledgments:** The authors are grateful for the administrative support from the South China Agricultural University and the generous help from the working staff in the pig house.  
**Conflicts of Interest:** The authors declare no conflict of interest.