..
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.
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.
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. 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.
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.