I wanted to share my journey with using Ephemeris for a fun Christmas automation project. A few months back, I decided to create a rule that would automatically turn on a virtual switch named ‘Christmas Season’ on the first Advent Sunday. At first, I was a bit overwhelmed with how to properly utilize Ephemeris, but after some research and testing, I finally got it working!
Here’s the rule I came up with. It uses a cron expression to trigger on the first Advent Sunday:
javascript
var Ephemeris = Java.type(“org.openhab.core.model.script.actions.Ephemeris”);
if(Ephemeris.getBankHolidayName(0, “/etc/openhab/services/Holidays_de.xml”) == “FIRST_ADVENT”) {
items.getItem(“Christmas_Season”).sendCommand(“ON”)
}
Today was the big test, and it worked perfectly! The Christmas Season switch turned on, which in turn activated all my other Christmas-related automations. It’s such a neat way to kick off the holiday season without manually flipping any switches.
If anyone else is looking to incorporate holidays or specific dates into their automations, I highly recommend exploring Ephemeris. It opens up a lot of possibilities for seasonal or event-based automations. Happy automating everyone! ![]()
![]()