Check all the wiring contacts. They get dirty or corrode—you can't often see the corrosion, but it stops power from getting to where it needs to go. Spray some WD-40 on them and/or clean them with a rag or paper towel. WD-40 doesn't stop electricity from flowing and gets inside the contacts.
If that doesn't work, check the wiring and contacts in the switch. If that is ok, the next thing to look at is the circuit board. Check to see if it is cracked or there are any burn marks on it—that would mean it probably needs to be replaced.
Hope the easiest things works. Happened to us a few years ago and after I cleaned everything, hot water returned.
By the way, small battery terminals also can corrode and batteries will last longer if you clean them and use them again. Or you can scratch the terminals with a pen knife to keep them going. For the house batteries, there are sprays to keep them from corroding.