In 2016 I converted my main home to rental property, then sold it in 2018 at a loss. Do I treat this as sale of my main home, sale of rental property, or both?

I purchased the home in 2010 and it was our main home until 2016, so it meets the 2-of-previous-5-years test.