DOIF für "Social" Seasons (zB Weihnachtszeit, Osterzeit, Karneval etc.)

Begonnen von Loredo, 07 November 2015, 17:46:24

Vorheriges Thema - Nächstes Thema

Loredo

Die Weihnachtszeit ist ja gerade großes Thema wie es scheint. Ich hatte mir dazu auch Gedanken gemacht und wollte das etwas allumfänglicher über ein DOIF für alle möglichen Zeiten im Jahr definieren.

Ziel sollte es sein damit z.B. Beleuchtungen unterschiedlich zu steuern (z.B. Farben je nach "sozialer Jahreszeit", also ähnlich wie wenn man regelmäßig den Tischschmuck abändert). Aber auch eine simple Anzeige bei mir in der Umweltkontrolle finde ich recht schön  (zusammen mit der eigentlichen Jahreszeit und der Sommer-/Normalzeit).

Dieses DOIF konnte ich noch nicht vollständig auf Herz und Nieren testen, da man mehr oder weniger bis zum entsprechenden Tag warten müsste (oder die Definitionen abändern muss, damit sie eben heute schon zutreffen oder sie erst in Debug-Perl-Funktionen einbauen muss, um sie einmalig zu testen).

Folgende Events/Zeitspannen sollen hier abgedeckt werden:

       
  • Valentinstag (14. Feb)
  • Karneval + Valentinstag am selben Tag (14. Feb)
  • Karneval (Rosenmontag + Faschingsdienstag)
  • Karnevalszeit (gemeint ist die "Hochzeit" ab Donnerstag bis Sonntag vor Aschermittwoch)
  • Fastenzeit / Starkbierzeit (Aschermittwoch bis Karfreitag)
  • Osterzeit (Ostersamstag bis 29. April)
  • Maifeiertage / Tanz in den Mai (30. April und 1. Mai)
  • Pfingsttage (Samstag bis Montag)
  • Oktoberfest-/Wiesnzeit (erster Samstag nach dem 15.9. für 3 Wochen)
  • Erntedankfest (erster Sonntag im Oktober, auch letzter Wiesntag)
  • Halloween Woche (24.10.-30.10.)
  • Halloween (31.10.+1.11.)
  • St. Martin (11.11.)
  • Advents- und Weihnachtszeit (1. Advent bis 30.12.)
  • Jahreswechsel (31.12. und 1.1.)

define SocialSeason DOIF

## Carnival: Carnival Mon/Tue and Valentine's Day at the same day
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;
  my $carnivalTue = $carnivalMon + 86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);

  [00:00] and
  $mon eq 1 and
  $mday eq 14 and
  ($mday eq $mdayB or $mday eq $mdayE)
)

## Valentine's Day
(
  [00:00] and
  $mon eq 1 and
  $mday eq 14
)

## Carnival: Mon+Tue
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;
  my $carnivalTue = $carnivalMon + 86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);


  [00:00] and
  ($mday eq $mdayB or $mday eq $mdayE)
)

## Carnival: Thursday before Ash Wednesday until day before Ash Wednesday w/o Valentine's Day
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalEnd = str2time("$year-$monEaster-$mdayEaster") - 46*86400;
  my $carnivalStart = $carnivalEnd - 5*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalStart);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) or
  ($mon eq $monE and $mday le $mdayE)
)

## Fasting/Strong-Beer Time: Ash Wednesday until Good Friday
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $fastEnd = str2time("$year-$monEaster-$mdayEaster") - 2*86400;
  my $fastStart = $fastEnd - 43*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($fastStart);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($fastEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Easter Time: Starts Easter Saturday, ends Apr 29th
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monB, $mdayB) = western_easter($year);
  my $easterTimeBegin = $mdayB - 1;

  [00:00] and
  ($mon eq $monB and $mday ge $easterTimeBegin) or
  ($mon eq 3 and $mday ge 25 and $mday le 29)
)

## May Festival: Apr 30th and May 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 3 and $mday eq 30) or
  ($mon eq 4 and $mday eq 1)
)

## Pentecost: Saturday til Monday
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $pentecostSat = str2time("$year-$monEaster-$mdayEaster") + 48*86400;
  my $pentecostMon = $pentecostSat + 2*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($pentecostSat);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($pentecostMon);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Oktoberfest: Saturday after Sept 15th for 3 weeks
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my $midSept = str2time("$year-09-15");
  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);
  if ($wdayS eq 6) {
    $wdayS = 7;
  } elsif ($wdayS eq 0) {
    $wdayS = 6;
  } elsif ($wdayS eq 1) {
    $wdayS = 5;
  } elsif ($wdayS eq 2) {
    $wdayS = 4;
  } elsif ($wdayS eq 3) {
    $wdayS = 3;
  } elsif ($wdayS eq 4) {
    $wdayS = 2;
  } elsif ($wdayS eq 5) {
    $wdayS = 1;
  }
  my $wiesnBegin = $midSept + $wdayS*86400;
  my $wiesnEnd = $wiesnBegin + 21*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Harvest festival: 1st sunday in Oct
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  [00:00] and
  $mon eq 9 and
  $mday le 7 and
  $wday eq 0
)

## Halloween Week: Oct 24th until Otc 30th
DOELSEIF
(
  [00:00] and
  $mon eq 9 and
  $mday ge 24 and
  $mday le 30
)

## Halloween: Oct 31th and Nov 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 9 and $mday eq 31) or
  ($mon eq 10 and $mday eq 1)
)

## St. Martin's Day: Nov 11th
DOELSEIF
(
  [00:00] and
  ($mon eq 10 and $mday eq 11)
)

## Christmas time: Starts 1st Advent, ends Dec 30th
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my $christmas = str2time("$year-12-25");
  my ( $secC, $minC, $hourC, $mdayC, $monC, $yearC, $wdayC, $ydayC, $isdstC ) = localtime($christmas);
  $wdayC = $wdayC ? $wdayC : 7;
  my $adventBegin = $christmas - ($wdayC+21)*86400;
  my ( $sec2, $min2, $hour2, $mday2, $mon2, $year2, $wday2, $yday2, $isdst2 ) = localtime($adventBegin);

  [00:00] and
  ($mon eq $mon2 and $mday ge $mday2) or
  ($mon eq 11 and $mday le 30)
)

## New Year: Dec 31st and Jan 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 11 and $mday eq 31) or
  ($mon eq 0 and $mday eq 1)
)

DOELSE


Folgende Attribute wurden gesetzt:

attr SocialSeason alias Social Season
attr SocialSeason cmdState carnivalvalentine|valentine|carnival|carnivalweek|fasting|easter|may|pentecost|wiesn|harvest|halloweenweek|halloween|stmartin|christmas|newyear|none
attr SocialSeason event-on-change-reading state
attr SocialSeason eventMap valentine:Valentinstag carnivalvalentine:Karneval-und-Valentinstag carnivalweek:Faschingszeit carnival:Karneval fasting:Fastenzeit easter:Osterzeit may:Tanz-in-den-Mai pentecost:Pfingsten wiesn:Wiesn harves:Erntedankfest halloweenweek:Halloween-Woche halloween:Halloween stmartin:St.Martin christmas:Weihnachtszeit newyear:Jahreswechsel none:keine initialized:---
attr SocialSeason group Season Details
attr SocialSeason room Environment
Hat meine Arbeit dir geholfen? ⟹ https://paypal.me/pools/c/8gDLrIWrG9

Maintainer:
FHEM-Docker Image, https://github.com/fhem, Astro(Co-Maintainer), ENIGMA2, GEOFANCY, GUEST, HP1000, Installer, LaMetric2, MSG, msgConfig, npmjs, PET, PHTV, Pushover, RESIDENTS, ROOMMATE, search, THINKINGCLEANER

Rince

Holla zack,
Da hat wer nicht gekleckert, sondern geklotzt.

Wenn mein fhem wieder am Leben ist, probiere ich das gerne aus :)
Wer zu meinen Posts eine Frage schreibt und auf eine Antwort wartet, ist hiermit herzlich eingeladen mich per PN darauf aufmerksam zu machen. (Bitte mit Link zum betreffenden Thread)

inesa394

Wollte das mal testen bekomme
diese Fehlermeldung
SocialSeason DOIF: no right bracket: (use 95_holiday
fehlt wohl irgendwo eine Klammer

kumue

vermute, Du hast den ganzen Code in den DEF-Editor eingegeben...
Falls ja, dann bitte die erste Zeile im DEF-Editor löschen.

define SocialSeason DOIF

inesa394

Ja habe ich komplett so eingegeben...ich soll
also ab ( use 95_holiday;
aber da weiss ja fhem nicht das es sich um ein doif handelt???
oder habe ich das jetzt falsch verstanden

Loredo

Du legst erst ein leeres DOIF AN:


define SocialSeason DOIF ([d])




Danach editierst du das neue DOIF, löscht den Inhalt dort raus und kopierst den Inhalt von oben hinein. Dabei lässt du dann die erste Zeile weg.
Hat meine Arbeit dir geholfen? ⟹ https://paypal.me/pools/c/8gDLrIWrG9

Maintainer:
FHEM-Docker Image, https://github.com/fhem, Astro(Co-Maintainer), ENIGMA2, GEOFANCY, GUEST, HP1000, Installer, LaMetric2, MSG, msgConfig, npmjs, PET, PHTV, Pushover, RESIDENTS, ROOMMATE, search, THINKINGCLEANER

inesa394


McCavity

Moin,

erstmal vielen Dank für das DOIF - ich habe noch zwei Fragen dazu. Ich konnte es problemlos mit der hier empfohlenen Vorgehensweise einrichten ("leeres" DOIF anlegen und im Anschluß die DEF mit dem hier geposteten Inhalt ersetzen) - FHEM ist zufrieden. Fast. Denn wenn das DOIF ausgeführt wird (ein paar Sekunden nach Mitternacht), gibt es in meinem Logfile jede Menge Perl Warnungen:

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   DOIF_time_once($hash,$hash->{timer}{8},$wday,"") and  $mon eq 9 and  $mday ge 24 and  $mday le 30: Global symbol "$mon" requires explicit package name at (eval 25003) line 1.

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   DOIF_time_once($hash,$hash->{timer}{4},$wday,"") and  ($mon eq 3 and $mday eq 30) or  ($mon eq 4 and $mday eq 1): Global symbol "$mon" requires explicit package name at (eval 25006) line 1.
Global symbol "$mon" requires explicit package name at (eval 25006) line 1.

2015.11.27 00:00:04 1: PERL WARNING: Misplaced _ in number at (eval 25007) line 1.
2015.11.27 00:00:04 1: PERL WARNING: Bareword found where operator expected at (eval 25007) line 1, near "95_holiday"
2015.11.27 00:00:04 1: PERL WARNING: (Missing operator before holiday?)
2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $fastEnd = str2time("$year-$monEaster-$mdayEaster") - 2*86400;  my $fastStart = $fastEnd - 43*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($fastStart);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($fastEnd);  DOIF_time_once($hash,$hash->{timer}{2},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE): syntax error at (eval 25007) line 1, near "use 95_"

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   DOIF_time_once($hash,$hash->{timer}{12},$wday,"") and  ($mon eq 11 and $mday eq 31) or  ($mon eq 0 and $mday eq 1): Global symbol "$mon" requires explicit package name at (eval 25008) line 1.
Global symbol "$mon" requires explicit package name at (eval 25008) line 1.

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   DOIF_time_once($hash,$hash->{timer}{9},$wday,"") and  ($mon eq 9 and $mday eq 31) or  ($mon eq 10 and $mday eq 1): Global symbol "$mon" requires explicit package name at (eval 25009) line 1.
Global symbol "$mon" requires explicit package name at (eval 25009) line 1.

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   DOIF_time_once($hash,$hash->{timer}{10},$wday,"") and  ($mon eq 10 and $mday eq 11): Global symbol "$mon" requires explicit package name at (eval 25010) line 1.

2015.11.27 00:00:04 1: PERL WARNING: Misplaced _ in number at (eval 25011) line 1.
2015.11.27 00:00:04 1: PERL WARNING: Bareword found where operator expected at (eval 25011) line 1, near "95_holiday"
2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;  my $carnivalTue = $carnivalMon + 86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);  DOIF_time_once($hash,$hash->{timer}{0},$wday,"") and  $mon eq 1 and  $mday eq 14 and  ($mday eq $mdayB or $mday eq $mdayE): syntax error at (eval 25011) line 1, near "use 95_"

2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my $christmas = str2time("$year-12-25");  my ( $secC, $minC, $hourC, $mdayC, $monC, $yearC, $wdayC, $ydayC, $isdstC ) = localtime($christmas);  $wdayC = $wdayC ? $wdayC : 7;  my $adventBegin = $christmas - ($wdayC+21)*86400;  my ( $sec2, $min2, $hour2, $mday2, $mon2, $year2, $wday2, $yday2, $isdst2 ) = localtime($adventBegin);  DOIF_time_once($hash,$hash->{timer}{11},$wday,"") and  ($mon eq $mon2 and $mday ge $mday2) or  ($mon eq 11 and $mday le 30): Undefined subroutine &main::str2time called at (eval 25012) line 1.

2015.11.27 00:00:04 1: PERL WARNING: Misplaced _ in number at (eval 25014) line 1.
2015.11.27 00:00:04 1: PERL WARNING: Bareword found where operator expected at (eval 25014) line 1, near "95_holiday"
2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $carnivalEnd = str2time("$year-$monEaster-$mdayEaster") - 46*86400;  my $carnivalStart = $carnivalEnd - 5*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalStart);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalEnd);  DOIF_time_once($hash,$hash->{timer}{1},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) or  ($mon eq $monE and $mday le $mdayE): syntax error at (eval 25014) line 1, near "use 95_"

2015.11.27 00:00:04 1: PERL WARNING: Misplaced _ in number at (eval 25015) line 1.
2015.11.27 00:00:04 1: PERL WARNING: Bareword found where operator expected at (eval 25015) line 1, near "95_holiday"
2015.11.27 00:00:04 2: SocialSeason: perl error in condition:   use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $pentecostSat = str2time("$year-$monEaster-$mdayEaster") + 48*86400;  my $pentecostMon = $pentecostSat + 2*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($pentecostSat);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($pentecostMon);  DOIF_time_once($hash,$hash->{timer}{5},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE): syntax error at (eval 25015) line 1, near "use 95_"

2015.11.27 00:00:05 1: PERL WARNING: Misplaced _ in number at (eval 25017) line 1.
2015.11.27 00:00:05 1: PERL WARNING: Bareword found where operator expected at (eval 25017) line 1, near "95_holiday"
2015.11.27 00:00:05 2: SocialSeason: perl error in condition:   use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monB, $mdayB) = western_easter($year);  my $easterTimeBegin = $mdayB - 1;  DOIF_time_once($hash,$hash->{timer}{3},$wday,"") and  ($mon eq $monB and $mday ge $easterTimeBegin) or  ($mon eq 3 and $mday ge 25 and $mday le 29): syntax error at (eval 25017) line 1, near "use 95_"

2015.11.27 00:00:05 2: SocialSeason: perl error in condition:   my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my $midSept = str2time("$year-09-15");  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);  if ($wdayS eq 6) {    $wdayS = 7;  } elsif ($wdayS eq 0) {    $wdayS = 6;  } elsif ($wdayS eq 1) {    $wdayS = 5;  } elsif ($wdayS eq 2) {    $wdayS = 4;  } elsif ($wdayS eq 3) {    $wdayS = 3;  } elsif ($wdayS eq 4) {    $wdayS = 2;  } elsif ($wdayS eq 5) {    $wdayS = 1;  }  my $wiesnBegin = $midSept + $wdayS*86400;  my $wiesnEnd = $wiesnBegin + 21*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);  DOIF_time_once($hash,$hash->{timer}{6},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE): Undefined subroutine &main::str2time called at (eval 25019) line 1.


Es sieht so aus, als störe ihn überwiegend das "use 95_holiday" - kann es sein, daß da trotz Einfügen in das "DEF" Feld etwas mit der Enkapsulierung der Sonderzeichen nicht stimmt? Der letzte dieser Fehler findet sich dann auch im Reading "error" des Devices:

Internals:
   DEF        ## Carnival: Carnival Mon/Tue and Valentine's Day at the same day
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;
  my $carnivalTue = $carnivalMon + 86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);

  [00:00] and
  $mon eq 1 and
  $mday eq 14 and
  ($mday eq $mdayB or $mday eq $mdayE)
)

## Valentine's Day
(
  [00:00] and
  $mon eq 1 and
  $mday eq 14
)

## Carnival: Mon+Tue
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;
  my $carnivalTue = $carnivalMon + 86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);


  [00:00] and
  ($mday eq $mdayB or $mday eq $mdayE)
)

## Carnival: Thursday before Ash Wednesday until day before Ash Wednesday w/o Valentine's Day
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $carnivalEnd = str2time("$year-$monEaster-$mdayEaster") - 46*86400;
  my $carnivalStart = $carnivalEnd - 5*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalStart);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) or
  ($mon eq $monE and $mday le $mdayE)
)

## Fasting/Strong-Beer Time: Ash Wednesday until Good Friday
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $fastEnd = str2time("$year-$monEaster-$mdayEaster") - 2*86400;
  my $fastStart = $fastEnd - 43*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($fastStart);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($fastEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Easter Time: Starts Easter Saturday, ends Apr 29th
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monB, $mdayB) = western_easter($year);
  my $easterTimeBegin = $mdayB - 1;

  [00:00] and
  ($mon eq $monB and $mday ge $easterTimeBegin) or
  ($mon eq 3 and $mday ge 25 and $mday le 29)
)

## May Festival: Apr 30th and May 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 3 and $mday eq 30) or
  ($mon eq 4 and $mday eq 1)
)

## Pentecost: Saturday til Monday
DOELSEIF
(
  use 95_holiday;
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my ( $monEaster, $mdayEaster) = western_easter($year);
  my $pentecostSat = str2time("$year-$monEaster-$mdayEaster") + 48*86400;
  my $pentecostMon = $pentecostSat + 2*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($pentecostSat);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($pentecostMon);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Oktoberfest: Saturday after Sept 15th for 3 weeks
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my $midSept = str2time("$year-09-15");
  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);
  if ($wdayS eq 6) {
    $wdayS = 7;
  } elsif ($wdayS eq 0) {
    $wdayS = 6;
  } elsif ($wdayS eq 1) {
    $wdayS = 5;
  } elsif ($wdayS eq 2) {
    $wdayS = 4;
  } elsif ($wdayS eq 3) {
    $wdayS = 3;
  } elsif ($wdayS eq 4) {
    $wdayS = 2;
  } elsif ($wdayS eq 5) {
    $wdayS = 1;
  }
  my $wiesnBegin = $midSept + $wdayS*86400;
  my $wiesnEnd = $wiesnBegin + 21*86400;
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);

  [00:00] and
  ($mon eq $monB and $mday ge $mdayB) and
  ($mon eq $monE and $mday le $mdayE)
)

## Harvest festival: 1st sunday in Oct
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  [00:00] and
  $mon eq 9 and
  $mday le 7 and
  $wday eq 0
)

## Halloween Week: Oct 24th until Otc 30th
DOELSEIF
(
  [00:00] and
  $mon eq 9 and
  $mday ge 24 and
  $mday le 30
)

## Halloween: Oct 31th and Nov 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 9 and $mday eq 31) or
  ($mon eq 10 and $mday eq 1)
)

## St. Martin's Day: Nov 11th
DOELSEIF
(
  [00:00] and
  ($mon eq 10 and $mday eq 11)
)

## Christmas time: Starts 1st Advent, ends Dec 30th
DOELSEIF
(
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
  $year += 1900;
  my $christmas = str2time("$year-12-25");
  my ( $secC, $minC, $hourC, $mdayC, $monC, $yearC, $wdayC, $ydayC, $isdstC ) = localtime($christmas);
  $wdayC = $wdayC ? $wdayC : 7;
  my $adventBegin = $christmas - ($wdayC+21)*86400;
  my ( $sec2, $min2, $hour2, $mday2, $mon2, $year2, $wday2, $yday2, $isdst2 ) = localtime($adventBegin);

  [00:00] and
  ($mon eq $mon2 and $mday ge $mday2) or
  ($mon eq 11 and $mday le 30)
)

## New Year: Dec 31st and Jan 1st
DOELSEIF
(
  [00:00] and
  ($mon eq 11 and $mday eq 31) or
  ($mon eq 0 and $mday eq 1)
)

DOELSE
   NAME       SocialSeason
   NR         577
   NTFY_ORDER 50-SocialSeason
   STATE      Weihnachtszeit
   TYPE       DOIF
   Readings:
     2015-11-27 00:00:04   cmd_event       timer_8
     2015-11-27 00:00:04   cmd_nr          14
     2015-11-27 00:00:05   error           perl error in condition:   my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my $midSept = str2time("$year-09-15");  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);  if ($wdayS eq 6) {    $wdayS = 7;  } elsif ($wdayS eq 0) {    $wdayS = 6;  } elsif ($wdayS eq 1) {    $wdayS = 5;  } elsif ($wdayS eq 2) {    $wdayS = 4;  } elsif ($wdayS eq 3) {    $wdayS = 3;  } elsif ($wdayS eq 4) {    $wdayS = 2;  } elsif ($wdayS eq 5) {    $wdayS = 1;  }  my $wiesnBegin = $midSept + $wdayS*86400;  my $wiesnEnd = $wiesnBegin + 21*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);  DOIF_time_once($hash,$hash->{timer}{6},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE): Undefined subroutine &main::str2time called at (eval 25019) line 1.
     2015-11-27 00:00:04   state           christmas
     2015-11-27 09:12:15   timer_10_c10    28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_11_c11    28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_12_c12    28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_13_c13    28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_1_c1      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_2_c2      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_3_c3      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_4_c4      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_5_c5      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_6_c6      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_7_c7      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_8_c8      28.11.2015 00:00:00
     2015-11-27 09:12:15   timer_9_c9      28.11.2015 00:00:00
   Condition:
     0            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;  my $carnivalTue = $carnivalMon + 86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);  DOIF_time_once($hash,$hash->{timer}{0},$wday,"") and  $mon eq 1 and  $mday eq 14 and  ($mday eq $mdayB or $mday eq $mdayE)
     1            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $carnivalEnd = str2time("$year-$monEaster-$mdayEaster") - 46*86400;  my $carnivalStart = $carnivalEnd - 5*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalStart);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalEnd);  DOIF_time_once($hash,$hash->{timer}{1},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) or  ($mon eq $monE and $mday le $mdayE)
     10           DOIF_time_once($hash,$hash->{timer}{10},$wday,"") and  ($mon eq 10 and $mday eq 11)
     11           my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my $christmas = str2time("$year-12-25");  my ( $secC, $minC, $hourC, $mdayC, $monC, $yearC, $wdayC, $ydayC, $isdstC ) = localtime($christmas);  $wdayC = $wdayC ? $wdayC : 7;  my $adventBegin = $christmas - ($wdayC+21)*86400;  my ( $sec2, $min2, $hour2, $mday2, $mon2, $year2, $wday2, $yday2, $isdst2 ) = localtime($adventBegin);  DOIF_time_once($hash,$hash->{timer}{11},$wday,"") and  ($mon eq $mon2 and $mday ge $mday2) or  ($mon eq 11 and $mday le 30)
     12           DOIF_time_once($hash,$hash->{timer}{12},$wday,"") and  ($mon eq 11 and $mday eq 31) or  ($mon eq 0 and $mday eq 1)
     2            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $fastEnd = str2time("$year-$monEaster-$mdayEaster") - 2*86400;  my $fastStart = $fastEnd - 43*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($fastStart);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($fastEnd);  DOIF_time_once($hash,$hash->{timer}{2},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE)
     3            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monB, $mdayB) = western_easter($year);  my $easterTimeBegin = $mdayB - 1;  DOIF_time_once($hash,$hash->{timer}{3},$wday,"") and  ($mon eq $monB and $mday ge $easterTimeBegin) or  ($mon eq 3 and $mday ge 25 and $mday le 29)
     4            DOIF_time_once($hash,$hash->{timer}{4},$wday,"") and  ($mon eq 3 and $mday eq 30) or  ($mon eq 4 and $mday eq 1)
     5            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $pentecostSat = str2time("$year-$monEaster-$mdayEaster") + 48*86400;  my $pentecostMon = $pentecostSat + 2*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($pentecostSat);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($pentecostMon);  DOIF_time_once($hash,$hash->{timer}{5},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE)
     6            my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my $midSept = str2time("$year-09-15");  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);  if ($wdayS eq 6) {    $wdayS = 7;  } elsif ($wdayS eq 0) {    $wdayS = 6;  } elsif ($wdayS eq 1) {    $wdayS = 5;  } elsif ($wdayS eq 2) {    $wdayS = 4;  } elsif ($wdayS eq 3) {    $wdayS = 3;  } elsif ($wdayS eq 4) {    $wdayS = 2;  } elsif ($wdayS eq 5) {    $wdayS = 1;  }  my $wiesnBegin = $midSept + $wdayS*86400;  my $wiesnEnd = $wiesnBegin + 21*86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);  DOIF_time_once($hash,$hash->{timer}{6},$wday,"") and  ($mon eq $monB and $mday ge $mdayB) and  ($mon eq $monE and $mday le $mdayE)
     7            my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  DOIF_time_once($hash,$hash->{timer}{7},$wday,"") and  $mon eq 9 and  $mday le 7 and  $wday eq 0
     8            DOIF_time_once($hash,$hash->{timer}{8},$wday,"") and  $mon eq 9 and  $mday ge 24 and  $mday le 30
     9            DOIF_time_once($hash,$hash->{timer}{9},$wday,"") and  ($mon eq 9 and $mday eq 31) or  ($mon eq 10 and $mday eq 1)
   Days:
   Devices:
   Do:
     0:
       0            [00:00] and  $mon eq 1 and  $mday eq 14
       1            use 95_holiday;  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);  $year += 1900;  my ( $monEaster, $mdayEaster) = western_easter($year);  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;  my $carnivalTue = $carnivalMon + 86400;  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);  [00:00] and  ($mday eq $mdayB or $mday eq $mdayE)
     1:
       0
     10:
       0
     11:
       0
     12:
       0
     13:
       0
     2:
       0
     3:
       0
     4:
       0
     5:
       0
     6:
       0
     7:
       0
     8:
       0
     9:
       0
   Helper:
     globalinit 1
     last_timer 13
     sleeptimer -1
   Itimer:
   Realtime:
     0          00:00:00
     1          00:00:00
     10         00:00:00
     11         00:00:00
     12         00:00:00
     2          00:00:00
     3          00:00:00
     4          00:00:00
     5          00:00:00
     6          00:00:00
     7          00:00:00
     8          00:00:00
     9          00:00:00
   State:
   Time:
     0          00:00:00
     1          00:00:00
     10         00:00:00
     11         00:00:00
     12         00:00:00
     2          00:00:00
     3          00:00:00
     4          00:00:00
     5          00:00:00
     6          00:00:00
     7          00:00:00
     8          00:00:00
     9          00:00:00
   Timecond:
     0          0
     1          1
     10         10
     11         11
     12         12
     2          2
     3          3
     4          4
     5          5
     6          6
     7          7
     8          8
     9          9
   Timer:
     0          0
     1          0
     10         0
     11         0
     12         0
     2          0
     3          0
     4          0
     5          0
     6          0
     7          0
     8          0
     9          0
   Timerfunc:
   Timers:
     0           0
     1           1
     10          10
     11          11
     12          12
     2           2
     3           3
     4           4
     5           5
     6           6
     7           7
     8           8
     9           9
Attributes:
   alias      Social Season
   cmdState   carnivalvalentine|valentine|carnival|carnivalweek|fasting|easter|may|pentecost|wiesn|harvest|halloweenweek|halloween|stmartin|christmas|newyear|none
   event-on-change-reading state
   eventMap   valentine:Valentinstag carnivalvalentine:Karneval-und-Valentinstag carnivalweek:Faschingszeit carnival:Karneval fasting:Fastenzeit easter:Osterzeit may:Tanz-in-den-Mai pentecost:Pfingsten wiesn:Wiesn harvest:Erntedankfest halloweenweek:Halloween-Woche halloween:Halloween stmartin:St.Martin christmas:Weihnachtszeit newyear:Jahreswechsel none:keine initialized:---
   group      Season Details
   room       Aussen


Hier zum Vergleich noch einmal das, was FHEM in die fhem.cgf geschrieben hat:

define SocialSeason DOIF ## Carnival: Carnival Mon/Tue and Valentine's Day at the same day\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monEaster, $mdayEaster) = western_easter($year);;\
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;;\
  my $carnivalTue = $carnivalMon + 86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);;\
\
  [00:00] and\
  $mon eq 1 and\
  $mday eq 14 and\
  ($mday eq $mdayB or $mday eq $mdayE)\
)\
\
## Valentine's Day\
(\
  [00:00] and\
  $mon eq 1 and\
  $mday eq 14\
)\
\
## Carnival: Mon+Tue\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monEaster, $mdayEaster) = western_easter($year);;\
  my $carnivalMon = str2time("$year-$monEaster-$mdayEaster") - 47*86400;;\
  my $carnivalTue = $carnivalMon + 86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalMon);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalTue);;\
\
\
  [00:00] and\
  ($mday eq $mdayB or $mday eq $mdayE)\
)\
\
## Carnival: Thursday before Ash Wednesday until day before Ash Wednesday w/o Valentine's Day\
DOELSEIF\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monEaster, $mdayEaster) = western_easter($year);;\
  my $carnivalEnd = str2time("$year-$monEaster-$mdayEaster") - 46*86400;;\
  my $carnivalStart = $carnivalEnd - 5*86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($carnivalStart);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($carnivalEnd);;\
\
  [00:00] and\
  ($mon eq $monB and $mday ge $mdayB) or\
  ($mon eq $monE and $mday le $mdayE)\
)\
\
## Fasting/Strong-Beer Time: Ash Wednesday until Good Friday\
DOELSEIF\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monEaster, $mdayEaster) = western_easter($year);;\
  my $fastEnd = str2time("$year-$monEaster-$mdayEaster") - 2*86400;;\
  my $fastStart = $fastEnd - 43*86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($fastStart);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($fastEnd);;\
\
  [00:00] and\
  ($mon eq $monB and $mday ge $mdayB) and\
  ($mon eq $monE and $mday le $mdayE)\
)\
\
## Easter Time: Starts Easter Saturday, ends Apr 29th\
DOELSEIF\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monB, $mdayB) = western_easter($year);;\
  my $easterTimeBegin = $mdayB - 1;;\
\
  [00:00] and\
  ($mon eq $monB and $mday ge $easterTimeBegin) or\
  ($mon eq 3 and $mday ge 25 and $mday le 29)\
)\
\
## May Festival: Apr 30th and May 1st\
DOELSEIF\
(\
  [00:00] and\
  ($mon eq 3 and $mday eq 30) or\
  ($mon eq 4 and $mday eq 1)\
)\
\
## Pentecost: Saturday til Monday\
DOELSEIF\
(\
  use 95_holiday;;\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my ( $monEaster, $mdayEaster) = western_easter($year);;\
  my $pentecostSat = str2time("$year-$monEaster-$mdayEaster") + 48*86400;;\
  my $pentecostMon = $pentecostSat + 2*86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($pentecostSat);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($pentecostMon);;\
\
  [00:00] and\
  ($mon eq $monB and $mday ge $mdayB) and\
  ($mon eq $monE and $mday le $mdayE)\
)\
\
## Oktoberfest: Saturday after Sept 15th for 3 weeks\
DOELSEIF\
(\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my $midSept = str2time("$year-09-15");;\
  my ( $secS, $minS, $hourS, $mdayS, $monS, $yearS, $wdayS, $ydayS, $isdstS ) = localtime($midSept);;\
  if ($wdayS eq 6) {\
    $wdayS = 7;;\
  } elsif ($wdayS eq 0) {\
    $wdayS = 6;;\
  } elsif ($wdayS eq 1) {\
    $wdayS = 5;;\
  } elsif ($wdayS eq 2) {\
    $wdayS = 4;;\
  } elsif ($wdayS eq 3) {\
    $wdayS = 3;;\
  } elsif ($wdayS eq 4) {\
    $wdayS = 2;;\
  } elsif ($wdayS eq 5) {\
    $wdayS = 1;;\
  }\
  my $wiesnBegin = $midSept + $wdayS*86400;;\
  my $wiesnEnd = $wiesnBegin + 21*86400;;\
  my ( $secB, $minB, $hourB, $mdayB, $monB, $yearB, $wdayB, $ydayB, $isdstB ) = localtime($wiesnBegin);;\
  my ( $secE, $minE, $hourE, $mdayE, $monE, $yearE, $wdayE, $ydayE, $isdstE ) = localtime($wiesnEnd);;\
\
  [00:00] and\
  ($mon eq $monB and $mday ge $mdayB) and\
  ($mon eq $monE and $mday le $mdayE)\
)\
\
## Harvest festival: 1st sunday in Oct\
DOELSEIF\
(\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  [00:00] and\
  $mon eq 9 and\
  $mday le 7 and\
  $wday eq 0\
)\
\
## Halloween Week: Oct 24th until Otc 30th\
DOELSEIF\
(\
  [00:00] and\
  $mon eq 9 and\
  $mday ge 24 and\
  $mday le 30\
)\
\
## Halloween: Oct 31th and Nov 1st\
DOELSEIF\
(\
  [00:00] and\
  ($mon eq 9 and $mday eq 31) or\
  ($mon eq 10 and $mday eq 1)\
)\
\
## St. Martin's Day: Nov 11th\
DOELSEIF\
(\
  [00:00] and\
  ($mon eq 10 and $mday eq 11)\
)\
\
## Christmas time: Starts 1st Advent, ends Dec 30th\
DOELSEIF\
(\
  my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);;\
  $year += 1900;;\
  my $christmas = str2time("$year-12-25");;\
  my ( $secC, $minC, $hourC, $mdayC, $monC, $yearC, $wdayC, $ydayC, $isdstC ) = localtime($christmas);;\
  $wdayC = $wdayC ? $wdayC : 7;;\
  my $adventBegin = $christmas - ($wdayC+21)*86400;;\
  my ( $sec2, $min2, $hour2, $mday2, $mon2, $year2, $wday2, $yday2, $isdst2 ) = localtime($adventBegin);;\
\
  [00:00] and\
  ($mon eq $mon2 and $mday ge $mday2) or\
  ($mon eq 11 and $mday le 30)\
)\
\
## New Year: Dec 31st and Jan 1st\
DOELSEIF\
(\
  [00:00] and\
  ($mon eq 11 and $mday eq 31) or\
  ($mon eq 0 and $mday eq 1)\
)\
\
DOELSE
attr SocialSeason alias Social Season
attr SocialSeason cmdState carnivalvalentine|valentine|carnival|carnivalweek|fasting|easter|may|pentecost|wiesn|harvest|halloweenweek|halloween|stmartin|christmas|newyear|none
attr SocialSeason event-on-change-reading state
attr SocialSeason eventMap valentine:Valentinstag carnivalvalentine:Karneval-und-Valentinstag carnivalweek:Faschingszeit carnival:Karneval fasting:Fastenzeit easter:Osterzeit may:Tanz-in-den-Mai pentecost:Pfingsten wiesn:Wiesn harvest:Erntedankfest halloweenweek:Halloween-Woche halloween:Halloween stmartin:St.Martin christmas:Weihnachtszeit newyear:Jahreswechsel none:keine initialized:---
attr SocialSeason group Season Details
attr SocialSeason room Aussen


Und noch eine weitere Frage: Das DOIF hat bei mir schon den STATE "Weihnachtszeit" (siehe auch Ausgabe des "list" Kommandos in der Mitte) - dabei ist der erste Advent doch erst am Wochenende und auch der Timer zeigt korrekt "28.11.2015 00:00:00" an? (Das ist mir gestern schon aufgefallen, aber da bin ich noch nicht zum Schreiben gekommen ;-))

LG
McCavity

trinitywhm

Bin beim stöbern auf diesen Codeschnipsel gestoßen und fand das ein nettes Gimmick. Allerdings erhalte ich ähnlich wie beim letzten Beitrag ein error kurz nach Mitternacht "condition c01: syntax error, line 1, near "use 95_"". Wo liegt hier das Problem? Ist es vielleicht nur eine Kleinigkeit und dann läuft es doch?

raspklaus

Den gleichen Fehler habe ich auch, aber hier scheint niemand mehr zu antworten :'(

Clyde

Würde das auch gern verwenden, habe aber dasselbe Problem. Hat jemand eine Lösung gefunden?
2x Cubietruck, CUL868, HM-USB-CFG2
FS20, FHT, KS300, HM, MAX, Tradfri

Prof. Dr. Peter Henning

Alles hat einen Grund - es gibt inzwischen verschiedene Automatisierungsmodule, die das viel eleganter machen können.

Von mir z.B. YAAHM.

LG

pah

TomLee

Oder das u.a. DOIF selbst um die gewünschten "Social Seasons" erweitern.
Hab ich irgendwann mal hier im Forum aufgeschnappt.

defmod doif_Jahreszeiten DOIF (([00:00] or ["^global$:^MODIFIED $SELF$"]) and ($md ge "11-25" or $md le "01-08")) ()
DOELSEIF (([00:00] or ["^global$:^MODIFIED $SELF$"]) and ($md ge "06-30" or $md le "08-25")) ()
attr doif_Jahreszeiten cmdState Weihnachtszeit|Sommerzeit
attr doif_Jahreszeiten do always

Prof. Dr. Peter Henning

Zitathier im Forum aufgeschnappt.

Scheint so - das ist aber weder wartbar, noch in irgendeinem standardisierten Format, noch sinnvoll. Besser: Einen Kalender im iCal-Format mit den entsprechenden Daten befüllen.

LG

pah

TomLee

Es ist eine Alternative zum oben genannten DOIF nicht mehr und nicht weniger und mit Sicherheit für viele User erstmal eine Hilfe/Lösung. Wer sich lange genug mit FHEM beschäftigt hat sieht die Vorteile in deinen genannten Vorschlägen.