  We report on our ongoing project to determine the leading-order hadronic
vacuum polarisation contribution to the muon $g-2$, using ensembles with
$N_f=2+1$ flavours of O($a$) improved Wilson quarks generated by the CLS
effort, with pion masses down to the physical value. We employ O($a$) improved
versions of the local and conserved vector currents to compute the
contributions of the light, strange and charm quarks to $(g-2)_\mu$, using the
time-momentum representation. We perform a detailed investigation of the
systematic effects arising from constraining the long-distance regime of the
vector correlator. To this end we make use of auxiliary calculations in the
iso-vector channel using distillation and the L\"uscher formalism. Our results
are corrected for finite-volume effects by computing the timelike pion form
factor in finite and infinite volume. For certain parameter choices, the
corrections computed in this way can also be confronted with results determined
on different volumes. Currently, the overall precision of our results is
limited by the uncertainties in the lattice scale.
