arthurdent75 / SimpleScheduler

An Home Assistant AddOn to schedule entities on/off on weekly base
183 stars 36 forks source link

SimpleScheduler

A Home Assistant AddOn to schedule switches, lights and other entities on a weekly base in a visual way without coding.\ You can keep all the schedules in one place and add/change them in a few clicks, even in your mobile app.

SimpleScheduler

Installation

Add the repository and then the addon by clicking on the badges:\ \ \ If something goes wrong, you can install it manually.\ You can add the URL of this page in your "add-on store" as a new repository:\ Settings > Add-ons > ADD-ON STORE button in bottom right corner > three dots in top right corner > Repositories\ Click Check for updates and you will find the add-on "Simple Scheduler" listed.

If you are not using a supervised installation, you can run the addon as a standalone docker. Take a look here: docker_install.MD

Type of scheduler

There are three kinds of schedulers:

"A picture is worth a thousand words", so if you take a look at the screenshot it will be even more clear.

How to use it

The add-on is very easy and intuitive (or, at least, that's what I hope)\ Once installed, open the GUI, click on the round plus button in the bottom right and choose your schedule type.\ Choose one or more entities from the dropdown, fill in the ON time (in 24-hour format with leading zero, as suggested) and select the weekdays. Do the same for the OFF time and click "save". That's it!

Advanced Feature

If you need more advanced features:

Look at the picture above to see all these things in action (and combined!).

Conditions

For each scheduler, you can add a condition that will be checked at the time of the execution. If the condition is 'true' the action will be performed and (obviously) it won't be executed if the condition is 'false'. The condition is a template expression that you can add in the "template" field. \ The condition is evaluated at every triggering time written in the scheduler before the execution. \ If the field is empty, no check will be performed and the action will always be executed. \ If you fill the field, two additional time fields will apper. This allows you to set on/off times when condition result is true and different on/off times when condition result is false. \ The template expression must return a boolean ('True' or 'False'). \ So be sure to "convert" switches, lights, and any other entity states to boolean. A few examples:

{{  states('switch.my_switch') | bool }}
{{  not states('light.my_light') | bool }}
{{  states('binary_sensor.workday) | bool }}
{{  states('sensor.room_temperature') | float > 23.5   }}
{{  is_state('person.my_kid', 'not_home')  }}
{{  states('sensor.room_temperature') | float > 23.5 and is_state('sun.sun', 'above_horizon')  }}

If the template returns 'on', 'open', 'home', 'armed', '1' and so on, they all will all be treated as 'False'. \ If the template expression has syntax errors it will be considered 'false', and it will be reported in the addon log.\ Use the template render utility in Developer Tools to test the condition before putting it into the scheduler.

Frontend switch to enable/disable (with MQTT)

If you want to enable/disable schedulers in frontend and/or automation, you can achieve that through MQTT. This feature is disabled by default because it requires a working MQTT server (broker) and Home Assistant MQTT integration. Take a look at the MQTT.MD file to know more.

Retry on unavailable

By default, SimpleScheduler will retry 3 times if an entity is unavailable. The first retry attempt happens after 5 seconds, then every minute. You can change the number of retries in the addon options. The valid range is 0 to 5.

Hidden scheduler details

When you have a lot of schedulers the view can become messy. As a default, all the scheduler details are hidden, so you can have a clear look. You can toggle the visibility with the eye icon near the scheduler name. If you prefer to have the entire schedule always visible, you can easily achieve that by enabling details_uncovered in the addon configuration

Dark theme

If you prefer a dark theme, you can activate it in the addon configuration by checking the option dark_theme

Translation

The default text language is English. They are very few words. If you want to translate them, you just need to take a look at the configuration section of the addon. Rewrite the words you would like to have in your language and restart the addon. For the weekdays, as you can easily understand, only the first two chars are used.

Two words about the stored data

Every schedule (or row, if you prefer) is a JSON file stored in the [share/simplescheduler] folder under the SAMBA share. This way the data can "survive" an addon upgrade or reinstallation. You can easily backup and restore them in case of failure. In the same way, you can (accidentally?) delete them. So be aware of that.

Log

The log file is stored in the same folder where the JSON files are stored [share/simplescheduler] You can delete it if it become too large, but be sure to stop the addon first. You can enable a verbose log by checking the box debug mode in the addon configuration. When enabled, the log file can easily become very large, so be sure to keep the debug mode on only the required time.

Last but not least

If you want to convince me to stay up at night to work on this, just buy me a beer 🍺 \ You may say that regular people need coffee to do that. Well, I'm not a regular person.