How to use RAW data from IR detector

Perhaps instead of printing out the decoded and raw data you could change the program to compare the decoded data to the data you got for the button you want to act on. Then if the data matches, toggle the relay. Perhaps if you posted your sketch we could make more specific suggestions.