If family members are resting in their rooms, and you intend to enter that room, seek permission to enter, otherwise you may see them in a condition that you or they, for that matter may dislike. This applies to your entire houshold; your immediate family members (mahrams like your parents or children) and others (non-mahrams) as well.
Imam Malik [Rahimahullah] has recorded in his Muwatta that Sayyiduná ‘Ata Ibn Yasar [Rahimahullah] that a man asked Rasulullah [Sallallahu álayhi wa sallam] the following, “Should I seek permission to enter my mother’s room?” “Yes” answered Rasulullah [Sallallahu álayhi wa sallam]. “But we live together in the same house,” said the man. Rasulullah [Sallallahu álayhi wa sallam] said, “Seek permission to go to her.” “But I am her servant,” replied the man. Rasulullah [Sallallahu álayhi wa sallam] repeated, “Seek permission! Would you like to see her naked?” “No,” replied the man. “Then seek permission when entering,” said Rasulullah [Sallallahu álayhi wa sallam].
A man came to Sayyiduná ‘Abdullah Ibn Masud [Radiallahu anhu] and asked, “Should I seek permission to enter my mother’s room?” He answered,”There are certain conditions in which you would rather not see her.”
Sayyidatuná Zaynab, the wife of ‘Abdullah Ibn Masud [Radiallahu anhuma] said that upon reaching the door, ‘Abdullah [Radiallahu anhu] would cough (according to a narration in Ibn Majah, he used to make some noise), fearing that he might surprise us and encounter an embarrassing situation.
A man asked Sayyiduná Hudhaifah Ibn Al-Yamán [Radiallahu anhu], “Should I ask permission to enter my mother’s room?” Sayyiduná Hudhaifah [Radiallahu anhu] replied,”Yes, if you do not seek her permission, you may see what you dislike.”
Sayyiduná Musa [Radiallahu anhu], the son of Talhah Ibn ‘Ubaidillah [Radiallahu anhu] said,” My father went to my mother’s room. I followed him as he entered. He turned towards me and pushed my chest, causing me to sit on the ground. Then he reprimanded me saying, “How dare you enter without permission!”
Sayyiduná Nafi [Rahimahullah], the freed slave of Sayyiduná Ábdullah Ibn Umar [Radiallahu anhu] said, “When any of Ibn ‘Umar’s [Radiallahu anhu] children would come of age, Ibn ‘Umar [Radiallahu anhu] would assign him or her to another room. He would also not allow any of them to enter his room without permission.”
Sayyidduná ‘Atá Ibn Abí Rabáh [Rahimahullah] asked Sayyiduná Ibn ‘Abbas [Radiallahu anhuma], “Should I seek permission when entering the room of my two sisters?” “Yes,” replied Sayyiduná Ibn ‘Abbas [Radiallahu anhuma]. He said, “But they are in my foster care, I support and provide for them.” Ibn ‘Abbas [Radiallahu anhuma] asked, “Would you be pleased to see them naked?” He then read the Quránic verse:
“And when the children among you come of age, let them seek permission, as those senior to them in age do” (Surah an-Nur)
Sayyiduná Ibn ‘Abbas [Radiallahu anhuma] concluded, “Seeking permission is obligatory for all people.”
Sayyiduná Ibn Mas’úd [Radiallahu anhu] said, “A person shoudl seek permission when entering the room of his father, mother, brother and sister.”
Sayyiduná Jabir [Radiallahu anhu] also said, “A person should seek permission when entering the room of his children, brother, sister, father or mother, even if she is old.”
Most of this narrations have been recorded by Imam Bukhari [Rahimahullah] in his book, ‘Al- Adabul Mufrad’ while some of them have been quoted by Ibn Kathír [Rahimahullah] under the above mentioned verse.