Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By QuickFix
#83980 You tell the ESP how long a deep sleep should be, so you already know the time spawn.
But if you want an exact value, you could use a real time clock like the DS3231.

Pseudo code:
  • Get current date/time
  • Write to EEPROM
  • Go to deep sleep
  • ...
  • Wake up
  • Get current date/time
  • Retrieve stored date/time from EEPROM
  • Subtract the two values: result is actual time spawn
User avatar
By WhiteLion
#83981 Thanx for your answer. If the deepsleep lasts a fixed time you are right.
In my case the ESP wakes up form a motion of a PIR sensor not the fixed entered value.
To avoid the energy cost for WiFi / MQTT on every motion I wanted to measure deepsleep time and use this information to just connect every 5 minues or so.


Code: Select allPseudo code:
    Get current date/time
    Write to EEPROM
    Go to deep sleep
    ...
    Wake up
    Get current date/time  // Get it from where if no WiFi connection ?
    Retrieve stored date/time from EEPROM
    Subtract the two values: result is actual time spawn