Possibly there exist some MQTT lib or another protocol. But I assume the following situation and going to suggest a solution:
Assumptions:
- Rpi is at the core of the system.
- ESP is working like satellite, sensor etc.
- So ESP is reporting data to the Rpi
- They (Rpi and ESPs) all are in the same subnet.
Solution:
- On the Rpi side implement a simple UDP bcast listener and listen to some specific port on BROADCAST ip. (ex: 8889)
- On the ESP side implement a UDP Client to send data to BROADCAST ip and to specific port. (ex: 8889)
- Implement a message format and make ESP to send it and Rpi to parse it.
Example Message Format:
The message can be a string (ASCII encoded).
ABBBEEECCCDDDD.....DDD
A: Start Header
BBB: Sender ID
EEE: Receiver ID
CCC: Payload Byte Count
D..: Payload
OR
A|BBB|EEE|DDDDD..DDDDDD|F
A: Start Header
|: Seperator
BBB: Sender ID
EEE: Receiver ID
D..: DATA payload
F: End Header.
This config will allow you to use DHCP, not to record any IP address of the clients and it is cheap to implement (according to resources ram,cpu etc).
Note: I don't know how MQTT uses resources.