**4. Conclusions**

In this paper, an integrated IoT system for water quality monitoring is conceived and customized for its demonstration and preliminary validation in wastewater treatment use case. The proposed system leverages an innovative low-cost analytical device at the close-to-market stage. The device consists of a nitrate and nitrite analyzer based on a novel ion chromatography detection method and equipped with IoT communication capabilities to build a WSN. An IoT software platform is used to integrate the analytical device. By doing so, a decentralized SWQMS adaptable to the dynamic and heterogeneous WDSs of cities is achieved. This SWQMS is composed of a wireless sensor network and an open cloud-based middleware.

A thoroughgoing analysis of the different layers of the conceived system is applied to proper design of the customized system in the field of wastewater treatment. The implemented platform provides near-real-time communication with devices and incorporates preventive functions and data analytics that support decision-making. To achieve these features, five different processes for the management and administration of the system by different organizations are implemented: system initialization, capture and storage of information, information modeling, data analytics and visualization, and management of information.

The results obtained from a real conditions wireless sensor network deployment in Murcia, Spain, as part of the Ecosens Aquamonitrix project, show that the implemented system provides features for online and near-real-time monitoring and management of wastewater quality parameters. The system architecture is extensible to include other features. Moreover, the scalability of the IoT ecosystem enables to increase both the number of sensor nodes and the storage and processing resources of the IoT platform. Regarding the preliminary validation of the device, the developed method was used to determine the content of nitrite and nitrate in the effluent of a WWTP. The results achieved show that this method is reliable and fast working in a wide range for nitrates and nitrites determination as well as avoiding the use of many reagents, some of which can be hazardous.

The advances features of the developed IoT integrated system will enable massive sensor deployments in the water distribution systems of smart cities allowing end users to detect pollution events and adverse trends in near real-time. Thus, the private or public entities in charge of water quality monitoring and management will be able to act in a more efficient and effective way tackling the problems detected (i.e., pollution sources), reacting to the problems more quickly and minimizing the negative environmental impact.

**Author Contributions:** Conceptualization, R.M. and J.M.N.; Formal analysis, R.M., J.M.N., N.V., and A.e.A.; Investigation, R.M., N.V., A.e.A., E.M., P.R., and J.M.N.; Methodology, R.M., J.M.N., N.V., and A.e.A.; Resources, R.M., J.M.N., N.V., and A.e.A.; Software, R.M., J.M.N., N.V., and A.e.A.; Visualization, R.M.; Supervision, J.M.N.; Validation, R.M., N.V., A.e.A., E.M., P.R., and J.M.N.; Writing—original draft preparation, R.M., J.M.N., N.V., and A.e.A.; Writing—review & editing, R.M., N.V., A.e.A., E.M., P.R., and J.M.N. All authors have read and agreed to the published version of the manuscript.

**Funding:** This paper is the result of the research carried out under the project Enhanced Portable Sensor for Water Quality Monitoring, moving to genuinely integrated Water Resource Management—ECOSENS AQUAMONITRIX—LIFE is co-funded by the LIFE Programme of the European Union under contract number LIFE17 ENV/IE/000237.

**Acknowledgments:** This work has been partially supported by the Entity of Sanitation and Wastewater Treatment of the Region of Murcia (ESAMUR).

**Conflicts of Interest:** The authors declare no conflict of interest.
