Index of /download/extras/ScheduleController

Icon  Name                                   Last modified      Size  Description
[PARENTDIR] Parent Directory - [TXT] README.html 2024-04-07 17:48 7.5K [TXT] LICENSE.html 2024-04-07 17:48 294 [TXT] CHANGELOG.html 2024-04-07 17:48 238 [   ] ScheduleController-24097.zip.sha256 2024-04-07 17:48 95 [   ] ScheduleController-24097.tar.gz.sha256 2024-04-07 17:48 98 [   ] ScheduleController-24097.zip 2024-04-07 17:48 12K [   ] ScheduleController-24097.tar.gz 2024-04-07 17:48 7.6K

ScheduleController

ScheduleController is a simple controller that publishes, through an entity, a current active schedule period given a series of starting times. It operates similarly to thermostat schedules, where you typically have morning, day, evening, and night periods for which you can set starting times. The changing value on the entity can be used in rules to trigger scenes or other activities at specific times.

While one can use the Date/Time and other conditions in rules to achieve this effect, ScheduleController makes some logic simpler. The simple example above, with four phases or modes per day, would be fairly easy to implement without ScheduleController. However, having multiple schedules interacting, with expections for day of the week and other conditions, could quickly raise complexity to the point that writing proper-functioning rules and debugging those that don't could be daunting.

Installation

To install ScheduleController:

  1. Create an ext directory for extensions if you do not already have one:

  2. Go into your ext directory and create a subdirectory`

  3. Copy the contents of the release package (all files) into the new ScheduleController folder you just created.

  4. Configure ScheduleController and restart Reactor. See below.

Configuring ScheduleController

Like most controllers, the basic preamble necessary to make Reactor aware of the controller and start it looks like this (in the contollers section of your config/reactor.yaml file:

controllers:  # don't add this line; it's shown just for guidance/indenting reference
  - id: scheduler
    name: Scheduler
    enabled: true
    implementation: ScheduleController

From there, as with most other controllers, you will add a config section that contains the configuration for the extension.

ScheduleController requires only one configuration element: entities. In this element, you will give entity IDs for the entities to be created that represent your schedules. The example below shows a sample configuration with two schedules, one for weekdays, and one for weekends.

    config:
      entities:
        weekdays:
          name: Weekday Schedule
          schedule:
            '07:00': morning
            'sunrise + 2 hours': day
            'sunset - 60 minutes': evening
            '22:30': night
        weekends:
          name: weekend Schedule
          schedule:
            '09:00': morning
            '10:30': day
            'sunset-00:30': evening
            '0:00": night

The weekdays and weekends strings will be the entity IDs of the entities created to represent the two schedules. Within these sections, a schedule element defines the periods of the schedule. Each element of schedule is a key/value pair called an edge, where the key (left of the ":") is a time specification, and the right side is a string value to be assigned to the string_sensor.value attribute at that time. In the weekday schedule above, the period starting at 7am local time will be called morning, and that string will be assigned to the string_sensor.value attribute of the entity. At two hours after sunrise, the attribute will change to day; at one hour before sunset, it will change to evening; and at 10:30pm it will change to night. The weekend schedule has similar timing.

Note that a value for the period between midnight and 7am isn't specified. ScheduleController treats the schedule as cyclical over a day, so it will automatically assume that the period from midnight to 7am is night, because the latest edge is 10:30pm — the entity will show night from 10:30pm to 7am the next day.

Time specifications can be of the following forms:

For edges using the sunrise and sunset time specifications, an optional offset may follow. If specified, the offset must be a + or - followed by HH:MM form, HH:MM:SS form, or an integer and units (such as the + 2 hours and - 60 minutes shown). For the integer and units form, whitespace is not significant, so +2hours would also work. The unit words hours, minutes and seconds may be used, and may be abbreviated to hrs, mins, secs respectively (the respective singulars hr, min, sec are also acceptable). Compounding is also allowed: + 1 hour 30 minutes. The offset forms -1hr30mins and -01:30 are equivalent.

Time specifications do not need to be listed in order; ScheduleController will sort them out. However, you may wish to keep them in order just for your own ease of readability.

Cautions for Sunrise/Sunset

Updated 2024-Apr-06