Fire crews have battled blazes in two Perth homes sparked by lithium batteries.