Automation via the ui: how to schedule the triggers for days of week and time?

For example, trigger this automaton every Monday, Thursday and Saturday at 2am for example. Thank you

Hi there, Scheduler card should work for this purpose, also may need to install the custom scheduler component. Please have a look at this

1 Like

I don’t see how I can add that to an automation. Excuse my ignorance

Edit: I think I get it. Make the trigger a blank (dummy switch) and then schedule that switch. Correct?

Hey, I’m not scheduling an enitity. I’m trying to schedule an automation. Can that be done?

You dont need to use the dummy switch but can trigger the automation by calling the automation.trigger service from the scheduler card. It should work. If that doesn’t work you can try dummy switch or even converting this automation to a script and calling that script.

With the Simple Scheduler you can directly call a service or script, whatever you want. So use he time / day to create a trigger and in the action either call a service (if you only need to do one thing) or call a script and have multiple actions in the script (if you need to do more things upon a trigger).

I don’t see this option

It’s basically the main screenshot you see in the Github repo…

In the add-on you click the bit + button to create a new schedule, then select the days of the week you want something to turn on / off and the time of day:

Using the Automation Editor, create a Time Trigger for 02:00:00

and a Time Condition for Monday, Thursday, and Saturday.

Finish by adding whatever Action you require.

19 Likes

Thank you. What if I needed it to run multiple times per day

02:00:00, 04:00:00, 13:00:00

Would that do it?

Many options here, lots overcomplicating.

For your specific instance, I would:
Set up new automation
trigger on time at 2am
conditions for time, monday, thursday, and saturday on and others off
Actions whatever you are wanting to automate

If you wanted a bit more flexible solution, you could use a date/time helper, expose that to the front end, then use that helper as the automation trigger.

You can also trigger an automation from another automation, but that is not recommended in this case (too complicated to track).

No, it will be rejected.

Easiest way in the Automation Editor is to add each time in a separate Time Trigger.


If you’re feeling adventurous, you can switch the Automation Editor from visual mode to YAML mode and then compose a single Time Trigger containing multiple times:

Screenshot from 2021-07-20 10-58-45

That’s valid and will work but if you switch the Automation Editor back to visual mode it won’t know how to display the multiple timers in the Time Trigger (it will show none of them).

To switch between the modes, click the overflow menu (three vertical dots) in the upper right hand corner of the Trigger pane (select ‘Edit in visual editor’ or ‘Edit in YAML’).

2 Likes

Add each of the desired times as a separate trigger.

Think of triggers as anything that "starts " the automation, conditions as anything that you want to prevent the automation from continuing (excluding certain days in this example), and actions as the result of a successful automation running with conditions being met.

1 Like

Amazing, Thanks for this. I work from home, and this worked great. I only wanted to make sure that all lights in the house are turned off by 9AM only during the week. I did not want to use a calendar for this. Triggers start at 9AM, but the conditions are Mon-Fri. If I needed various times for each day, options would be a good one to use. Loving it.

Amazing, Thanks for this. I work from home, and this worked great. I only wanted to make sure that all lights in the house are turned off by 9AM only during the week. I did not want to use a calendar for this. Triggers start at 9AM, but the conditions are Mon-Fri. If I needed various times for each day, options would be a good one to use. Loving it.

I know that this thread is a little old, but what would the most efficient way be to do exactly what you’re doing in the screenshot above, but to have the day of the week be a variable that the automation references, rather than something that’s hard coded into it?

For example, so that you can do exactly what you are doing, but have the condition picking up the day of the week from somewhere that’s set form a lovelace card.

It’s relatively simple with times as there is a time helper just for times, but as far as I can tell the date\time helper only lets you select a specific date, not a day of the week.

I think that I can do this from the schedule helper but I’d be interested to know if there is a neater way to do it, or if anyone has an example of it having been done that I can integrate into my own implementation.