If you made the election for your house to be treated as your main home within two years of acquiring the second, then any variation of that election will only be effective from a maximum of two years before such a variation is made as you can read here
The rent a room scheme requires you to live in the home for which you are claiming rent a room relief as you can read here
. Given that you appear not to have been living in the house, you have probably claimed it incorrectly.
Take a look at HS283
for information on the main residence and CGT. As far as CGT on the flat is concerned, that probably has been your main residence and will almost certainly be treated as such if you did not make the main residence election within two years of acquiring it, notwithstanding the fact that you have claimed rent a room relief for the house.
If you did make the election within two years of acquiring the flat, then it gets complicated. You will qualify for exemption from CGT for the period you lived in it plus the last 18 months of ownership or the last 24 months of ownership if you vary the main residence election. As part of the property has been let, a proportion of the gain will not qualify for main residence relief if that occurred during the period you can claim that relief for. However, you should qualify for letting relief which will reduce any taxable gain.
I hope this helps but let me know if you have nay further questions.