Background Wastewater surveillance provides real-time, cost-effective monitoring of SARS-CoV-2 transmission. We developed the first city-level wastewater warning system in mainland China, located in Shenzhen. Our study aimed to reveal cryptic transmissions under the "dynamic COVID-zero" policy and characterize the dynamics of the infected population and variant prevalence, and then guide the allocation of medical resources during the transition to "opening up" in China. Methods In this population-based study, a total of 1,204 COVID-19 cases were enrolled to evaluate the contribution of Omicron variant-specific faecal shedding rates in wastewater. After that, wastewater samples from up to 334 sites distributed in communities and port areas in two districts of Shenzhen covering 1.74 million people were tested daily to evaluate the sensitivity and specificity of this approach and were validated against daily SARS-CoV-2 screening. After the public health policy was switched to "opening up" in December 7, 2022, we conducted wastewater surveillance at wastewater treatment plants and pump stations covering 3.55 million people to estimate infected populations using model prediction and detect the relative abundance of SARS-CoV-2 lineages using wastewater sequencing. Findings In total, 82.4% of SARS-CoV-2 Omicron cases tested positive for faecal viral RNA within the first four days after the diagnosis, which was far more than the proportion of the ancestral variant. A total of 27,759 wastewater samples were detected from July 26 to November 30 in 2022, showing a sensitivity of 73.8% and a specificity of 99.8%. We further found that wastewater surveillance played roles in providing early warnings and revealing cryptic transmissions in two communities. Based on the above results, we employed a prediction model to monitor the daily number of infected individuals in Shenzhen during the transition to "opening up" in China, with over 80% of the population infected in both Futian District and Nanshan District. Notably, the prediction of the daily number of hospital admission was consistent with the actual number. Further sequencing revealed that the Omicron subvariant BA.5.2.48 accounted for the most abundant SARS-CoV-2 RNA in wastewater, and BF.7.14 and BA.5.2.49 ranked second and third, respectively, which was consistent with the clinical sequencing. Interpretation This study provides a scalable solution for wastewater surveillance of SARS-CoV-2 to provide real-time monitoring of the new variants, infected populations and facilitate the precise prediction of hospital admission. This novel framework could be a One Health system for the surveillance of other infectious and emerging pathogens with faecal shedding and antibiotic resistance genes in the future. Funding Sanming Project of Medicine in Shenzhen, Shenzhen Key Medical Discipline Construction Fund.