Ah great. I will try to figure out if the code could work making a new post in a different section of the forum. Thanks for your help.
After having everything working properly I will post here the final circuit and the code.
Just a last thing, I’m not sure if I understand why do a I need to ground the relay to the Pi. Do you mean, ground it just in the case I change the configuration to supply energy to the IR Light System from a separate source? If I reproduce the circuit I show you in the real world everything will work proper, right? Or do I need ground the relay from Pi anyway?