Earlier this week, during a disappointing Tesla earnings call, Elon Musk mentioned in passing that he’d be producing a stationary battery for powering the home in the next few months. It sounded like a throwaway side project from someone who’s never seen a side project he doesn’t like. But it’s a very smart move, and one that’s more central to Musk’s ambitions than it might seem.

To understand why, it helps to look not at Tesla, but at SolarCity, a company chaired by Musk and run by his cousin Lyndon Rive. SolarCity installs panels on people’s roofs, leases them for less than they’d be paying in energy bills, and sells surplus energy back to the local utility. It’s proven a tremendously successful model. Founded in 2006, the company now has 168,000 customers and controls 39 percent of the rapidly expanding residential solar market.

When you have a lot of solar, you need a lot of batteries

Fueled by financing systems like SolarCity’s, government subsidies, and a rapid drop in the price of photovoltaics, solar has been growing fast. But with that growth, some of solar’s downsides are coming to the fore. Obviously, the sun isn’t always shining when you need power, and sometimes the sun is shining when you don’t need power. The former is a problem for the user, who needs to draw on the grid when it’s cloudy or dark; the latter is a problem for the grid, which needs to find a place for that excess energy to go. When there’s a lot of solar in the system, it can get hard to keep the grid balanced.

That’s part of the reason that California, with one of the most aggressive renewable energy mandates in the country, recently declared the most aggressive energy storage mandate as well, with a goal of 1.3 gigawatts of storage by 2020. As other states adopt intermittent renewables like solar and wind, they’ll need to install energy storage too, providing a ready and waiting market for Tesla’s batteries.

Forecast storage market from GTM Research.

This has been part of the plan for the Gigafactory all along. At an event in New York last fall announcing plans for SolarCity to build a gigantic PV-panel factory, Musk and Rive mentioned that every SolarCity unit would come with battery storage within five to ten years, and that the systems would supply power at a lower cost than natural gas. Those batteries will come from the gigafactory, currently being built in Nevada. Once the factory comes online, the strong demand for energy storage will allow it to immediately ramp up production and achieve economies of scale. Tesla CTO JB Straubel (who has said that he "might love batteries more than cars") says that the market for stationary batteries "can scale faster than automotive" and that a full 30 percent of the gigafactory will be dedicated to them.

"I might love batteries more than cars."

Indeed, SolarCity has already begun installing Tesla batteries, mostly on commercial buildings like Walmart stores, which have to pay higher rates when they use lots of power during peak hours. Tesla’s batteries let them store up solar power when they don’t need it, then use it when rates are high, shaving 20-30 percent off their energy bills, according to Ravi Manghani, an analyst at GTM Research.

SolarCity is also running a pilot project with 500 homes in California, according to the company’s director of public affairs, Will Craven. The project uses Tesla’s 10-kilowatt-hour battery packs and can power homes for about two days in the event of an outage, Craven says.

The prospect of cheap solar panels combined with powerful batteries has been a source of significant anxiety in the utility sector. In 2013, the Edison Electric Institute, the trade group for investor-owned electric companies, issued a report warning that disruption was coming. "One can imagine a day when battery storage technology or micro turbines could allow customers to be electric grid independent," the report said, likening the speed of the coming transition to the one from landlines to cellphones 10 years ago. Suddenly regulated monopolies are finding themselves in competition with their own customers.

Utilities have been anxious about this for years

They haven’t had to deal with this on the residential side yet, primarily because people can sell excess power back to the utilities at fairly high rates — a practice called net metering. But that’s hurting utilities, too, and some have tried to lower the price at which they buy back power, which has been met by furious protests from people leasing panels. If utilities lower the buyback rate too much, however, and batteries get cheap enough, people may just unplug from the grid altogether — or more likely, install systems that let them rely on it only rarely — prompting what those in the industry call "the utility death spiral." It’s quite a bind: by fighting net metering, utilities would help make battery storage more economically viable, driving the transition to a distributed grid.

Manghani believes utilities aren’t doomed, but they may undergo a radical transformation, becoming something closer to service providers and minders of an increasingly distributed grid rather than the centralized power producers they are today. Such a system would require lots of batteries to help balance the load and supply extra power during peak times, which is why GTM estimates the market will grow from $48 million today to about $1 billion in 2018.

This is the position SolarCity is taking as well. Last April, Peter Rive, SolarCity’s CTO, wrote that the company had no interest in prompting mass defections from the grid. "When batteries are optimized across the grid, they can direct clean solar electricity where (and when) it is needed most, lowering costs for utilities and for all ratepayers," he wrote. Utilities are in the best position to direct that electricity, he said, inviting utility operators to contact him. Will Craven, Solar City’s director of public affairs, calls it "infrastructure as a service."

Utilities aren’t doomed, but they may undergo a radical transformation

It would be a tricky transition, but some utilities may be open to it. During an earnings call last year, Straubel, Tesla’s CTO, said they were working with utilities. "The long-term demand for stationary energy storage is extraordinary," he said. "We’ve done a huge amount of effort there and have talked to major utilities and energy service companies."

Another potential bright spot for utilities is Tesla itself. If electric vehicles take off, demand for power will go up, helping compensate for people whose homes are relying less on the grid.

"They’re part of the electricity network."

All this is very good news for Musk, who starts to look less like a carmaker and more like the architect of a vertically integrated energy company, with SolarCity making solar panels that send power to Tesla batteries, both in the home and on the road.

"They’re not just carmakers," Manghani says. "They’re part of the electricity network. At least folks in the energy industry are very well aware of Tesla as a battery maker."