Skip to content

amitfin/daily_schedule

Repository files navigation

Daily Schedule

HACS Badge

GitHub Release Analytics

Project Maintenance

The Daily Schedule integration provides a binary sensor that gets its on / off state according to the user-defined schedule of time ranges.

There is a corresponding Lovelace card which should be used for configuration. To open the card installation page inside HACS click here.

Automation rules can be built with the daily schedule entities as demonstrated here.

Note: The built-in Schedule integration can be used when a weekly schedule is needed.

Install

HACS is the preferred and easier way to install the component. When HACS is installed, the integration can be installed using this My button:

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Otherwise, download daily_schedule.zip from the latest release, extract and copy the content into custom_components/daily_schedule directory.

📌 Home Assistant core restart is required once the integration files are copied (either by HACS or manually).

Create Daily Schedule

Use this link:

Open your Home Assistant instance and start setting up a new integration.

Or, in the Home Assistant UI go through the following path:

Open your Home Assistant instance and show your settings menu.

Open your Home Assistant instance and show your devices.

Open your Home Assistant instance and show your helper entities.

=> Click "+ Create helper" button and search for "Daily Schedule".

Usage (Lovelace Card)

image

Time Ranges

Each range has from and to. If the to is less than or equal from it's treated as time in the following day. One interesting case is when from equals to. This type of range covers the whole day (always on).

There are 3 ways to specify time:

  1. A fixed time (e.g. 12:30).
  2. Sunset with an optional negative or positive minutes offset.
  3. Sunrise with an optional negative or positive minutes offset.

Attributes

The binary sensor has the following attributes:

  1. Schedule: the list of on time ranges as provided by the user.
  2. Effective schedule: the actual on time ranges: (1) disabled ranges are ignored, (2) the user-provided ranges are merged and duplications are removed. This list doesn't include overlapping or adjusting ranges.
  3. Next toggle: the next time when the binary sensor is going to change its state.
  4. Next toggles: a list with the 4 next times when the binary sensor is going to change its state. The 1st element is identical to Next toggle.

set Action

daily_schedule.set action can be used to configure the time ranges. Here is a YAML-mode example, although it's recommended to use the UI-mode:

action: daily_schedule.set
data:
  schedule:
    - from: "↓-30"
      to: "22:00"
target:
  entity_id: binary_sensor.backyard_lights

The format of from and to can be one of the 3 options:

  1. Absolute time: a 24h time in this format.
  2. Sunset: start with "↓" and can have an optional positive or negative offset in minutes. For example: "↓", "↓-20", "↓+30".
  3. Sunrise: start with "↑" and can have an optional positive or negative offset in minutes.

Typically, there is no need to use this action directly since it's been used by the Lovelace card.

Note: there is no corresponding get. The data already exists as attributes:

{{ state_attr('binary_sensor.backyard_lights', 'schedule') }}
{{ state_attr('binary_sensor.backyard_lights', 'effective_schedule') }}

Additional Cards

Timer Bar Card supports this integration. end_time must be configured as follow:

end_time:
  attribute: next_toggle

By default it countdowns the time till the end of the current time range. active_state can be used for counting down the time to the beginning of the next range (instead):

active_state: 'off'

UTC Option

When UTC option is set (not the default), the time should be expressed in UTC instead of local time. This option can be used when absolute time is needed, which is not impacted by daylight saving changes throughout the year. This is an advanced option that should not be used in the majority of the use cases. It should be used only if there is a very concrete reason to do so.

Removing the Integration

  1. Delete the configuration:

    • Open the integration page (my-link). Delete all helper entities by clicking the 3‑dot menu (⋮), and selecting Delete.
  2. Remove the integration files:

    • If the integration was installed via HACS, follow the official HACS removal instructions.
    • Otherwise, manually delete the integration’s folder custom_components/daily_schedule.

📌 A Home Assistant core restart is required to fully apply the removal.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

About

Home Assistant Daily Schedule Custom Component

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •