I do not understand how a switch can substitute an IR-receiver still receiving the ir-signal. Is the switch is now used for controlling speed? How the purpose will be accomplished then?
Even if the problem still persists, you can try the following :
1) re-compile your code, re-programme it in a new chip;
2) re-solder all joints - loose connection may cause false signaling;
3) triacs generates nois as it switches the ac/dc power line, try a better nois filter - just mimic it from a commercially available electronic fan regulator,
OR,
purchase a good quality electronic fan regulator then, --
a)disconnect its' triac's gate from its circuit
b)now reconnect the gate to MOC3022 of your circuit
Don't forgate to post your success news