I also note that you are reading a number of temperature sensors - in the case of the DS18B20 they have a minimal time to send out a reading request - per sensor and then wait for the response - if you have multiple of these (or other similar sensors) this will throw out your timing loops and indeed may not complete before you go back to deepsleep
I publish 10 MQTT topics from an ESP8266 to a Raspberry Pi running Mosquitto and then into Node-Red every 2 minutes and then put the ESP into deep sleep mode.
I noticed early on that I was randomly losing some of the last few messages and thought it might have been the load on the Rpi. But, I put a 50ms delay after the last client.publish right before entering the deep sleep mode and haven't had a problem since.
I only put the delay prior to the deep sleep, not after each client.publish. In fact I grab the millis() timer and transmit that as the last topic so I can see how long the entire cycle takes.
I have already deployed my 2 devices(weather station and garden water system) outside in another country and accepted the fact that weather station wont be perfect(getting data every 5min but with few skiping per hour).
@krambriw ESPHome? Dont know what it is but i just migrated from Blynk app because they want to charge from next year on or something. Anyway in past few weeks i have migrated to raspberry pi 4 using mosquitto, node-red, influxdb 2, grafana, pivpn. First time using all this stuff. I wont make a mistake again having my data in some cloud or "free" app.
@GlennK Yes, i have added delay before deepsleep from 50milis, 100, 500, 1000 to even 1min.
@craigcurtin But i do get all sensor data. I can see values in my esp serial monitor. I also see confirmation from mqtt library that it was successfuly "sent".
Anyway, once again thx for your help. But sometimes u just need to let it go and deploy/finish the project.