I have several switches which are all mapped using UDP packets. Some ESPs act as pushbutton switches and others act as receivers controlling relays.
In circumstances where a relay and a switch need to be in the same location, I could (and have been) easily control the relay with a simple if... digitalWrite.... type statement in a traditional way (ignoring any UDP communication). However, to hold true to my mapping scheme, I would like to have the ESP send a UDP packet (as it would for any "remote" device), but rather than sending it to a second ESP-01, I want it to essentially send it to itself.
This would mean the pushbutton (send a packet) is blind to the fact that the relay (receive a packet) is on the same board, or across the WLAN. Everything gets treated the same way.
UDP is working fine for me. I understand how to send and receive packets. I just wonder if an ESP can send a packet to itself. It would look like it is sending a packet to its own IP address.
Is this within the ESP-01 ability? UDP protocol? And, will it be reliable?
Thanks for the input. I realize how impracticle this approach must seem.