My setup seems to be working well now. I made changes to the code following the example in this thread - Water usage sensor