Hey Darren,
a simple and effective approach! Could be a solution.
A more technical way could also be retrofitting a limit sensor to the Z axis: