Open source code for public infrastructure is extremely important, I agree. But it's not sufficient. If data about individual people is collected by a smart city at all, or even capable of being collected by the hardware the smart city deploys, no matter what the laws are around it or how much you trust the current government, it could be exploited by a future, less ethical government, or stolen by third parties.
I think the examples you gave would be good ways to gather data for smart city management without collecting data about individual people that could be misused, but the way surveillance is implemented now, that sort of data collection is dangerous.
For example, a sensor that triggers a traffic light is great, but currently just about every major intersection in every major city in the US already has license plate cameras for traffic enforcement. So any smart city program is going to incorporate those license plate cameras, because why would they spend money installing new sensors when they already have perfectly good cameras? And then those cameras will be used for police and immigration enforcement and other privacy violating data collection even more efficiently than they're already being used.