Rule to switch on Christmas Lights between 1. Advent and "Heilig Dreikönig"

Hi Volker,

as far as I can see your rule is doing the trick and should work fine.

However I’m a fan of seperating behaviors and try to follow that.

Hence I’m using multiple rules to do nearly the same as you:

rule "Weihnachtszeit"
when
	System started or
	Time is midnight
then
	val int year = now.getYear
	val int dayOfYear = now.getDayOfYear
	val int xmas_start = parse(year+"-12-24").getDayOfYear - parse(now.getYear+"-12-24").getDayOfWeek - 21
	val int xmas_end = parse(year+"-01-06").getDayOfYear

	if ((dayOfYear > xmas_start) || (dayOfYear < xmas_end))
		Zeit_Weihnachtszeit.postUpdate(ON)
	else
		Zeit_Weihnachtszeit.postUpdate(OFF)
end

rule "Weihnachtsbeleuchtung ein/aus"
when
	Item Tagesabschnitt changed to "BED" or
	Item Sonne_Phase changed to "SUN_SET"
then
	if (Zeit_Weihnachtszeit.state == ON) {
		if (Tagesabschnitt.state == "BED")
			Weihnachtsbeleuchtung.sendCommand(OFF)
		else if (Sonne_Phase.state == "SUN_SET")
			Weihnachtsbeleuchtung.sendCommand(ON)
	}
end

At every restart and midnight I check if we are between 1st Advent and 6th of Jan. If yes an item is set. Unset otherwise.

Second rule switches on lights at sunset and off when we go to bed (which is actually set at 10pm).

Regards,
Christian