Using Home Assistant Local Calendar to Schedule Stuff!
Home Assistant added a local calendar to their list of integrations in December of 2022. In January, they made some updates that make it even more useful. Calendars don't usually get much love since they are so utilitarian. However, this calendar allows you to automate things easily so I thought I would take a quick look.
The local calendar is installed just like any other integration.
You can even have multiple calendars. Just keep adding them via the integrations page.
Once you add the calendar, you get to it from the Home Assistant sidebar.
The January update of the calendar adds some much-needed functionality. First, you can now edit events rather than having to delete them and re-add them. If you are also using an integrated Google calendar like I am, you can manage events in that calendar directly from Home Assistant as well. (You'll need to make sure your Google calendar has been integrated with the appropriate write permissions.)
As I mentioned, in addition to using the calendar as a, well, a calendar you can also set up alerts and automate things based on calendar events. For example, if you wanted to turn on a light every day at a specific time, or turn it on on Wed at 8 pm and off Wed at 10 pm, you can. Just create an event in your calendar and add this automation (borrowed from the Home Assistant calendar automation page). Of course, you'll need to update the calendar name to match yours as well as the light entity names.
automation:
- alias: Front Light Schedule
trigger:
- platform: calendar
event: start
entity_id: calendar.device_automation
- platform: calendar
event: end
entity_id: calendar.device_automation
condition:
- condition: template
value_template: "{{ 'Front Lights' in trigger.calendar_event.summary }}"
action:
- if:
- "{{ trigger.event == 'start' }}"
then:
- service: light.turn_on
entity_id: light.front
else:
- service: light.turn_off
entity_id: light.front
If you want to receive notifications, you would create an automation as well. This is what I use to send myself notifications of calendar events. This sends notifications to my mobile device that is running the Home Assistant companion app. You can modify the actions to suit your needs.
alias: Main Calendar Events
description: ""
trigger:
- platform: calendar
event: start
entity_id: calendar.main_calendar
condition: []
action:
- service: notify.mobile_app_sm_s906u1
data:
message: |-
{{ trigger.calendar_event.summary }} @
{{ trigger.calendar_event.start }}
data:
ttl: 0
priority: high
channel: calendaralerts
mode: queued
max: 10
As always, I go over this and more in my video so please take a moment and give it a watch! You can also subscribe to my channel easily with this link.