Toggle feature on/off on TV

There is a way to turn on/off the speaker in my Samsung TV buried deep within a few layers of a setup menu. When I want to listen to TV at night with headphones, I want to turn off the built-in speaker.

Presumably, one could access it by sending a series of commands via IP. But the TV always seems to “loose” or miss one or more of the commands so it’s terribly unreliable.

Is there a more reliable way to a specific feature like turning on/off the built-in speaker?

If the manufacturer doesn’t offer a specific command for that via IP or IR, which we believe is the case for Samsung TVs, you would need to bring the audio control out of the Samsung to resolve that via control. For instance, one way we hook that up is by using a small/cheap receiver that doesn’t even have speakers connected to it. For instance an Onkyo 616 is something we’ve used for this purpose. Hook the headphones up to the Onkyo. The Samsung is fed HDMI from the Onkyo. Whatever your input source is also gets connected to the Onkyo. When you want to switch to headphones, send HDMI AUDIO OFF. When you want TV Speakers, send HDMI AUDIO ON.

There are of course various other ways of configuring a solution for that, but we like the above because it lets the headphones get switched entirely via the control system rather than the common solution of needing to plug the headphones into the front of the receiver in order to activate them every time.