- Introduction
- Installation
- Updating
- Usage
- Configuration
- Translations
- FAQ
- Troubleshooting
- Say thank you
This is a Lovelace card for Home Assistant that can be used to create a time schedule for your smart devices. You can create new rules, modify existing rules and temporarily disable rules.
The card works on top of the scheduler custom component. You will need it this as well.
See it in action:
click to show installation instructions
HACS installation:
- Add
https://github.com/nielsfaber/scheduler-card
as a custom frontend repository. - Click on "Install" under the new card that just popped up.
Manual installation
-
Download the latest release of
scheduler-card.js
here and place it intowww/scheduler-card
. -
Use the GUI to add
/local/scheduler-card/scheduler-card.js?v=0
, or add a reference to the card in the resources section ofconfiguration.yaml
:
resources:
- url: /local/scheduler-card/scheduler-card.js?v=0
type: module
- Add the card in the view where you want it to be shown:
type: custom:scheduler-card
domains:
...
entities:
...
groups:
...
click to show updating instructions
Updating via HACS: HACS should auto-remind you in the HACS tab when an update is available.
Updating manually:
Use git pull
for manual installation updates.
Since most browsers will cache the Lovelace card code, you can force a refresh of the browser by editing the entry in the resources:
section in ui-lovelace.yaml
, by updating the version to ?v=(n+1)
(where n
the current value).
🚧 WIP More usage instructions should follow soon.
Click the button 'add item' in the bottom of the card, to start creating a schedule.
The card scans the entities in your HA configuration and suitable candidates should automatically show up in this view.
Groups Since HA may contain many entities, the card divides the entities into different groups. Clicking a group automatically will show the entities contained in the group.
The groups that are displayed are depending on your HA configuration. Typically the groups are based on the domain of your entities. If you want to make changes to the groups, you can do this by defining groups configuration.
Entities The entities that you can to control with the scheduler show up here. Clicking a entity automatically will show the actions that you can program for this entity.
Typically an entity is a device in your house, but you can also control an automation
, script
, input_boolean
, etc. You can add all entities that you want to control in the include list.
Actions The actions that you can perform for the selected entity show up here. Typically an action is to either 'turn on' or 'turn off' a device. But some entities have more capabilities. If you are missing an action, you can add it yourself using the customize configuration.
Actions can contain a variable setting (e.g. turn on a lamp at specific brightness, or change the setpoint for a thermostat). These can be defined in the next page.
After clicking the 'next' button, a new view appears. This view is used for choosing when the schedule should be active.
Choose the days of the week for which the schedule should be active.
Every day the default option. The schedule will perform the action every day at the specified time.
Weekdays perform action only on Monday thru Friday. Typically weekdays are the same as working days, but it may depend on your country. Holidays are not taken into account as of yet.
Custom choose your own days. A list with all days of the week appears. You can select one or more days by clicking them.
🚧 WIP rename weekdays to workdays, and take into account holidays and the actual workdays in your country using the workday sensor
🚧 WIP add weekends and make it the opposite of workdays
🚧 WIP add option to choose the first day of the week
The time at which you want schedule to be activated can be set using the time picker.
The time picker shows the current time setting, and features arrow buttons to increase or decrease the hour and minutes. Note that you can infinitely loop through time. The step size for minutes is 10 minutes by default, but can be configured to your preference.
If you have the AM/PM option enabled, 12-hour format will be used. You can click on the button to switch between AM and PM.
Sunrise / sunset mode
If you have the sun integration in HA, a button with sun/moon icon shows up on the right. This is the mode button, which allows you to switch from a fixed time, to time relative to sunrise or sunset.
The card allows you to choose a time that is 2 hours around sunrise or sunset. The button will be disabled if the current time is not in this range.
In sunrise/sunset mode, the time picker will show the offset relative to sunrise/sunset. The time offset is automatically calculated from fixed time. The sunrise/sunrise button will show a sun icon when offset is relative to sunrise, or a moon icon when offset is relative sunset. The before/after button indicates whether the offset is applied in positive direction (so triggers after sunrise/sunset), or in negative direction (before sunrise/sunset). Also here, buttons can be clicked to toggle.
The configuration of the card is in YAML. Currently there is no UI editor provided (this may change in the future).
Configuration is not necessary, it is only used for customization.
The card includes a standard configuration. It is intended to make setting up the card easy. The standard configuration consists of the following:
- Discovery of devices (entities) of various types in your HA config and making them available for creating schedules
- Defining actions per entity based on their capabilities
- Icons for groups, entities and actions
standard_configuration:false
to disable it completely.
Name | Type | Default | Available from | Description |
---|---|---|---|---|
type |
string | Required | - | custom:scheduler-card |
standard_configuration |
boolean | true | v1.2.0 | Use the standard configuration as a base configuration. |
discover_existing |
boolean | true | v1.2.0 | Show previously created schedules in the card, also if the related entities are not included in the configuration. Set to false if you have multiple scheduler-cards.See schedule discovery for more info. |
include |
list | none | v1.6.0 | List of filters to determine which HA entities are available for creating schedules. See include for more info. |
exclude |
list | none | v1.6.0 | List of filters to determine which HA entities are not available for creating schedules. See exclude for more info. |
groups |
list | none | v1.0.0 | Organize the entities menu. See groups for more info. |
customize |
dictionary | none | v1.6.0 | Customize the available actions or visualization of entities. See customize for more info. |
title |
boolean/string | true | v1.2.8 | Provide a text to replace the title of the card. Set to false to hide the title. |
am_pm |
boolean | false | v1.3.0 | Use AM/PM time notation (instead of 24 hours notation) |
time_step |
number | 10 | v1.3.0 | Set the time step (in minutes) for the time picker |
The card includes a standard configuration. It is intended to make setting up the card easy. The standard configuration has actions defined for most types of entities in Home assistant.
When including an entity, the standard configuration will automatically detect which actions are supported by it, and will make these available.
Also it has icons for most entity types and actions.
If you would rather set up your own configuration of entities and actions, you can provide standard_configuration:false
to disable it.
The include
configuration allows you to pick entities from your HA config that you can use for creating schedules.
You can either provide the full entity_id
of the entities, or only the domain.
The list supports wildcards (*) as well. It is recommended to use quotes ("") around your input, else it may be wrongly interpretated.
Example:
include:
- climate.my_thermostat # include an individual entity
- light # include all light entities
- "*garden*" # include all entities containing the word 'garden'
...
The exclude
configuration allows you to remove entities from your HA config from appearing in the scheduler.
The exclude
list works on top of the include
list, so it behaves like 'ADD (includes) EXCEPT (excludes)'.
Like with include
, you can either provide the full entity_id
of the entities, or the domain, or use wildcards.
include:
- light # include all light entities
exclude:
- light.my_light_that_i_never_use # exclude
The groups
configuration provides the capability of organizing the entities.
To be clear, they have nothing to do with the group integration in Home Assistant.
By default, entities will be grouped based on their type (domain). Entities that are assigned to your own defined group will not be grouped by type.
Name | Type | Default | Description |
---|---|---|---|
name | string | (same as group_id) | Displayed name for group |
icon | string | none | Displayed icon for group |
include | list | none | List of filters to determine which of the entities belong in this group. This has the same functionality as the include filter for defining the entities in the card. |
exclude | list | none | List of filters to determine which of the entities do not belong in this group. This has the same functionality as the exclude filter for defining the entities in the card. |
Example:
Place all light
entities in group labelled "lighting"
groups:
- name: "Lighting"
icon: ceiling-light
include:
- light
Result:
The card checks for the created schedules in your HA config and show them in the overview page.
The schedule discovery is a feature that will ensure that all your schedules will be there.
What is the benefit of this feature?
It could occur that you make changes in the configuration, resulting in previously created schedules to become hidden.
For example, you made a schedule for controlling a fan
.
The day after you decide to remove the fan
domain from the card. But you forgot to delete the previously created schedule.
Without the discovery, you now have a schedule that is hidden from the card, but will keep running. You cannot remove or change it anymore (unless via the HA configuration panel).
Discovery makes sure that you will always find it back in the card.
The feature can be turned on/off through the discover_existing
option.
For your protection, it is enabled by default.
discover_existing:false
if you want to use multiple cards. Else you will see each created schedule in every card.
With the customize
configuration you can specify configuration for specific HA entities.
configuration
in combination with the standard configuration. The configurations will be merged.
Name | Type | Default | Description |
---|---|---|---|
entity | key | Required | Entity id (or filter). Filter works the same as include so you can also use it for multiple entities. |
actions | list | none | See actions |
name | string | (take from HA config) | Displayed name for entity |
icon | string | (take from HA config) | Displayed icon for entity |
An action defines what needs to be done when a schedule timer expires.
An action is similar to a service call in HA. It requires a service
with optionally additional parameters given by service_data
.
Actions are linked to their entities, so the entity ID is sent together with the service call, it is not needed to add it to the service_data
).
Name | Type | Default | Description |
---|---|---|---|
service | string | Required | Service to be executed |
service_data | map | none | Additional parameters to use for the service call |
variable | map | none | Add a variable. See action variable |
name | string | (same as service) | Displayed name for action |
icon | string | "flash" | Displayed icon for action |
Example:
Adding an action to turn on a light with 40% brightness
customize:
light.my_lamp:
name: "Dining light"
icon: ceiling-light
actions:
- service: turn_on
service_data:
brightness: 100 # note that brightness is from 0-255 so 100 = 40%
name: "Turn on at 40%"
icon: lightbulb-on-outline
Result:
Some devices allow to operate on a variable working point. For example lights can be dimmed with a brightness
, fans can spin at a speed
etc.
By providing an action variable, the card allows you to choose the setting you want to apply with the action.
Name | Type | Default | Description |
---|---|---|---|
field | string | Required | field name in the service_data that is represented by this variable |
name | string | same as field | Name under which the variable is visible in the card |
unit | string | " " | Displayed unit |
min | number | 0 | Minimum value that can be set. If not provided, it will be read from the entity attributes. |
max | number | 255 | Maximum value that can be set. If not provided, it will be read from the entity attributes. |
step | number | 1 | Step size |
optional | boolean | false | Setting the variable is optional, the action can also be executed without this variable. If optional:true is provided, a checkbox will be shown that needs to be selected to apply the variable |
This option is removed in v1.5.0. Use '%' as unit instead. |
Example
The Xiaomi Air Purifier can be controlled using the Xiaomi Miio integration. To be able to set the speed of this device in your action, you can use:
customize:
fan.xiaomi_purifier:
actions:
- service: xiaomi_miio.fan_set_favorite_level
name: "set speed"
variable:
field: level
name: "Speed"
min: 1
max: 16
You can now select the speed for this action in the schedule editor:
With some actions, you can provide an option from a limited list of options.
For example, setting the value of an input_select
, but also the operation mode of a thermostat.
By providing the list variable, the card allows you to choose the option when you set up the action.
Name | Type | Default | Description |
---|---|---|---|
field | string | Required | field name in the service_data that is represented by this variable |
name | string | same as field | Name under which the variable is visible in the card |
options | list | Required | List of options to choose from |
value | string | Required | Option value (which is passed with together with the field as service_data ) |
name | string | same as value | Name to show for the option |
icon | string | none | Icon to show with the option |
Example
Setting the operation mode of a thermostat.
Note that this configuration will already be set up when using standard configuration.
customize:
climate.my_thermostat:
name: My thermostat
icon: thermometer
actions:
- service: set_hvac_mode
name: Set mode
icon:
variable:
field: hvac_mode
name: Operation mode
options:
- value: heat
icon: fire
- value: cool
icon: snowflake
- value: 'off'
icon: power
Now the list of options become visible when you set up the action:
The card is available in multiple languages. The card will automatically detect the appropriate translation based on the language setting for your user account in HA.
Currently the following languages are supported:
Language | Code(s) | Available from | Status / Remarks |
---|---|---|---|
Deutsch | de | v1.2.3 | |
English | en | v1.0.0 | Default language. |
Eesti | et | v1.4.0 | |
Español | es, es_419 | v1.2.8 | |
Français | fr | v1.2.3 | |
Italiano | it | v1.7.5 | |
Magyar | hu | v1.3.0 | |
Polski | pl | v1.2.6 | |
Português | pt, pt-br | v1.3.0 | Translation is brazilian Portuguese, improvements may be needed for native Portuguese. |
Русский | ru | v1.2.8 | |
Română | ro | v1.7.3 | |
Nederlands | nl | v1.2.2 | |
Norsk | no, nb, nn | v1.2.8 |
The translations are maintained by users. If you are missing a translation, or a translation needs to be improved, please contribute. Take the english file as a starting point.
From within the scheduler-card, there is unfortunately no such functionality in place. There are two alternative ways:
1. Use an automation
to control when the schedule is running
Create an automation
that checks for the condition, and based on this, enables or disables the schedule.
Run service switch.turn_off
or switch.turn_on
with the entity_id matching your schedule.
Main disadvantage: the entity_id of a schedule is not easy to read: they are randomly generated, and the entity_id does not tell anything about the related entity.
2. Use an script
to check the condition before execution of the action
Create a script
that checks for the condition, and if it passes, executes the action.
Use the scheduler to execute this script
(instead of the actual entity you want to control).
Currently this is considered the best option.
Main disadvantage: you will have to add configuration to the card to make the script
selectable in the scheduler-card. The result will look less pretty than with other entities.
Example: Turn on my thermostat at X degrees. but only if my window is closed
Create the script
(for setting up scripts see here):
my_script:
fields:
temperature: {} # allow temperature as variable field
sequence: # sequence for multiple steps, aborts if a step fails
- condition: state # check the condition
entity_id: binary_sensor.my_window
state: 'off'
- service: climate.set_temperature # update the temperature
data_template:
entity_id: climate.my_thermostat
temperature: "{{ temperature }}"
To add the newly created script to HA you need to restart HA (or run 'reload scripts').
Now make sure to include
it in the scheduler-card and you should be able to schedule a run action for it.
In your browser, open the console log. This is usually accessible from the developer tools (MS Edge: F12, Chrome: ctrl+shift+i). There should be a badge titled "SCHEDULER-CARD" with the version number included.
This error suggests that the scheduler-component is not running. Please do NOT file an issue in this repo.
Good question, ask the developers!
But let's see if we can get convince them to adopt this scheduler, simply by making it awesome :)
If you have an issue with this card, please report it here.
If you want to make donation as appreciation of my work, you can buy me a coffee. Thank you!