I would like to switch a light through LoRaWAN using TTN.
I have a node that would send a message to switch the light on or off.
And I have another node which is supposed to receive the message and perform the switching process, i.e. that switches the light on or off.
Feasible using TTN??
To do this with TTN you would need your own software to read the application-level message from the first node and generate one to the second. Alongside the gateways within range of each node of course.
The bigger issue would be latency - in TTN, the receiving node would have to poll for messages, and you’re really not supposed to do that very often.
How far apart are the nodes?
If they are close, traditional radio control solutions likely make more sense.
If they are a moderate distance away, they could use LoRa (but not LoRaWan) directly (without a gateway) and have the receiving node which hopefully has mains power (because of the light) keep the radio receiving continuously, eliminating the latency issue. But that is off-topic here as it is not about TTN at all.
If they are further away, you could potentially use a LoRaWan network supporting class C continuously listening nodes to avoid needing to poll and the resulting latency. TTN has not historically supported this; I was under the impression that V3 was going to support that, but can’t find any indications that such support is actually deployed, and the thread asking about it seems to be closed. There are other server software solutions which would support it on a private network, but no longer being TTN that would be off-topic here.
The amount of info provided by @cslorabox better specifies what I mean by “in theory”. My only use case that is similar to your scenario is a toy one I implemented in free time: I remotely switch on the beer fridge in the music room some hours before we go play (), but the local node also collects temperature data thus I send a downlink as soon as it is sending an uplink, and I do not need instant power on (10-20 minutes delay). No need for a commander LoRaWAN node, I use a web page.