The competitive cost of batteries is making clean energy a viable alternative to coal in parts of the country.