Lev. 17:7 is a clear instruction that the Israelite were not to anymore offer sacrifices to the goat idols that they had learned to worship while in Egypt. The Egyptians worshiped hairy goat gods / idols. God was telling them that they were to only worship Him.
Excerpt from Ellicott's Commentary:
"And they shall no more offer their sacrifices unto devils.—The word (sēirim) here translated “devils,” literally denotes hairy or shaggy goats, and then goat-like deities, or demons. The Egyptians, and other nations of antiquity, worshipped goats as gods. Not only was there a celebrated temple in Thmuis, the capital of the Mendesian Nomos in Lower Egypt, dedicated to the goat-image Pan, whom they called Mendes, and worshipped as the oracle, and as the fertilising principle in nature, but they erected statues of him everywhere. Hence the Pan, Silenus, satyrs, fauns, and the woodland gods among the Greeks and Romans; and hence, too, the goat-like form of the devil, with a tail, horns, and cloven feet, which obtain in medieval Christianity, and which may still be seen in some European cities. The terror which the devil, appearing in this Pan-like form, created among those who were thought to have seen him, has given rise to our expression panic. This is the form of idolatrous worship which the Jews brought with them from Egypt, and to which reference is continually made...." Source: Biblehub
The word "demon" or "devil" in the OT meant an idol, a no-god. They were the abominable things made with their own hands of wood, and gold, etc. The word translated as goat-gods or idols in Lev. 17:7 is Strong's Heb. 8163, "say'iyr", or hairy. It is an adjective for a he-goat, or buck. Source: Biblehub.
“They sacrifice to demons — no god! Gods they have not known — New ones — from the vicinity they came; Not feared them have your fathers!” (Deu. 32:17, YLT)
In Deu. 32:17 the word "demons" is Strong's Heb. 7700, and it means an idol. (Source: Biblehub). God clearly defined a demon / devil as an idol, a no-god, nothing. Our Father in Heaven is the only GOD.
It is the first commandment at Ex. 20:3 that they were to have no other Gods. And, that meaning carries through to the New Testament where Paul told the Corinthians,
“18 See Israel according to the flesh! are not those eating the sacrifices in the fellowship of the altar? 19 what then do I say? that an idol is anything? or that a sacrifice offered to an idol is anything? – 20 [no,] but that the things that the nations sacrifice — they sacrifice to demons and not to God; and I do not wish you to come into the fellowship of the demons.” (1 Cor. 10:18-20, YLT)
Paul equated idols with demons, no-gods, nothing. You can read more on this topic at my blog ShreddingTheVeil.org, here, here, and here.