During primaries, delegates to the party nominating conventions are required to vote a certain way in the first round, but that is by party rule. The punishment is to be expelled from the convention and replaced by an alternate. Note that primaries are not Constitutional processes.
One could argue that "vote" is another of those terms in the Constitution that is not defined because everyone knows what voting is. Electors voting is in the Constitution, so via Article VI it is supreme Law of the Land. There is no federal or state law that can control a Constitutional power to vote. The vote-holder, in this case the Elector, has supreme power over how to vote.
As I posted earlier, the way for states to control influence an Elector's vote is to use their supreme power to choose the method of selecting Electors in such a way that produces Electors that are very highly likely to vote a desired way. That's what they do now with winner-take-all competing slates of party Electors, but the Electors still retain the power to become faithless.
-PJ
https://www.consource.org/document/james-madisons-notes-of-the-constitutional-convention-1787-7-25/
(Just reposting this for context.)
The Founders IMO gave great power over the Electors to the States.
Note
A. The document would have to meet with the States’ approval so the States were given as much power as could be done.
B. Those at the Convention could not decide on specifics of appointing Electors anyway.
The Constitution does NOT specify ‘freedom of conscience’ for the Electors. It says nothing. Though that power may be reasonably assumed, I admit, I’d like more details.
Shame there’s no record of the deliberations of the Committee of Detail