We present optical and near-infrared (NIR) photometry and spectroscopy as well as modelling of the lightcurves of the Type IIb supernova (SN) 2011dh. Our extensive dataset, for which we present the observations obtained after day 100, spans two years, and complemented with Spitzer mid-infrared (MIR) data, we use it to build an optical-to-MIR bolometric lightcurve between days 3 and 732. To model the bolometric lightcurve before day 400 we use a grid of hydrodynamical SN models, which allows us to determine the errors in the derived quantities, and a bolometric correction determined with steady-state non-local thermodynamic equilibrium (NLTE) modelling. Using this method we find a helium core mass of 3.1(-0.)(0.7) M-circle dot for SN 2011dh, consistent within error bars with previous results obtained using the bolometric lightcurve before day 80. We compute bolometric and broad-band lightcurves between days 100 and 500 from spectral steady-state NLTE models, presented and discussed in a companion paper. The preferred 12 M-circle dot (initial mass) model, previously found to agree well with the observed spectra, shows a good overall agreement with the observed lightcurves, although some discrepancies exist. Time-dependent NLTE modelling shows that after day similar to 600 a steady-state assumption is no longer valid. The radioactive energy deposition in this phase is likely dominated by the positrons emitted in the decay of Co-56, but seems insufficient to reproduce the lightcurves, and what energy source is dominating the emitted flux is unclear. We find an excess in the K and the MIR bands developing between days 100 and 250, during which an increase in the optical decline rate is also observed. A local origin of the excess is suggested by the depth of the He I 20 581 angstrom absorption. Steady-state NLTE models with a modest dust opacity in the core (tau = 0.44), turned on during this period, reproduce the observed behaviour, but an additional excess in the Spitzer 4.5 mu m band remains. Carbon-monoxide (CO) first-overtone band emission is detected at day 206, and possibly at day 89, and assuming the additional excess to be dominated by CO fundamental band emission, we find fundamental to first-overtone band ratios considerably higher than observed in SN 1987A. The profiles of the [OI] 6300 angstrom and Mg I] 4571 angstrom lines show a remarkable similarit, suggesting that these lines originate from a common nuclear burning zone (O/Ne/Mg), and using small scale fluctuations in the line profiles we estimate a filling factor of less than or similar to 0.07 for the emitting material. This paper concludes our extensive observational and modelling work on SN 2011dh. The results from hydrodynamical modelling, steady-state NLTE modelling, and stellar evolutionary progenitor analysis are all consistent, and suggest an initial mass of similar to 12 M-circle dot for the progenitor.