Q. Can someone stay inside as say Kidush Levanah by seeing the moon through the window if it is too hot or too cold outside?

A. The Remah (O.H. 426: 4) rules that one should not recite Kidush Levono underneath a roof. Mishna Berura (ibid. 21) explains that the reason is because we are engaged in receiving the presence of the Shechina and it is customary to leave one’s home to welcome the presence of kings. Mishna Berura adds that if someone is ailing or not feeling well, the streets are not clean or is afraid for his safety in that neighborhood; he can recite this brocho inside while seeing the moon through the window.

Horav Shlomo Miller’s Shlit”a opinion is similar

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a