Partial exclusion of capital gains on sale of home?

I bought my first home in 1990. 

On Aug 3 2018 I bought a 2nd home with intention of making it my primary residence. 

From August 2018 to December 2018 I spent significant time at both homes.  There were a few repairs to be done at the 2nd home and I moved slowly, finally vacating the first home completely in December 2018.

From July 2019 to July 2021 I leased the first home to my brother and his family at significantly less than market rent. 

I finally sold the first home in December 2021.

 

I am assuming that I do not meet the capital gains exclusion criteria of my first home being my primary residence for 2 out of the 5 years prior to sale because of the in-between-houses state from August to December 2018.

 

What I do not understand after reading publication 523 is whether the rental period (to immediate family at below market rent) affects my capital gains taxation and if so, how.