The practice of sacrificing an animal for the people who have built a new home to ward off jinn and to lay off their problems and anything that may harm them, has no basis and is incorrect. It is no doubt that a Muslim should avoid thinking that a sacrifice will keep away evil, or lack of sacrifice is the cause of evil and anything wrong is linked to it. Giving a sacrifice is liked, if the intention behind it is to give thanks to Allah SWA. It is said that it is obligatory, but the more correct opinion is that it is not, especially when one cannot. Whatever happens to a Muslim is due to the will of Allah SWA.
If the sacrifice is done out of fear of jinn, and to prevent them from harming, as many people do, then this is a clear superstition and is baseless.
Sheikh Dr Yusuf Al Qaradawi says:
People’s perception of the unseen, that is, the jinn, differs. There are some who are extreme in trying to prove that they exist, and some who are extreme in trying to prove they do not exist. There are people who do not believe in the jinn and do not believe in the unseen because they only believe in what they can sense, and this is extreme. To oppose them, there are people who prove that jinn exist and attribute every small and big thing to them, for the jinn are on their heads, and on the doorsteps of their houses, jinn in the night, jinn in the day, and jinn everywhere, until it becomes as if the jinn run the universe. This is also extreme and not in accordance with Islam.
Islam is a religion of balance, acknowledging the existence of the jinn, and confirming that their realm. The incessant stories about the presence of jinn and the access to their realm, are passed on from one generation to the next, and are still passed on even today. Majority of the people who claim spiritualism, it turns out that it is jinn they are invoking and not spirits, as the people of knowledge have mentioned.
The jinn are present, there is no doubt about that. As for the belief that they have any power to influence the world or take over a house and to make life difficult for the one who builds a house without offering sacrifice, then no revelation has been sent about it, and no religion has stated it. This is a matter of the unseen, and so we cannot pass judgement or rulings on them, or know about them except through what the Prophet ﷺ has told us. If it has no basis, or does not originate from him ﷺ then there is no doubt that we should not believe it nor give it any importance in religion.
It has come in the Kuwaiti Encyclopedia of Islamic Jurisprudence (Mausua Fiqhiya Kuwaitiya):
The feast done for the building of a new home is recommended, like any other feasts done for a joyful moment, or escaping danger. The celebration held for house-warming party is called (wakeerah). This injunction here was not stressed the way the wedding feast is emphasized in Islam. Though some scholars from Shafi’i school held an opinion that says it is obligatory action. This group of scholars inferred the ruling from Al-Shafi’i statement where he said: .. after mentioning the feasts which includes house-warming, I would not like it if any of them is omitted. However some of the Maliki scholars have said the feast is disliked, and for some others it is allowed.