Hacky ICS Importer

Hi all. I’ve found myself wanting to import calendar events into home assistant calendars several times recently, so I created a pretty hacky way to do it. The process is based on an Apple Shortcut (should work on both iOS and Mac OS, I did it on Mac OS).

Link to the Shortcut

https://www.icloud.com/shortcuts/b7c1e25c58d143baa1282427cc7b0e55

Requirements

  1. The ability to convert an ics file to json via the web and copy and paste that information into the shortcut (I used: Free ICS to JSON Online Converter)
  2. Have the Home Assistant app installed on the device so the built in actions are available.

The Setup

Import the shortcut and set it up. There are several fields that the shortcut should prompt you to fill in:

  • The calendar entity to add events too (i.e. calendar.default)
  • The json-ized version of the ics file
  • The home assistant server

How It Works

  1. The shortcut converts the provided text to a dictionary and then loops over all the events (should work for just 1 event or many)
  2. The repeat formats the data as Home Assistant expects it and calls the Home Assistant calendar.create_event service.

Some Notes

  • This is for events that have a start and end time. Home Assistant has a different data payload
    structure for all day/multi-day events. There’s a comment in the repeat loop with how to adapt the shortcut for all day events.

Let me know if you have any questions or suggestions. If there’s interest I’d be happy to add/adjust features!

Wouldn’t a remote calendar with a “file://” url pointing to the ics work for you?

I get events from several sources via ics and want them in one calendar in home assistant. So maybe with some file merging magic, but this worked for me!