Can I depreciate the cost of solar panels for my primary residence in which I also rent out 2 rooms.
You can - but only the rental portion of the panels. If you rent 2 rooms out of total 4 in your home, for example - you would appreciate half of the cost. Or you can divide the amount based on the square footage of your home and the rental rooms.