What you need to do is to create a state variable:
<FEATURE>
<NAME>InternalState</NAME>
<STATEVARIABLE>
<NAME>AnalogMode</NAME>
<VALUE>Analog</VALUE>
<VALUE>Digital</VALUE>
<NEXTVALUE>
<IRPRESSACTION>IRAnalogToggle</IRPRESSACTION>
</NEXTVALUE>
</STATEVARIABLE>
</FEATURE>
And then within the activity you can say:
<SETUPACTIONS>
<SETUP>
<DEVICENAME>xxxxx</DEVICENAME>
<OPERATION>SetAnalogMode Digital</OPERATION>
</SETUP>
</SETUPACTIONS>
or
<SETUPACTIONS>
<SETUP>
<DEVICENAME>xxxxx</DEVICENAME>
<OPERATION>SetAnalogMode Analog</OPERATION>
</SETUP>
</SETUPACTIONS>
where xxxxx is a device id. Harmony will automatically remember the state and only send the command when necessary.