I believe this can be solved with a Switch case where incoming ir message is compared to predefined messages to trigger actions on relays.
Using the IRrecvDumpV2 example from IRremoteESP8266 by crankyoldgit gives me codes both in raw and hex format.
What I have been struggling with the most so far is that the remote seems to sends variable messages from the same button (both content and size), so it is hard to predefine messages to compare incoming messages with. It might be the time the button is pressed that defines the message and/or there might be some built-in encoding of the message.
Have any of you done something similar and found a way to solve this?