Schedule helper overnight?

Does anyone know how to use a scheduler helper overnight? I want the scheduler to run from 22.00h - 08.15h (don’t want to use the frontend because I also want to be able to change the time to other than half an hour times).

If I do a test in the user interface to pull the block over the night, the block seems to stop at 00:00

If I use in YAML:

    tuesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "00:00:00"
    wednesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "00:00:00"

I get this error:

Invalid config for [schedule]: Invalid time range, from 22:00:00 is after 00:00:00 for dictionary value @ data['schedule']['nachtverlaging']['tuesday']. Got [OrderedDict([('from', '00:00:00'), ('to', '08:00:00')]), OrderedDict([('from', '22:00:00'), ('to', '00:00:00')])]. (See ?, line ?).

Apparently the 00:00:00 can’t be the end of the day.

I sort of works as I change it this way:

    tuesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "23:59:59"
    wednesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "23:59:59"

But that results in two triggers (one off and a second later one on again). Is it possible to make one block from 08.15h - 08.00h next day?

Based on the Schedule integration’s documentation, I don’t see anything suggesting it can support a schedule that exceeds a single day.

I suggest you explore the possibility of using the Local Calendar integration (it supports scheduling multi-day events, repeating events, etc).

Thanks, I will have a look at the integration as well.

Nonetheless I solved it:

    tuesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "24:00:00"
    wednesday:
      - from: "00:00:00"
        to: "08:15:00"
      - from: "22:00:00"
        to: "24:00:00"

So the frontend is somewhat misleading in how it presents the block. It should be 24:00:00h in the end of the day instead of 00:00:00h :slight_smile:

2 Likes

That’s interesting because, to my knowledge, 24:00 isn’t supported anywhere else in Home Assistant.

Examples:

  • If you attempt to set an Input Datetime to that value it will produce an error.

  • If you try to create a Local Calendar event ending at 24:00 it is automatically changed to 00:00.

You may have stumbled upon a bug.

2 Likes

I implemented this in the UI as two blocks “11:00p-12:00a” and “12:00a-4:00a” to control a night light. Unfortunately, this does NOT work the same as a single block would. It works as TWO blocks, so if you manually turn the light off during the first block, the second block will turn it back back on at midnight.