-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Integrate TIMERS into Deepsleep #20117
Conversation
Added new functionality to controll the Deepsleep Wakeup process with TIMERS.
@stefanbode Compile errors in special builds variants https://github.com/Jason2866/Tasmota-build/actions/runs/7023562479/job/19110370399 |
Thanks will check tomorrow morning. Should skip if rules and script in not enabled. Thanks for pointing |
Hey @stefanbode thanks for this, it looks promising.
I have a bit of feedback on the DeepSleep doco, but it's probably best to just submit a separate PR for review. |
|
How would that work?
Do you think a mandatory "Restart 9" or "DeepSleepResume" command that actually initiates the sleep might be a reasonable solution to all of the above.? |
Although I think a wake from "Restart 9" seems most intuitive, another option is using a timer to sleep. i.e "Rule1 Sleep" and "Rule2 Wakeup". This would allow you to schedule when to be asleep vs wake. I'm not sure about the implementation difficulty of this however. |
Regarding 1 I agree. This is not optimal right now. The main problem is there is no change in Timers and therefore a change here I cannot catch. There must be a restart or the deepsleeptime to get notification this is changed. I will check today how to optimize. My answer on 2 was wrong. You want to keep the device awake. Easiest way is to create a rule on system#start rule1 0. Maybe it is an idea to use the ONCE flag on rules. This is currently unused. In this case the rule Wakeup got disabled once go to deepsleep. To go to sleep on sunset currently a rule1 1;restart 1 will do the job. Please be aware minimum code addition is required. This is not a pc. Introducing all this Wakeup, Sleep, depsleepresume is an overkill. We have to be smarter. |
Yeah I agree a 'sleep timer' UI is probably overkill. It was just one possible solution to the problem of when to sleep. I don't think an automatic sleep immediately after wake is ideal when using a wake timer. So either an explicit sleep or scheduled sleep could solve that. Writing a bit of code is fine - if anything I was proposing mandating writing some code to explicitly sleep instead of it being automatic. I think it's more intuitive to have the wake timer only be concerned with wakes, rather than it also implying an automatic sleep that you need to disable on boot. |
@smhc : There is a new push on the way. As the initial build was to integrate the timers in general the new push is to optimize the work and automation with deepsleep. What changed: What do you need to send the device back to deepsleep? this will trigger the 60 second countdown before the device go to sleep. |
Hmm ok, so essentially turning on the special rule is how to turn on the sleep schedule and initiate first sleep. Iterating the rules on "Restart 9" for one that is marked "Wakeup" still seems a bit more intuitive for the stay awake after wake scenario. But if "rule1 5" does actually go to sleep immediately (or close to it) then that is still workable for the "stay awake" scenario. I'll give it a try over the next few days and see how it goes. |
The problem of restart 9 is that it defines no sleep time. As far as I can see. And there is no deep sleep with a proper time. Just wake up through external pin in not easy. Anyhow your proposal also have some smartness and make sense. |
Looks like this new feature is actively being tweaked, so documentation probably doesn't exist yet. Is there anywhere laid out exactly how you envision it working? Is the goal to set a (for example) 12 hour timer, then, with deepsleeptime set to 60, the unit will deepsleep for 60 second intervals (like current implementation) until the timer runs out, then it will remain awake? |
What I meant by this is that the he current code for enabling the Rule["Wakeup"] could be moved to the callback for "Restart 9" (or Restart n). This would require an explicit "Restart x" to go to sleep instead of it being automatic on rule enablement. e.g
You could define a new "Restart 10" instead, and it could return an error if there is no respective rule/timer if you wanted some safeguards. |
Documentation already updated. The timers are a replacement for the Intervall to get more control. E.g. wake-up every morning on sunrise and goto sleep again. Intervall is still working, but you cannot mix. |
@smhc : the idea is nice but there is no option to select the rule that gets executed on a timer. I thought it is different but it isn't. Always all rules get called on the event. The 1,2,3,4... is only valid for the relays |
The point was to use the restart9 command to initiate the sleep.
(which just uses the minimum across all timers
but executed immediately by the Restart 9 command callback instead of using a countdown initiated in the deep sleep drivers TelePeriod callback. i.e
It would allow you to have the timer and rule enabled without a countdown sending it off to sleep - you'd have more logical control over when it sleeps. |
Added new functionality to control the Deepsleep Wakeup process with TIMERS.
Timers must be type of "RULE"
"rule1 Wakeup" and ARMED and REPEAT will be used
Timer can use: TIME and SUNRISE and SUNSET with offset
Current +- variation is not supported
If above is NOT set the old behavior with "deepsleeptime xx" is still supported to wakeup on a regular base.
Description:
Related issue (if applicable): fixes #
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass