drain water heat recovery is already a thing. It's code for new builds in British Columbia, Canada.
It's only expensive due to the amount of copper. The actual install has no moving parts and is completely passive.
https://www.nrcan.gc.ca/energy/products/categories/water-hea...