I don’t like the ‘just use node-red’ answer. Is there no straightforward way to fire an automation at a set time on specific days and/or months? OpenHAB has had this capability for years. I like the progress HASS has made but am I missing something in not seeing a simple schedule capability?
Specific day or month isn’t bad although could be easier for sure. First add the time & date helper with the date option.
For specific date do this:
trigger:
platform: template
value_template: >-
{{ states('sensor.date')[-5:] == 'MM-DD' }}
For specific month do this:
trigger:
platform: template
value_template: >-
{{ states('sensor.date')[-5:-3] == 'MM' }}
For a custom schedule where you want an automation to trigger on particular days and times and you can build that schedule in the UI, use the new calendar trigger in 2022.5:
trigger:
- id: scheduled_event_started
platform: calendar
event: start
entity_id: calendar.schedule_calendar
- id: scheduled_event_ended
platform: calendar
event: end
entity_id: calendar.schedule_calendar
The only bummer is you’ll need to make this calendar in another service right now like google calendar or a service that supports caldav. But you should vote up my feature request for a local calendar option so we can make these schedules right in HA!
EDIT: Actually for the first two you don’t need the time and date helper. Can just do this:
trigger:
platform: template
value_template: >-
{{ now().month == <month> and now().day == <day> }}
Probably a better option since there’s no other dependency.
Does Simple Scheduler fit your needs?
You can use a time
trigger, using an input_datetime
entity set for a date and time.
You can use a time
trigger with a time
condition to limit it to certain days of the week.
You can even use a template
condition with whatever logic you want.
You can use a calendar integration along with the new calender
trigger.
There’s also the scheduler custom component.
That looks good. I’ll give it a spin this weekend. Thanks.