For something non invasive that will do what was actually asked for... A temperature sensor attached to the hot pipe could start the timer once the temperature gets above a certain level. Not sure how you'd sense when the water is turned off as it will take a while for the temperature to fall again.