Is excess solar generation used to charge the battery?

Hi, I cannot see in the code whether any excess solar power generated is used to charge the battery? Or whether it is sold back to the grid? Is it wasted?
Thanks :slight_smile: