Making Activities function properly regardless of a device's

My Sony TV demonstrates a challenge I’m facing for ALL my infrared devices. My question is specific to IR, but not specific to Sony (nor specific to televisions). My “watch TV” activity starts off telling the TV to use external (receiver-powered) speakers, not the TV’s onboard speakers. The Activity contains numerous “cursor up” and “cursor enter” etc… commands. The programmed cursor movements have variable results depending upon the initial state of the TV. For example, if the TV speakers are initially off, that changes how you’d move the Sony TV cursor to maintain (keep) the TV onboard speakers off (versus if the TV speakers were initially on). My wife and kids aren’t going to know the initial speaker state, nor should they care. How do you deal with this? Is there a way, for example, to tell Roomie “turn TV speakers to external” versus “cursor up”, “cursor right” then “cursor enter”?

It’s always best to avoid simulated multi-step IR sequences if possible. But that will be purely based upon whether the target device has a discrete way to instruct it to make the change you want. In the case of setting the mode of the TV to use external speakers, even Sony’s extended IR set for installers doesn’t seem to have that command though a few of the more obscure commands there would be something to experiment with on your model. Part of the best answer here may be based on why the TV is needing that constant reset in the first place. Clearly, Sony does not anticipate that being an issue users have required a command to perform.

Thank you.