I have set up a temperature logger with an ESP8266. It wakes up once an hour, and is supposed to send temperature and humidity via MQTT (using the PubSubClient library). I have had this working for a while now and looking at the voltage, I face between 4 month and year run time on a 18650 LiPo, which is totally fine.
The problem I have is that apparently, sometimes the node goes to sleep before the MQTT message is actually send. Initially sending didn't work at all. Then I added a delay of 300ms before the sleep command, and it works mosty, but not always. A Wemos D1 Mini Pro seems to work better than a standard Mini.
Is there a way to determine if there are still network messages to be send?