..
My idea is to have a temperature sensor mounted on the main hot water pipe before it splits off to the various taps, with temperatures recorded at regular intervals, including timestamp. This will show when hot water was used - and for how long.
...
4. Suggestions.....
I assume your "main hot water pipe" is where hot water exits the water-heater or very near it. I will call it "main pipe" as abbreviation.
Depending on how your plumbing is routed, "main pipe" may not be the best spot. You have more factors to consider -- (1) hot water still in the system when water tap is turned off and (2) where the hot water is going.
Taking your second point first... There are only 3 locations in the household that have hot water: the bathroom, laundry and kitchen (there is only 1 of each). The bathroom is the main area and while it does have 3 taps (shower, bath and basin) they are considered collectively in regards to hot water usage. The "laundry" is an alcove setup and we can pretty much ignore hot water usage there as it is almost never used (cold water machine washing only) and the kitchen will never use hot water while someone is in the shower - or there will be blood.
Easy way to clarify is to lay down a scenario: Let just say, you are taking a shower military-style (at or under 2 minutes). 5 minute after your shower, someone turn the hot water in the kitchen for 1 minute to rinse a cup. Now the "main pipe" is re-filled with freshly heated water again before it was cooled measurably after your shower. Say another 10 minutes later, someone washes his/her hands in the second bath-room, now the main pipe is re-filled with hot water again. So on, each time the hot water is used briefly, the "main-pipe" refills with hot water and it may not cool for a very long while.
On your first point, the "main pipe" attached to the heater (which is outside*) is not insulated**, so ambient air temperature will be a factor in cooling rate (so will rain for that matter). This assists in the more reliable detection of water flow stopping - since all that is really necessary is to see the temperature start to drop by a characteristic amount, determined experimentally.
* Water heaters placed outside is very common here in Sydney for houses. See Dave's video on his heat pump hot water service for a typical placement:
** While not ideal, this is not uncommon to see. Snow is not a thing here in Sydney and we don't see freezing temperatures except for the odd occasion first thing in a winter morning, so your average Joe won't even notice.
The best position would be at the shower-head, there temperature alone will work. Otherwise, you have to know the cooling time of still-water in the pipe, and consider any "branching" to another outlet.
Shower is the main focus, but bath cannot be excluded as it does get used. Fitting a sensor to the shower head is just not practical and will certainly have an "accident" in very short order. Same for the bath. A single, common point does have its shortcomings, but it still has sufficient merit for the required purpose, not to mention ease of implementation. Trying to access the pipework directly for each tap or even room would require crawling under the house which is undesirable (to say the least) as 1. The only access point is almost at the opposite side of the house; 2. The clearance between the floor and ground at that end of the house does not allow kneeling - and while I have no idea what it is like directly under the bathroom, it can only be worse and 3. The ground has significant bits of building debris which you would have to crawl over.
Note also, if the shower room is high such as in the 2nd floor while the water heater is in the basement, there are a lot of pipes holding the not-running but still hot water. The hot water will rise to the highest point it can even if the hot water is not running.
Not really an issue. Single storey house where the difference in height of all hot water piping would be around 6' (1.8m). (I don't count the height from breech to shower head.)
Edited to add this: For cooling time, you also have to consider ambient temperature around the pipe. I am sure it will change a lot on a hot day verses the cool evening after sun down.
This is something I have already considered. A single sensor is the simplest, quickest and cheapest to implement - and it may be all that is needed to achieve the fundamental objective - but for something more accurate, I have considered one system with 3 sensors and another with 4.
The 3 system version would monitor (1) the ambient air temperature as well as (2) the water temperature as close to the exit point of the tank as possible and (3) the water temperature further down the "main pipe". The sensors at (2) and (3) would show the temperature drop along the exposed pipe (yes, they would need to have the necessary precision) and this could be calibrated against ambient (1) to derive a flow
indication. For a further refinement, a fourth sensor could be set up in some way to give a wind chill factor.
At this stage, I have pulled the trigger on a single Inkbird TH2 just as a proof of concept. Anything more elaborate with multiple sensors using something off-the-shelf will hit the hundreds of dollars - and I can't see it being able to process the figures to be useful to an end user, so a custom Raspberry Pi setup or somesuch is a more likely path.