just to toss in a note about grounding to the AC mains.
the AC mains here in the US is on a common electrical buss in the breaker panel.
there is a wire that exits the building and is connected to a rod that is driven into the ground. Earth Ground..
there is also a shield ground wire from the main feed from the utility company.
every ground wire for the premises and every neutral wire are landed on the buss.
therefore every ground at every receptacle is mechanically connected to every Neutral wire.
if you connect your project to the ground wire in your AC wiring, you have a path to the AC neutral.
if the AC neutral fails between the panel and the receptcle, then there is no completed circuit.
if, the ground fails for the entire panel, so there is no connection to any external ground, then any and every other path to ground becomes a viable path. if your project for basement water detecion shared the AC common, and there is water, a path might be made.
if you touch any plumbing and your device, and the water can carry to a ground, then a path is available.
We are not talking likely, but rather possible.
if, on the other hand, you never connect your project to the AC mains by any means other than the transformer secondary, then any loss of power means there is no path.
As a rule, there is no need to connect a project to an Earth Ground. The small phone-charger power supplies offer both power and isolation and keep us all out of trouble.
As a note, even those who can do this sort of thing, add AC to a board, chose not to because of all the requirements and risks and because a wall-wart is so common, cheap and easy.
A simple phone charger is often all that is needed and you can get double insulated power supplies with a regulatory label for a few dollars if you do not already have a box of them.