All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad (
) is His slave and Messenger.
In our view, you are not required to refrain from what you asked about. However, the jurists have mentioned in their books that it is disliked to do anything that may cause one to miss the congregational prayer, such as sleeping before the prayer and the like.
It is stated in Ibn Abidin’s Hanafi (
) commentary on Al-Durr Al-Mukhtar: “Sleeping before prayer is disliked only for the one who fears missing its time or missing the congregational prayer. As for the one who relies on someone to wake him up, then it is permissible for him to sleep.” [End of quote].
Similarly, if you know that this action would result in missing the congregational prayer in the mosque, then it may be better to avoid this action; otherwise, the basic rule is that it is permissible.
Allah knows best.