psent = packets sent and psuccess = successfully acknowledged requests, so every time an attempt is made to send a packet psent is incremented by one and only if the reply is a “ok” does it increment psuccess.

Looking at your graph (for example) just before 08:00 we see psent is a little higher than psuccess meaning there were some requests that didn’t get an “ok” response, that could be for a variety of reasons, network issues, wifi issues, emoncms timeout etc. looking closer at that same example time window it appears the errors occurred around 07:00 as we can see a “dog-leg” in the psuccess plot.

These counts should AFAICT increase steadily forever and only reset at rollover (4,294,967,295 or every 1362 years at 10s intervals) or power interruptions (to the emonESP not the emonTx) or FW updates OR if the failure count (psent minus psuccess) reaches 30 (see line 84 of EmonESP/src/emoncms.cpp).

If your device is reaching that 30 fails limit and resetting that would suggest (for example) between 02:00 and 04:00, when the device reset 9 times that there were over 270 failed requests, since there are only 720 packets sent over 2 hours at 10s intervals that could indicate a fail rate of 37.5% which isn’t great!

I think a reset of emoncms_connection_error_count when there is a successful “ok” receipt might improve the resetting,

if (result == "ok"){
    packets_success++;
    emoncms_connected = true;
    emoncms_connection_error_count = 0;
  }
  else{
    emoncms_connected=false;
    DEBUG.print("Emoncms error: ");
    DEBUG.println(result);
    emoncms_connection_error_count ++;
    if (emoncms_connection_error_count>30) {
      ESP.restart();
    }

as that would then only reset if there were 30 consecutive fails, but this may mask the underlying issue as the psent and psuccess numbers will get really big, dwarfing the <30 fails. I think you would then need to look at logging the difference ie the fails rather than the successes to make sense of it.

I cannot see any “retry on fail code” but I haven’t studied all the separate files that make up the emonESP code.

[edit RW has posted whilst I was writing so, apologies if I have doubled up]