A rooftop solar boom has aided the shift but also created midday power gluts, giving big batteries the chance to buy electricity cheaply and sell it back when prices rebound.