Basically it's like I have that many esp8266, each connected to one of those switches. These esp8266 will be communicating to each other in a mesh and all dumping data to a Raspberry pi module which logs data from each of these esp8266.
When a particular switch is turned on then the ESP8266 connected to that switch will start sending every 2 minutes a message which would be the Identifier of the ESP8266. Raspberry Pi once it receives the message will store this data in an csv file with the identifier of the esp8266 and current timestamp
Please let me know if anyone could help me out with a sample code or how to go about this