nielsfaber / scheduler-component

Custom component for HA that enables the creation of scheduler entities
GNU General Public License v3.0
638 stars 41 forks source link

End point of schedule having 1 minute duration is missed #361

Open MrWhite80 opened 3 months ago

MrWhite80 commented 3 months ago

Checklist

Note there is another issue written up with this same behavior but has been closed as staled out. #225

Expected behavior

When creating a schedule using a scheme to turn on a switch for 1 minute, the switch should turn own at the start of the scheme time duration and switch off at the end of the time duration.

Actual behavior

The switch does turn on at the start of the task but not switch off.

From the debug log during the test [custom_components.scheduler.timer] Timer 3736d6 has reached slot 1 2024-06-16 16:11:00.002 DEBUG (MainThread) [custom_components.scheduler.switch] Schedule 3736d6 is triggered, proceed with actions 2024-06-16 16:11:00.028 DEBUG (MainThread) [custom_components.scheduler.actions] [3736d6]: Executing service switch.turn_on on entity switch.greenhouse_water_beds_water 2024-06-16 16:11:00.033 DEBUG (MainThread) [custom_components.scheduler.actions] [3736d6]: Finished execution of actions 2024-06-16 16:12:00.041 DEBUG (MainThread) [custom_components.scheduler.timer] Timer of 3736d6 set for 2024-06-16 23:59:59-03:00

Steps to Reproduce

Create a schedule that uses a switch and scheme to have a daily task to switch on the switch for 1 minutes with a start time slightly in the future. Allow time to got passed the start time (switch does turn on) and then passed the end time. The switch is never turned off.

image

NOTE if I change the amount of time the switch is left on to a few minutes it all seems to work.

nielsfaber commented 3 months ago

Please share a screenshot of your schedule

MrWhite80 commented 3 months ago

@nielsfaber Attached screenshot and logs in above description.

samedarkclouds commented 2 months ago

Same-ish. In the last few weeks my schedules, the ones with "choose days," just don't fire. I uninstalled, reinstalled. Deleted the card, re-did the card. Just doesn't fire the script.

Another I have that uses the workday schedule and changes multiple entity states works perfectly fine.

But that choose day, run script one just never fires. Also, it DOES show when it should fire next... just doesn't happen.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

MrWhite80 commented 1 month ago

Any updates on the issue?

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

MrWhite80 commented 3 weeks ago

Any updates on the issue?

nielsfaber commented 2 weeks ago

@MrWhite80 I apologize for the lack of response from my side. I confirm scheduler does not work fine for a timeslot that lasts only 1 minute. This is due to the fact that scheduler re-calculates the next trigger point when the minute of the start of the schedule has ended. So in your case, at 4:12 PM scheduler will determine what is the next point in time, unfortunately 4:12 PM is already passed and hence 12:00 AM would be next. Perhaps I can make a small modification to the code to have the current time included in the re-calculation. For the time being I suggest to stick to timeslots having at least 2 minute duration.