Exhibit 23.1

Consent of Independent Registered Public Accounting Firm

We consent to the incorporation by reference in the Registration Statement (Form S-8) pertaining to the Sunrun Inc. 2015 Equity Incentive Plan, Sunrun Inc. 2015 Employee Stock Purchase Plan, Sunrun Inc. 2014 Equity Incentive Plan, Sunrun Inc. 2013 Equity Incentive Plan, Sunrun Inc. 2008 Equity Incentive Plan, and Mainstream Energy Corporation 2009 Stock Plan of Sunrun Inc. of our report dated March 26, 2015, with respect to the consolidated financial statements of Sunrun Inc. included in its Registration Statement, as amended (Form S-1 No. 333-205217) and related Prospectus of Sunrun Inc. filed with the Securities and Exchange Commission.

/s/ Ernst & Young LLP

San Francisco, California

August 5, 2015