HA Lovelace card for control of scheduler entities
HA Lovelace card for control of scheduler entities
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 that as well.
See it in action:
click to show installation instructions
HACS installation:
Note: Ensure you have a www folder created as in config/www or the installation will succeed but fails silently
Note: Ensure to install https://github.com/nielsfaber/scheduler-component and add the integration in order for the scheduler to work properly.
Manual installation:
scheduler-card.js here and place it into www/scheduler-card./local/scheduler-card/scheduler-card.js?v=0.ui-lovelace.yaml (or use the card editor):type: custom:scheduler-card
domains:
...
entities:
...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 Lovelace resources section, by updating the URL to ?v=(n+1) (where n the current value).
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.
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.
Workdays perform action only on Monday thru Friday. If you have the workday integration installed, you can use it to define your own set of workdays. The workday integration and its settings will be automatically detected if it is installed. Note that if you define holidays, they will be excluded from workdays.
Weekend perform action only on Saturday and Sunday. If you have the workday integration installed, the weekend will be considered as the inverse as workdays. This means that holidays and your 'fixed day off' are included in the weekend setting.
Custom choose your own days. A list with all days of the week appears. You can select one or more days by clicking them.
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.
:warning: Important: What you see is what you get here. If you want to store time as relative to sunrise or sunset, make sure that you have this mode activated when you click the save button.
A time scheme is a more advanced type of schedule, which allows multiple actions during the day through the use of timeslots.
A timeslot defines a time range during which you want an entity to be in a certain state. Every timeslot has a start time and end time, together with an action.
An action defined for a timeslot will normally be executed when the time reaches the starting time of the slot. So in this sense the behaviour is not different compared to a a normal schedule.
But there are differences:
After a timeslot has triggered the action, the schedule will wait for the next timeslot. So, you can keep controlling your entity as you want without worrying that the schedule will not re-trigger its action again.
:warning: Note At the end of the timeslot, there is no action executed. This means that if you turn on a device during a timeslot, you will have to add a second timeslot to turn it off. It is highly recommended (but not required) to assign actions to every timeslot, such that the behaviour for the whole day is defined.
The time scheme editor allows you to configure the timeslots of your schedule and visualizes the result.
A time scheme starts at 00:00 and ends at 23:59, so it covers a full day. Depending on the selected days, the schedule continues with the first slot of next day after the last one ended. So usually the first and last slot should have the same action.
Draggable markers The card shows a bar with multiple time markers which you can drag/slide to change the duration of the timeslots. The time step is currently limited to 15 mins intervals.
Selectable timeslots By clicking on a timeslot, it becomes selected and will have highlighted color. When a timeslot is selected, you can assign an action to it.
Divide or merging of timeslots When a timeslot is selected, you can click the '+' or '-' buttons to either divide (split in two) or merge (combine with the next slot)) the selected timeslot.
:warning: Note Due to the limited width of the Lovelace cards in HA, it might be difficult to make a short timeslot. Since there is not really a way to fix this, it's recommended to use a PC or use your phone on landscape mode when creating a time scheme.
The options panel gives you access to additional settings that you can set up for schedules.
The options panel is called the way it is, because all settings here are optional. So it is OK to ignore it if you don't miss any of its functions.
The condition editor allows you to define a set of rules which need to pass before the action may be executed. Conditions are currently limited to checking the state of (other) HA entities (so not their attributes). States may be numeric, on/off or string type. Date/time format is not supported.
The editor allows you to make rules in various ways: logic AND, OR, NOT functions, as well as below and above for numeric states. You can combine multiple entities if needed.
All entities having states configured will show up in the editor.
For more information on this, see conditions.
:warning: Note: Conditions are only evaluated at the time the actions should fire. This means that if the conditions are not met, the timer event will be skipped. It will not be re-evaluated when any of the entities involved in the conditions change.
The period option allows you to define a range of dates (or a single date) for which the schedule needs to be active.
If the period option:
No open issues yet, or sync has not completed.