Help changing this IR sketch to RF

      val = digitalRead(RELAY1);

Why do you need to read this? You don't seem to have any problem remembering the pin number. Remember the state, too. (Though in a variable, not a #define).

Put each { on a new line. Use Tools + Auto Format to properly indent your code. You have this:

  if (mySwitch.available())
  {
     unsigned long value = mySwitch.getReceivedValue();
     if (value == 5592323UL) 
    {
      mySwitch.resetAvailable();
    }
  }

Please explain why you reset only if you get that specific value.

If you KEPT your code properly indented, you'd see that you were doing stupid stuff like that.

Without studying the code more, which I shouldn't have too, since you should be able to remember what you set the pin too (since you seem to be able to remember what you read from the pin last time), there are probably other stupid things you are doing, storing stuff inappropriately.