Energy structure and electron coupling with local lattice vibrations have been investigated for deep centres in AlN using hybrid functional density functional theory. Local phonon energies and Huang-Rhys parameters have been calculated for defects and defect complexes containing most common unintentional impurities of carbon, oxygen and silicon, and for intrinsic vacancies, nitrogen split-interstitial defect, and complexes of Al and N vacancies in AlN. Luminescence line shapes of band to deep centre transitions in AlN have been calculated in dependence on temperature for most abundant defects in AlN. Donor-acceptor luminescence line shapes for shallow donor to deep acceptor and deep donor to deep acceptor transitions have been considered theoretically. Configuration diagrams of oxygen and silicon DX centres have been calculated by density functional theory with hybrid functional, and peak energies of optical transitions of an electron from the DX-centres to deep acceptors have been estimated. Possible assignments of the experimental luminescence bands in AlN based on the calculations have been discussed.