Mishkat al-Masabih 731
وَعَنْ فَاطِمَةَ بِنْتِ الْحُسَيْنِ عَنْ جَدَّتِهَا فَاطِمَةَ الْكُبْرَى رَضِيَ اللَّهُ عَنْهُمْ قَالَتْ: كَانَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذَا دَخَلَ الْمَسْجِدَ صَلَّى عَلَى مُحَمَّدٍ وَسَلَّمَ وَقَالَ: «رَبِّ اغْفِرْ لِي ذُنُوبِي وَافْتَحْ لِي أَبْوَابَ رَحْمَتِكَ» وَإِذَا خَرَجَ صَلَّى عَلَى مُحَمَّدٍ وَسَلَّمَ وَقَالَ رَبِّ اغْفِرْ لِي ذُنُوبِي وَافْتَحْ لِي أَبْوَابَ فَضْلِكَ . رَوَاهُ التِّرْمِذِيُّ وَأَحْمَدُ وَابْنُ مَاجَهْ وَفِي رِوَايَتِهِمَا قَالَتْ: إِذَا دَخَلَ الْمَسْجِدَ وَكَذَا إِذَا خَرَجَ قَالَ: «بِسْمِ اللَّهِ وَالسَّلَامُ عَلَى رَسُولِ اللَّهِ» بَدَلَ: صَلَّى عَلَى مُحَمَّدٍ وَسَلَّمَ. وَقَالَ التِّرْمِذِيُّ لَيْسَ إِسْنَادُهُ بِمُتَّصِلٍ وَفَاطِمَةُ بِنْتُ الْحُسَيْنِ لَمْ تدْرك فَاطِمَة الْكُبْرَى
And from Fatimah bint al-Husayn, from her grandmother Fatimah al-Kubra, may Allah be pleased with them, who said: When the Prophet ﷺ entered the mosque, he would send blessings and peace upon Muhammad and say: "My Lord, forgive me my sins and open for me the gates of Your mercy." And when he went out, he would send blessings and peace upon Muhammad and say: "My Lord, forgive me my sins and open for me the gates of Your bounty." Reported by at-Tirmidhi, Ahmad and Ibn Majah. In the narration of those two she said: When he entered the mosque, and likewise when he went out, he said: "In the name of Allah, and peace be upon the Messenger of Allah," instead of: he sent blessings and peace upon Muhammad. At-Tirmidhi said: Its chain is not connected; Fatimah bint al-Husayn did not meet Fatimah al-Kubra.