Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep sleep with timers can wake multiple times due to clock drift. #21423

Open
9 of 14 tasks
smhc opened this issue May 17, 2024 · 0 comments
Open
9 of 14 tasks

Deep sleep with timers can wake multiple times due to clock drift. #21423

smhc opened this issue May 17, 2024 · 0 comments

Comments

@smhc
Copy link
Contributor

smhc commented May 17, 2024

PROBLEM DESCRIPTION

Having a WakeUp rule and timer of "6:30" can wake at 6:28 due to clock drift. It will then sync the clock and calculate the next wake up to be 6:30 and wake again in 2 minutes, waking twice instead of just once at roughly 6:30. (In my particular case I am using 'sunrise', but the same issue applies).
Note that I am performing an explicit "Restart 9" a few seconds after booting.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): esp32-c3
  • Tasmota binary firmware version number used: v13.4.0
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: web
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:

  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:

  • Provide the output of this command: Status 0:
  STATUS 0 output here:

  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  Console output here:

TO REPRODUCE

Steps to reproduce the behavior:

  1. Create 6:30am timer with Rule 1 Wakeup
  2. Create a rule to immediately "Restart 9" after boot (can check other conditions to disable this)
  3. Monitor wake-ups over a period of days

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

Should only wake once at roughly 6:30am each day.

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

I believe the code at:
https://github.com/arendst/Tasmota/blob/development/tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino#L161

should be taking the 'slip' into account. Alternatively, perhaps it could calculate the repeat period of each timer and only consider it a target if it's more than 10% to the next trigger. e.g if it's a 24hr repeat timer, it will only wake for the timer if it's 2.4hrs or greater away. (sunrise/sunset would need to use 10% of 12hrs).

Otherwise, maybe the "5%" fix needs to be re-instated, as per: #21295
This would ensure you wake after the target and won't have the issue of re-waking for the same timer. But I disagree a blanket "5%" is a good idea.. as this can throw out the target time by quite a bit for long sleeps.

(Please, remember to close the issue when the problem has been addressed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant