A roof has caved in after a fire believed to have been started by lithium batteries tore through a home south of Perth.