ESP8266 to Arduino firmware

Deva_Rishi:
have a look at Serial Input basics there are several good methods available. Actually usually they use the Arduino to command the ESP-firmware. definitely a way, but not The wayYou are on the right track !
few things :

String IncommingString = "";

boolean StringReady = false;
   while (ESPserial.available()){
     IncommingString = ESPserial.readString();
     StringReady = true;      
   }



First of all, if you use 'Strings' on an Arduino people on the forum will likely blame any mishaps in your programs execution on it, so i would advice to switch over to using char * as a habit. 
Second, in this snippet you are likely not to read a complete input (definitely since you are using a low BAUD-rate) anyway have a look at Robin2's examples and consider once you've gone beyond the debugging stage o use the nano's hwSerial instead for faster communication.
About the ESP-sketch:


randomSeed(micros());



although you are not using the random at all, an easier way to get a proper randomSeed


randomSeed(analogRead(A0));



that it is not connected to a physical pin doesn't mean it is not there, and it is remarkable how consistent connection times can be.


while (Serial.available()) {
   sendToClient();
 }



the same issue with the Serial comm. here, you are sending incomplete messages.


char attributes[100];
 boolean published = false;
 payload.toCharArray( attributes, 100 );



and if you are going to convert from String to char *, check the length of the String, add 1 for the '\0' terminator, and declare that as size for the array and as size for the copy. With the ESP it usually is fine to use Strings due to it's much bigger memory size (and different/better String memory managing) and i would actually even recommend it's use over char * at times since there has been a report on strtok() not functioning properly on an ESP.

Awesome, have been amending a couple things the last few days, especially string lol, they came back to bite.

On my journey of try to also find an OTA for the ESP, I stumbled across this [GitHub - jeelabs/esp-link: esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer]esp-link](GitHub - jeelabs/esp-link: esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer) Pretty much sorts all the functions I required, and as long as you have the 1Mb ESP-01 you can also do OTA too.