It depends: Here are the criteria for claiming solar panels:
You are able to apply for the credit in the year you made the improvement - regardless of when paid. The IRS defines "placed in service" as when the property is ready and available for use. It's not when you purchased the product, but the day installation is complete, and you are able to use your new product.
They must be installed in a home you own and use as a residence (no rentals, but second homes qualify) between January 1, 2009 and December 31, 2021. Photovoltaic systems must provide electricity for the residence, and must meet applicable fire and electrical code requirements.
Here is where to enter energy-saving improvements in TurboTax:
For more info: https://energystar.zendesk.com/hc/en-us/articles/216375477