-
Notifications
You must be signed in to change notification settings - Fork 639
Added restore last schedule support #1948
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
Conversation
Can you explain a bit the algorithm for finding the missed schedule? How far does it go is hard-coded? |
Basically what it does, is enumerating the schedules, checking the different options of them (enabled or not, UTC or not) and for each schedule check if it supposes to happen in the current day. About the DST, it could be problematic but i`m not sure what is the proper solution for that. (It also affects the current scheduling algorithm if there is a schedule between 1:00-2:00 or 2:00-3:00 when DST is happening). |
Ah, thank you for that. I missed the part where it moves the timestamp back. Maybe instead of using part of schCheck it should be inside of schCheck itself via bool param / look_back=N-days param + timestamps as params? Since lights are also handled that way and it is not dependant on relays Following that idea, would it make sense to have things per-schedule instead of per-relay and have |
I have merged the RestoreLastScheduleState function into the _schCheck function I think its makes more sense to have things per-relay and not per-schedule as you mentioned... |
1948 ext Merged, will fix some bugs in the code in the next commits...
Thank you for your code changes and popping the issue about the light provider. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lights work, thanks! See naming comments.
I was also thinking about boot modes and about how this could be a separate setting for boot mode, since we already depend on relay id for doing things? |
I have changed all the variables naming like you said. |
@@ -1890,6 +1890,10 @@ <h2> | |||
<div class="pure-u-1 pure-u-lg-1-4"><label>Pulse time (s)</label></div> | |||
<div class="pure-u-1 pure-u-lg-1-4"><input name="relayTime" class="pure-u-1" type="number" min="0" step="0.1" max="3600" /></div> | |||
</div> | |||
<div class="p-g module module-sch"> | |||
<div class="p-u-1 p-u-lg-1-4"><label>Restore last schedule</label></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this should probably be p-
-> pure-
, gulp will shorten it afterwards.
Opening things locally breaks styling.
Since everything else is done, I'd rebuild the webui files and add them here + this fix.
I have added an option to restore the last schedule state on the device boot.
This option is useful in case of power loss or any kind of device reset that you still want your schedules to continue as usual.
At the moment if the device had a "down time" while a scheduled action should have happen, your action wont get applied, with this new feature the device will check for the closest schedule action that should have happened before boot, and restore its state to the desired schedule action state.
I have also added an option in the "SWITCHES" menu to choose on which relay you would like this feature to run on.
Disclaimer: it only counts "Turn ON" and "Turn OFF" actions and ignores toggle actions