Ab Initio Description of Optoelectronic Properties at Defective Interfaces in Solar Cells