It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both), he said: When someone enters an uninhabited house, he should say: «السلام علينا» ...... Peace be upon us and upon the righteous servants of Allah.
Hadith Referenceالادب المفرد / كتاب الاستئذان / 1055
It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them), he said: «لَاتَدْخُلُوابُيُوتًاغَيْرَبُيُوتِكُمْحَتَّىتَسْتَأْنِسُواوَتُسَلِّمُواعَلَىأَهْلِهَا»[سورہ النور: 27] "Do not enter anyone's house except your own until you have sought permission and greeted the inhabitants with peace." This ruling is excepted by the verse which is in the following ayah: «لَيْسَعَلَيْكُمْجُنَاحٌأَنْتَدْخُلُوابُيُوتًاغَيْرَمَسْكُونَةٍفِيهَامَتَاعٌلَكُمْوَاللَّهُيَعْلَمُمَاتُبْدُونَوَمَاتَكْتُمُونَ»[سورہ النور: 29] "There is no sin upon you if you enter houses in which no one lives and in which you have belongings. Allah knows what you reveal and what you conceal."
Hadith Referenceالادب المفرد / كتاب الاستئذان / 1056
Hadith Gradingالألبانی:صحيح
Hadith Takhrij«صحيح : أخرجه الطبراني فى تفسيره : 147/19»