A timer that counts up/down only when there is sound (ideally there could be some smarts as to what constitutes sound). This would help me with with my two younger kids who practice piano but are up and running around for what seems like half their slot.
Although it's more manual, you could set up a mic to record into Audacity, cut the sections with no sound, and the length of the clip should give you your answer.
Or if the piano supports midi, maybe record using some kind of DAW (e.g. FL Studio), that way you won't be fooled by someone making noise into the mic to keep the timer going.