Ephemeris - persönliche "Feiertage"

Einrichtung der openHAB Umgebung und allgemeine Konfigurationsthemen.

Moderatoren: seppy, udo1toni

int5749
Beiträge: 1173
Registriert: 4. Nov 2019 22:08
Answers: 9

Ephemeris - persönliche "Feiertage"

Beitrag von int5749 »

Hallo zusammen,

nach etwas Abstinenz habe ich dann mal wieder mein OH auf die Version 4.3.2 aktualisiert und die Änderung bei Zeit/Datum in Rules direkt über die Suche hier im Forum lösen können ;)

Scheinbar gab es auch Änderungen bei Ephemeris, da diese nun einen Fehler produziert und die entsprechende Rule nicht mehr funktioniert.
Im Detail geht es um die Funktion FixedWeekdayRelativeToFixed, welche unter OH 4.2.x noch (bis auf die Übersetzung) funktionierte

Fehlermeldung
[ERROR] [l.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'a_startup-2' failed: Cannot instantiate configuration from URL 'file:/etc/openhab/services/specialdays.xml'. in a_startup
Nachdem ich in meinen Tests diverse Änderungen ausprobiert habe, läuft die Rule mit den angemeckerten specialdays.xml ohne Probleme, wenn ich meine Einträge zu FixedWeekdayRelativeToFixed entferne.

Meine Rules

Code: Alles auswählen

rule Feiertage
when
    Time cron "5 0 0 * * ?" or
    Item vSystemRestart changed to ON or
    System started
then
    val String strHoliday = '/etc/openhab/services/holidays_de.xml'
    val String strSpecialday = '/etc/openhab/services/specialdays.xml'

    val dtDate = new DateTimeType().getZonedDateTime(ZoneId.systemDefault()).plusDays(0)

    var String strToday = "regular"

    if  (Ephemeris.isBankHoliday(dtDate, strHoliday)) {
        strToday = Ephemeris.getHolidayDescription(Ephemeris.getBankHolidayName(dtDate, strHoliday))
        Holiday.postUpdate(ON)
    } else {
        Holiday.postUpdate(OFF)
        
        if (Ephemeris.isBankHoliday(dtDate, strSpecialday))
            strToday = Ephemeris.getBankHolidayName(dtDate, strSpecialday)
    }
    TodayIs.postUpdate(strToday)

    val nextHoliDay     = getNextBankHoliday(strHoliday)
    val nextHoliDayDe   = getHolidayDescription(getNextBankHoliday(strHoliday))
    val nextHoliDayDays = getDaysUntil(nextHoliDay, strHoliday)
 
    logInfo("Ephemeris", "Heute ist: {}", strToday)
    logInfo("Ephemeris", "Feiertag: {}", Holiday.state.toString)
    logInfo("Ephemeris","Nächster Feiertag: {} in {} Tagen ({})", nextHoliDayDe, nextHoliDayDays, now.plusDays(nextHoliDayDays).toLocalDate)
end
Meine ursprüngliche specialdays.xml

Code: Alles auswählen

<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
    <tns:Holidays>
        <tns:ChristianHoliday type="CARNIVAL"/> <!-- dayOfYear==easterSunday.getDayOfYear-48 -->
        <tns:ChristianHoliday type="MAUNDY_THURSDAY"/> <!-- dayOfYear==easterSunday.getDayOfYear-3 -->
        <tns:Fixed day="29" month="JUNE" descriptionPropertiesKey="ST_PETER_PAUL"/>
        <!-- dayOfYear==stAdvent.getDayOfYear-14 // "remembrance_day" // Volkstrauertag -->
        <!-- dayOfYear==stAdvent.getDayOfYear-7 // "sunday_in_commemoration_of_the_dead" // Totensonntag -->
        <tns:Fixed day="04" month="DECEMBER" descriptionPropertiesKey="ST_BARBARAS_DAY"/> <!-- Barbara Tag -->
        <tns:Fixed day="06" month="DECEMBER" descriptionPropertiesKey="ST_NICHOLAS"/> <!-- Nicolaus Tag -->

        <tns:FixedWeekdayRelativeToFixed which="FIRST" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FOURTH_ADVENT" localizedType="OFFICIAL_HOLIDAY">
            <tns:day month="DECEMBER" day="25"/>
        </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="SECOND" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="THIRD_ADVENT" localizedType="UNOFFICIAL_HOLIDAY">
            <tns:day month="DECEMBER" day="25"/>
        </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="THIRD" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="SECOND_ADVENT" localizedType="UNOFFICIAL_HOLIDAY">
            <tns:day month="DECEMBER" day="25"/>
        </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="FOURTH" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FIRST_ADVENT" localizedType="UNOFFICIAL_HOLIDAY">
            <tns:day month="DECEMBER" day="25"/>
        </tns:FixedWeekdayRelativeToFixed>
 
    </tns:Holidays>
</tns:Configuration>
Derzeitige specialdays.xml ohne Advent

Code: Alles auswählen

<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="de" description="Germany" xmlns:tns="http://www.example.org/Holiday"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.example.org/Holiday /Holiday.xsd">
    <tns:Holidays>
        <tns:ChristianHoliday type="CARNIVAL"/> <!-- dayOfYear==easterSunday.getDayOfYear-48 -->
        <tns:ChristianHoliday type="MAUNDY_THURSDAY"/> <!-- dayOfYear==easterSunday.getDayOfYear-3 -->
        <tns:Fixed day="29" month="JUNE" descriptionPropertiesKey="ST_PETER_PAUL"/>
        <!-- dayOfYear==stAdvent.getDayOfYear-14 // "remembrance_day" // Volkstrauertag -->
        <!-- dayOfYear==stAdvent.getDayOfYear-7 // "sunday_in_commemoration_of_the_dead" // Totensonntag -->
        <tns:Fixed day="04" month="DECEMBER" descriptionPropertiesKey="ST_BARBARAS_DAY"/> <!-- Barbara Tag -->
        <tns:Fixed day="06" month="DECEMBER" descriptionPropertiesKey="ST_NICHOLAS"/> <!-- Nicolaus Tag -->
    </tns:Holidays>
</tns:Configuration>
Ich habe schon die Seite zu Ephemeris auf GitHub studiert, bislang bekomme ich die Syntax aber leider nicht hin :roll:

Nutzt noch jemand die Funktion und hat einen Tipp :?:

Viele Grüße und ein 3-fach Düsseldorfer Helau, Helau, Helau :D
openHAB 4.1.0 Release mit openHABian in einem Debian Bookworm (LXC) unter Proxmox 8.1.3

Benutzeravatar
udo1toni
Beiträge: 15240
Registriert: 11. Apr 2018 18:05
Answers: 242
Wohnort: Darmstadt

Re: Ephemeris - persönliche "Feiertage"

Beitrag von udo1toni »

Also, bei mir steht das direkt in der Holidays_de.xml drin (hier nur der entsprechende Abschnitt):

Code: Alles auswählen

    <tns:Holidays>
        <tns:Fixed month="JANUARY" day="1" descriptionPropertiesKey="NEW_YEAR"/>
        <tns:Fixed month="MAY" day="1" descriptionPropertiesKey="LABOUR_DAY"/>
        <tns:Fixed month="JUNE" day="17" validFrom="1954" validTo="1990"
                   descriptionPropertiesKey="UNIFICATION"/><!-- Tag der deutschen Einheit bis 1990 -->
        <tns:Fixed month="OCTOBER" day="3" validFrom="1990"
                   descriptionPropertiesKey="UNIFICATION_GERMANY"/><!-- Tag der Deutschen Einheit ab 1990 -->
        <tns:Fixed month="OCTOBER" day="31" validFrom="2017" validTo="2017" descriptionPropertiesKey="REFORMATION_DAY"/>
        <tns:Fixed month="DECEMBER" day="25" descriptionPropertiesKey="FIRST_CHRISTMAS_DAY"/>
        <tns:Fixed month="DECEMBER" day="26" descriptionPropertiesKey="SECOND_CHRISTMAS_DAY"/>
        <tns:FixedWeekdayRelativeToFixed which="FIRST" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FOURTH_ADVENT" localizedType="UNOFFICIAL_HOLIDAY"> <tns:day month="DECEMBER" day="25"/> </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="SECOND" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="THIRD_ADVENT" localizedType="UNOFFICIAL_HOLIDAY"> <tns:day month="DECEMBER" day="25"/> </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="THIRD" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="SECOND_ADVENT" localizedType="UNOFFICIAL_HOLIDAY"> <tns:day month="DECEMBER" day="25"/> </tns:FixedWeekdayRelativeToFixed>
        <tns:FixedWeekdayRelativeToFixed which="FOURTH" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FIRST_ADVENT" localizedType="UNOFFICIAL_HOLIDAY"> <tns:day month="DECEMBER" day="25"/> </tns:FixedWeekdayRelativeToFixed>
        <tns:ChristianHoliday type="GOOD_FRIDAY"/>
        <tns:ChristianHoliday type="EASTER_MONDAY"/>
        <tns:ChristianHoliday type="ASCENSION_DAY"/>
        <tns:ChristianHoliday type="WHIT_MONDAY"/>
    </tns:Holidays>
 
Ich bekomme keine Fehlermeldung und der erste Advent wird korrekt ausgegeben.

Allerdings habe ich ein anderes (viel größeres!) Problem, und zwar wird Ostern nicht berechnet (habe ich im Zuge meiner Forschung entdeckt)...
Meine Rule hierfür hat letztes Jahr noch funktioniert:

Code: Alles auswählen

rule "Feiertage"
 when
    Time cron "5 0 0 * * ?" or
    System started
 then
    val strFile         = "/etc/openhab/services/Holidays_de.xml"
    val strHoliDay      = getHolidayDescription(getBankHolidayName)
    val nextHoliDay     = getNextBankHoliday(strFile)
    val nextHoliDayDe   = getHolidayDescription(getNextBankHoliday(strFile))
    val nextHoliDayDays = getDaysUntil(nextHoliDay,strFile)
    val firstAdventDays = getDaysUntil("FIRST_ADVENT",strFile)
    val easterDays      = getDaysUntil("christian.EASTER",strFile)
    val nFS             = easterDays - 49
    bFaschingsSonntag = if(nFS == 0) true else false
    val nAW  = easterDays - 51
    val nAM  = easterDays - 46
    val ldAW = now.plusDays(nAW).toLocalDate
    val ldAM = now.plusDays(nAM).toLocalDate
    val ldFS = now.plusDays(nFS).toLocalDate
    val dtf = java.time.format.DateTimeFormatter.ofPattern("dd.MM. yyyy")
    logInfo("Holiday","Aktuelles Jahr: {}",now.getYear)
    logInfo("holiday","Altweiberfastnacht: {} Faschingssonntag: {} Aschermittwoch: {}",ldAW.format(dtf), ldFS.format(dtf), ldAM.format(dtf))
    logInfo("holiday","Tage bis Erster Advent: {}", firstAdventDays)
    if(isBankHoliday(strFile))
        logInfo("holiday","Heute ist {}", strHoliDay)
    logInfo("holiday","Nächster Feiertag: {} in {} Tagen ({})", nextHoliDayDe, nextHoliDayDays, now.plusDays(nextHoliDayDays).toLocalDate.format(dtf))
    logInfo("holiday","Ostersonntag ist in {} Tagen ({})", easterDays, now.plusDays(easterDays).toLocalDate.format(dtf))
end
Ausgabe sieht dann so aus:

Code: Alles auswählen

2025-02-13 12:04:36.590 [INFO ] [rg.openhab.core.model.script.Holiday] - Aktuelles Jahr: 2025
2025-02-13 12:04:36.590 [INFO ] [rg.openhab.core.model.script.holiday] - Altweiberfastnacht: 23.12. 2024 Faschingssonntag: 25.12. 2024 Aschermittwoch: 28.12. 2024
2025-02-13 12:04:36.590 [INFO ] [rg.openhab.core.model.script.holiday] - Tage bis Erster Advent: 290
2025-02-13 12:04:36.590 [INFO ] [rg.openhab.core.model.script.holiday] - Nächster Feiertag: undefined in 64 Tagen (18.04. 2025)
2025-02-13 12:04:36.591 [INFO ] [rg.openhab.core.model.script.holiday] - Ostersonntag ist in -1 Tagen (12.02. 2025)
und man kann gut erkennen, dass Ostern nicht korrekt gesetzt ist (Karfreitag wird zwar als nächster Feiertag korrekt berechnet, aber der Name fehlt... irgendwo ist da grad der Wurm drin)
EDIT: Achso... momentan habe ich die Berechnung auf local umgestellt, auch dort steht Ostern nicht zur Verfügung, aber wenigstens Ostermontag...
openHAB4.3.3 stable in einem Debian-Container (bookworm) (Proxmox 8.3.5, LXC), mit openHABian eingerichtet

nw378
Beiträge: 295
Registriert: 22. Sep 2018 10:38
Answers: 5

Re: Ephemeris - persönliche "Feiertage"

Beitrag von nw378 »

Hier das gleiche.
Alle fixen Termine sind ok, die beweglichen werden nicht berechnet.
Ostersonntag in -1 Tagen....

Ich meine, letztes Jahr hätte das noch funktioniert.

Udo, machst Du ein Issue dazu auf oder hast evtl. genauere Infos?

Alternativ hatte ich schon überlegt, Ephemeris von Board zu werfen und die Feiertage nach der Gauß'schen Formel zu berechnen (so viele sind es ja auch nicht). Allerdings wird in allen Forenbeiträgen zur Osterberechnung auf Ephemeris als state-of-the-art verwiesen.
openHAB 4.3.3 @ RPi 4 / SSD - InfluxDB2 und Grafana @ Synology Docker - KNX

int5749
Beiträge: 1173
Registriert: 4. Nov 2019 22:08
Answers: 9

Re: Ephemeris - persönliche "Feiertage"

Beitrag von int5749 »

Danke für's gegenprüfen :)

Gerade auch per Tante Google meine alten Post im KNX User Forum wieder gefunden ;)

Den eigentlichen Fehler hatte ich wohl schon länger eingebaut, als ich versucht habe die XML etwas übersichtlicher zu gestallten und habe dabei die Schreibweise geändert. Aber ... ich hatte OH nicht neu gestartet, was aber nach Änderungen an den XML erforderlich ist.

Mit der ursprünglichen Schreibweise, die Du ja auch verwwendest, funktioniert das dann wieder.
Weiterhin mit der Einschränkung das die Übersetzung nicht klappt, aber scheint es ja keine Bewegung auf unser geöffnetes Issue zu geben.

Auch bei mir klappt die Berechnung von Ostern derzeit nicht mit Ephemeris :cry:
openHAB 4.1.0 Release mit openHABian in einem Debian Bookworm (LXC) unter Proxmox 8.1.3

int5749
Beiträge: 1173
Registriert: 4. Nov 2019 22:08
Answers: 9

Re: Ephemeris - persönliche "Feiertage"

Beitrag von int5749 »

nw378 hat geschrieben: 13. Feb 2025 15:29 Alternativ hatte ich schon überlegt, Ephemeris von Board zu werfen und die Feiertage nach der Gauß'schen Formel zu berechnen (so viele sind es ja auch nicht). Allerdings wird in allen Forenbeiträgen zur Osterberechnung auf Ephemeris als state-of-the-art verwiesen.
Ist es ja eigentlich auch, daher war ich 2020 auf Ephemeris umgestiegen und bis auf die fehlende Übersetzung von persönlichen Tagen funktionierte das auch sehr gut.
openHAB 4.1.0 Release mit openHABian in einem Debian Bookworm (LXC) unter Proxmox 8.1.3

Benutzeravatar
udo1toni
Beiträge: 15240
Registriert: 11. Apr 2018 18:05
Answers: 242
Wohnort: Darmstadt

Re: Ephemeris - persönliche "Feiertage"

Beitrag von udo1toni »

int5749 hat geschrieben: 13. Feb 2025 16:00 Aber ... ich hatte OH nicht neu gestartet, was aber nach Änderungen an den XML erforderlich ist.
Autsch. Tatsächlich war das auch bei mir das Problem. Ich hatte zwar neu gestartet, aber zum falschen Zeitpunkt...

In der Zwischenzeit habe ich aber ein Detail lösen können.
Sieht so aus:

Code: Alles auswählen

<?xml version="1.0" encoding="UTF-8"?>

<Configuration hierarchy="de" description="Germany"
               xmlns="https://192.168.178.55:8443/static/ephemeris/holiday"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="https://192.168.178.55:8443/static/ephemeris/holiday https://192.168.178.55:8443/static/ephemeris/holiday/holiday.xsd">
  <Holidays>
    <Fixed month="JANUARY" day="1" descriptionPropertiesKey="NEW_YEAR"/>
    <Fixed month="MAY" day="1" descriptionPropertiesKey="LABOUR_DAY"/>
    <Fixed month="JUNE" day="17" validFrom="1954" validTo="1990" descriptionPropertiesKey="UNIFICATION"/>
    <Fixed month="OCTOBER" day="3" validFrom="1990" descriptionPropertiesKey="UNIFICATION_GERMANY"/>
    <Fixed month="OCTOBER" day="31" validFrom="2017" validTo="2017" descriptionPropertiesKey="REFORMATION_DAY"/>
    <Fixed month="DECEMBER" day="25" descriptionPropertiesKey="FIRST_CHRISTMAS_DAY"/>
    <Fixed month="DECEMBER" day="26" descriptionPropertiesKey="SECOND_CHRISTMAS_DAY"/>
    <FixedWeekdayRelativeToFixed which="FIRST" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FOURTH_ADVENT" localizedType="OBSERVANCE"> <day month="DECEMBER" day="25"/> </FixedWeekdayRelativeToFixed>
    <FixedWeekdayRelativeToFixed which="SECOND" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="THIRD_ADVENT" localizedType="OBSERVANCE"> <day month="DECEMBER" day="25"/> </FixedWeekdayRelativeToFixed>
    <FixedWeekdayRelativeToFixed which="THIRD" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="SECOND_ADVENT" localizedType="OBSERVANCE"> <day month="DECEMBER" day="25"/> </FixedWeekdayRelativeToFixed>
    <FixedWeekdayRelativeToFixed which="FOURTH" weekday="SUNDAY" when="BEFORE" descriptionPropertiesKey="FIRST_ADVENT" localizedType="OBSERVANCE"> <day month="DECEMBER" day="25"/> </FixedWeekdayRelativeToFixed>
    <RelativeToFixed validFrom="1934" validTo="1938" descriptionPropertiesKey="REPENTANCE_PRAYER">
      <Weekday>WEDNESDAY</Weekday>
      <When>BEFORE</When>
      <Date month="NOVEMBER" day="23"/>
    </RelativeToFixed>
    <RelativeToFixed validFrom="1990" validTo="1994" descriptionPropertiesKey="REPENTANCE_PRAYER">
      <Weekday>WEDNESDAY</Weekday>
      <When>BEFORE</When>
      <Date month="NOVEMBER" day="23"/>
    </RelativeToFixed>

    <ChristianHoliday type="GOOD_FRIDAY" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
    <ChristianHoliday type="EASTER_MONDAY" descriptionPropertiesKey="christian.EASTER_MONDAY"/>
    <ChristianHoliday type="ASCENSION_DAY" descriptionPropertiesKey="christian.ASCENSION_DAY"/>
    <ChristianHoliday type="WHIT_MONDAY" descriptionPropertiesKey="christian.WHIT_MONDAY"/>
  </Holidays>

  <Sources>
    <Source>https://en.wikipedia.org/wiki/Public_holidays_in_Germany</Source>
    <Source of="ISO 3166-2">https://en.wikipedia.org/wiki/ISO_3166-2:DE</Source>
  </Sources>

  <SubConfigurations hierarchy="be" description="Berlin">
    <Holidays>
      <Fixed month="MARCH" day="8" descriptionPropertiesKey="INTERNATIONAL_WOMAN" validFrom="2019"/>
      <Fixed month="MAY" day="8" descriptionPropertiesKey="LIBERATION" validFrom="2020" validTo="2020"/>
      <Fixed month="MAY" day="8" descriptionPropertiesKey="LIBERATION" validFrom="2025" validTo="2025"/>
      <Fixed month="JUNE" day="17" descriptionPropertiesKey="75_ANNIVERSARY_OF_THE_UPRISING" validFrom="2028" validTo="2028"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="bb" description="Brandenburg">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY"/>
      <ChristianHoliday type="EASTER" descriptionPropertiesKey="christian.EASTER"/>
      <ChristianHoliday type="PENTECOST" descriptionPropertiesKey="christian.PENTECOST"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="bw" description="Baden-Württemberg">
    <Holidays>
      <Fixed month="JANUARY" day="6" descriptionPropertiesKey="EPIPHANY"/>
      <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>

      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>

      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="by" description="Bavaria">
    <Holidays>
      <Fixed month="JANUARY" day="6" descriptionPropertiesKey="EPIPHANY"/>
      <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>
      <RelativeToFixed validFrom="1981" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
    </Holidays>

    <SubConfigurations hierarchy="mu" description="Munich">
      <Holidays>
        <Fixed day="15" month="AUGUST" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      </Holidays>
    </SubConfigurations>

    <SubConfigurations hierarchy="ag" description="Augsburg">
      <Holidays>
        <Fixed day="8" month="AUGUST" descriptionPropertiesKey="PEACE"/>
        <Fixed day="15" month="AUGUST" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      </Holidays>
    </SubConfigurations>

    <SubConfigurations hierarchy="wu" description="Würzburg">
      <Holidays>
        <Fixed day="15" month="AUGUST" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      </Holidays>
    </SubConfigurations>

    <SubConfigurations hierarchy="re" description="Regensburg">
      <Holidays>
        <Fixed day="15" month="AUGUST" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      </Holidays>
    </SubConfigurations>

    <SubConfigurations hierarchy="in" description="Ingolstadt">
      <Holidays>
        <Fixed day="15" month="AUGUST" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      </Holidays>
    </SubConfigurations>
  </SubConfigurations>

  <SubConfigurations hierarchy="he" description="Hessen">
    <Holidays>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
      <ChristianHoliday type="EASTER" descriptionPropertiesKey="christian.EASTER"/>
      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
      <ChristianHoliday type="PENTECOST" descriptionPropertiesKey="christian.PENTECOST"/>
      <ChristianHoliday type="WHIT_SUNDAY" descriptionPropertiesKey="christian.WHIT_SUNDAY"/>
      <Fixed month="JANUARY" day="1" descriptionPropertiesKey="BIRTHDAY_MY" localizedType="OBSERVANCE"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="mv" description="Mecklenburg-Vorpommern">
    <Holidays>
      <Fixed month="MARCH" day="8" descriptionPropertiesKey="INTERNATIONAL_WOMAN" validFrom="2023"/>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="nw" description="North Rhine-Westphalia">
    <Holidays>
      <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="rp" description="Rhineland-Palatinate">
    <Holidays>
      <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="sl" description="Saarland">
    <Holidays>
      <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>
      <Fixed month="AUGUST" day="15" descriptionPropertiesKey="ASSUMPTION_DAY"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
      <ChristianHoliday type="CORPUS_CHRISTI" descriptionPropertiesKey="christian.CORPUS_CHRISTI"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="sn" description="Saxony">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY"/>
      <RelativeToFixed validFrom="1995" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="st" description="Saxony-Anhalt">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY"/>
      <Fixed month="JANUARY" day="6" descriptionPropertiesKey="EPIPHANY"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="th" description="Thuringia">
    <Holidays>
      <Fixed month="SEPTEMBER" day="20" descriptionPropertiesKey="CHILDRENS_DAY" validFrom="2019"/>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY"/>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="sh" description="Schleswig-Holstein">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY" validFrom="2018"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="hh" description="Hamburg">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY" validFrom="2018"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="hb" description="Bremen">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY" validFrom="2018"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>

  <SubConfigurations hierarchy="ni" description="Lower-Saxony">
    <Holidays>
      <Fixed month="OCTOBER" day="31" descriptionPropertiesKey="REFORMATION_DAY" validFrom="2018"/>
      <RelativeToFixed validFrom="1945" validTo="1989" descriptionPropertiesKey="REPENTANCE_PRAYER">
        <Weekday>WEDNESDAY</Weekday>
        <When>BEFORE</When>
        <Date month="NOVEMBER" day="23"/>
      </RelativeToFixed>
    </Holidays>
  </SubConfigurations>
</Configuration>
Zu beachten;
1: Der Kopf. Ich verweise auf die Datei holiday.xsd, welche ich über jetty ausliefern lasse (https://192.168.178.55:8443/static/ephe ... oliday.xsd), wobei 192.168.178.55 die IP meines openHAB Systems ist. Dadurch kann ich auf tns: vor jedem Keyword verzichten.
2. Ich wohne in Hessen und habe Ostern als offiziellen Feiertag nachgetragen, genau wie Pfingsmontag (beide nicht bundesweit, aber in Hessen gültig)
3. Ich habe die Adventssonntage und als Beispiel einen Geburtstag hinzugefügt, wobei diese Daten als localizedType OBSERVANCE eingetragen haben.
4. Die Datei holiday.xsd hat folgenden Inhalt:

Code: Alles auswählen

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="https://192.168.178.55:8443/static/ephemeris/holiday"
            xmlns="https://192.168.178.55:8443/static/ephemeris/holiday"
            elementFormDefault="qualified">

  <xsd:simpleType name="Weekday">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="MONDAY"/>
      <xsd:enumeration value="TUESDAY"/>
      <xsd:enumeration value="WEDNESDAY"/>
      <xsd:enumeration value="THURSDAY"/>
      <xsd:enumeration value="FRIDAY"/>
      <xsd:enumeration value="SATURDAY"/>
      <xsd:enumeration value="SUNDAY"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="Month">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="JANUARY"/>
      <xsd:enumeration value="FEBRUARY"/>
      <xsd:enumeration value="MARCH"/>
      <xsd:enumeration value="APRIL"/>
      <xsd:enumeration value="MAY"/>
      <xsd:enumeration value="JUNE"/>
      <xsd:enumeration value="JULY"/>
      <xsd:enumeration value="AUGUST"/>
      <xsd:enumeration value="SEPTEMBER"/>
      <xsd:enumeration value="OCTOBER"/>
      <xsd:enumeration value="NOVEMBER"/>
      <xsd:enumeration value="DECEMBER"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="RelativeToFixed">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:choice>
            <xsd:element name="Days" type="xsd:int" minOccurs="0"/>
            <xsd:element name="Weekday" type="Weekday" minOccurs="0"/>
          </xsd:choice>
          <xsd:element name="When" type="When"/>
          <xsd:element name="Date" type="Fixed"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="Holidays">
    <xsd:sequence>
      <xsd:element name="Fixed" type="Fixed" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="RelativeToFixed" type="RelativeToFixed" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="RelativeToWeekdayInMonth" type="RelativeToWeekdayInMonth" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="FixedWeekday" type="FixedWeekdayInMonth" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="ChristianHoliday" type="ChristianHoliday" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="IslamicHoliday" type="IslamicHoliday" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="FixedWeekdayBetweenFixed" type="FixedWeekdayBetweenFixed" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="FixedWeekdayRelativeToFixed" type="FixedWeekdayRelativeToFixed" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="EthiopianOrthodoxHoliday" type="EthiopianOrthodoxHoliday" maxOccurs="unbounded" minOccurs="0"/>
      <xsd:element name="RelativeToEasterSunday" type="RelativeToEasterSunday" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="Configuration" type="Configuration"/>

  <xsd:complexType name="Configuration">
    <xsd:sequence>
      <xsd:element name="Holidays" type="Holidays"/>
      <xsd:element name="Sources" type="Sources" minOccurs="0"/>
      <xsd:element name="SubConfigurations" type="Configuration" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="hierarchy" type="xsd:string"/>
    <xsd:attribute name="description" type="xsd:string"/>
  </xsd:complexType>

  <xsd:complexType name="Source">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="of" type="xsd:string"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:complexType name="Sources">
    <xsd:sequence>
      <xsd:element name="Source" type="Source" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Fixed">
    <xsd:complexContent>
      <xsd:extension base="MoveableHoliday">
        <xsd:attribute name="month" type="Month"/>
        <xsd:attribute name="day">
          <xsd:simpleType>
            <xsd:restriction base="xsd:int">
              <xsd:minInclusive value="1"/>
              <xsd:maxInclusive value="31"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:attribute>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="When">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="BEFORE"/>
      <xsd:enumeration value="AFTER"/>
      <xsd:enumeration value="CLOSEST"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="FixedWeekdayInMonth">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:attribute name="which" type="Which"/>
        <xsd:attribute name="weekday" type="Weekday"/>
        <xsd:attribute name="month" type="Month"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="Which">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="FIRST"/>
      <xsd:enumeration value="SECOND"/>
      <xsd:enumeration value="THIRD"/>
      <xsd:enumeration value="FOURTH"/>
      <xsd:enumeration value="LAST"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="RelativeToWeekdayInMonth">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:element name="FixedWeekday" type="FixedWeekdayInMonth"/>
        </xsd:sequence>
        <xsd:attribute name="weekday" type="Weekday"/>
        <xsd:attribute name="when" type="When"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="IslamicHoliday">
    <xsd:complexContent>
      <xsd:extension base="MoveableHoliday">
        <xsd:attribute name="type" type="IslamicHolidayType"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="IslamicHolidayType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="NEWYEAR"/>
      <xsd:enumeration value="ASCHURA"/>
      <xsd:enumeration value="MAWLID_AN_NABI"/>
      <xsd:enumeration value="LAILAT_AL_MIRAJ"/>
      <xsd:enumeration value="LAILAT_AL_BARAT"/>
      <xsd:enumeration value="RAMADAN"/>
      <xsd:enumeration value="LAILAT_AL_QADR"/>
      <xsd:enumeration value="RAMADAN_END"/>
      <xsd:enumeration value="ID_AL_FITR"/>
      <xsd:enumeration value="ID_AL_FITR_2"/>
      <xsd:enumeration value="ID_AL_FITR_3"/>
      <xsd:enumeration value="ARAFAAT"/>
      <xsd:enumeration value="ID_UL_ADHA"/>
      <xsd:enumeration value="ID_UL_ADHA_2"/>
      <xsd:enumeration value="ID_UL_ADHA_3"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="ChronologyType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="JULIAN"/>
      <xsd:enumeration value="GREGORIAN"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="ChristianHoliday">
    <xsd:complexContent>
      <xsd:extension base="MoveableHoliday">
        <xsd:attribute name="type" type="ChristianHolidayType"/>
        <xsd:attribute name="chronology" type="ChronologyType"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="HolidayType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="PUBLIC_HOLIDAY"/>
      <xsd:enumeration value="BANK_HOLIDAY"/>
      <xsd:enumeration value="OBSERVANCE"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="ChristianHolidayType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="GOOD_FRIDAY"/>
      <xsd:enumeration value="EASTER_MONDAY"/>
      <xsd:enumeration value="ASCENSION_DAY"/>
      <xsd:enumeration value="WHIT_MONDAY"/>
      <xsd:enumeration value="CORPUS_CHRISTI"/>
      <xsd:enumeration value="MAUNDY_THURSDAY"/>
      <xsd:enumeration value="ASH_WEDNESDAY"/>
      <xsd:enumeration value="MARDI_GRAS"/>
      <xsd:enumeration value="GENERAL_PRAYER_DAY"/>
      <xsd:enumeration value="CLEAN_MONDAY"/>
      <xsd:enumeration value="SHROVE_MONDAY"/>
      <xsd:enumeration value="PENTECOST"/>
      <xsd:enumeration value="CARNIVAL"/>
      <xsd:enumeration value="EASTER_SATURDAY"/>
      <xsd:enumeration value="EASTER_TUESDAY"/>
      <xsd:enumeration value="SACRED_HEART"/>
      <xsd:enumeration value="EASTER"/>
      <xsd:enumeration value="PENTECOST_MONDAY"/>
      <xsd:enumeration value="WHIT_SUNDAY"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="FixedWeekdayBetweenFixed">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:element name="from" type="Fixed"/>
          <xsd:element name="to" type="Fixed"/>
        </xsd:sequence>
        <xsd:attribute name="weekday" type="Weekday"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="Holiday" abstract="true">
    <xsd:attribute name="validFrom" type="xsd:int"/>
    <xsd:attribute name="validTo" type="xsd:int"/>
    <xsd:attribute name="every" type="HolidayCycleType" default="EVERY_YEAR"/>
    <xsd:attribute name="descriptionPropertiesKey" type="xsd:string"/>
    <xsd:attribute name="localizedType" type="HolidayType" default="PUBLIC_HOLIDAY"/>
  </xsd:complexType>

  <xsd:simpleType name="Substituted">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="ON_SATURDAY"/>
      <xsd:enumeration value="ON_SUNDAY"/>
      <xsd:enumeration value="ON_WEEKEND"/>
      <xsd:enumeration value="ON_TUESDAY"/>
      <xsd:enumeration value="ON_WEDNESDAY"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="With">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="NEXT"/>
      <xsd:enumeration value="PREVIOUS"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="MovingCondition">
    <xsd:attribute name="substitute" type="Weekday"/>
    <xsd:attribute name="with" type="With"/>
    <xsd:attribute name="weekday" type="Weekday"/>
  </xsd:complexType>

  <xsd:complexType name="MoveableHoliday" abstract="true">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:element name="MovingCondition" type="MovingCondition" maxOccurs="unbounded" minOccurs="0"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="EthiopianOrthodoxHoliday">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:attribute name="type" type="EthiopianOrthodoxHolidayType"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="EthiopianOrthodoxHolidayType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="TIMKAT"/>
      <xsd:enumeration value="ENKUTATASH"/>
      <xsd:enumeration value="MESKEL"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="FixedWeekdayRelativeToFixed">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:element name="day" type="Fixed"/>
        </xsd:sequence>
        <xsd:attribute name="which" type="Which"/>
        <xsd:attribute name="weekday" type="Weekday"/>
        <xsd:attribute name="when" type="When"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:simpleType name="HolidayCycleType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="EVERY_YEAR"/>
      <xsd:enumeration value="TWO_YEARS"/>
      <xsd:enumeration value="THREE_YEARS"/>
      <xsd:enumeration value="FOUR_YEARS"/>
      <xsd:enumeration value="FIVE_YEARS"/>
      <xsd:enumeration value="SIX_YEARS"/>
      <xsd:enumeration value="ODD_YEARS"/>
      <xsd:enumeration value="EVEN_YEARS"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="RelativeToEasterSunday">
    <xsd:complexContent>
      <xsd:extension base="Holiday">
        <xsd:sequence>
          <xsd:element name="chronology" type="ChronologyType"/>
          <xsd:element name="days" type="xsd:int"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>
Aus dieser Datei ergibt sich meiner Ansicht auch das korrekte Schlüsselwort für localizedType. Die Datei selbst stammt von https://github.com/focus-shift/jollyday/ und ist die Schema-Datei, welche dem xml zugrunde liegt. Ich gehe stark davon aus, dass die angegebenen Schlüsselworte exakt so verwendet werden müssen, damit alles korrekt läuft. :)

Bezüglich der "Übersetzung" eigener Termine habe ich noch keine Lösung gefunden, die Datei holiday_descriptions_de.properties wird jedenfalls nicht verwendet, um die Namen zu übersetzen, und eine andere Datei mit passendem Inhalt kann ich ebenfalls nicht finden.
openHAB4.3.3 stable in einem Debian-Container (bookworm) (Proxmox 8.3.5, LXC), mit openHABian eingerichtet

nw378
Beiträge: 295
Registriert: 22. Sep 2018 10:38
Answers: 5

Re: Ephemeris - persönliche "Feiertage"

Beitrag von nw378 »

Hallo Udo,

danke für Deine Mühe. Für NRW adaptiert und alle Feiertage getestet - funktioniert. :)
Bezüglich der "Übersetzung" eigener Termine habe ich noch keine Lösung gefunden, die Datei holiday_descriptions_de.properties wird jedenfalls nicht verwendet, um die Namen zu übersetzen, und eine andere Datei mit passendem Inhalt kann ich ebenfalls nicht finden.
Die Übersetzung mache ich per MAP-Transformation:

Code: Alles auswählen

    val String strHolidays = '/etc/openhab/services/Holidays_de.xml'
    val dtDate = new DateTimeType().getZonedDateTime(ZoneId.systemDefault()).plusDays(1) //morgen
    var String strDay = "-"
    if  (Ephemeris.isBankHoliday(dtDate, strHolidays)) {
      strDay = transform("MAP", "holidays_DE.map", Ephemeris.getBankHolidayName(dtDate, strHolidays).toString)
      sendBroadcastNotification("Morgen ist " + strDay.toString + ". Die Rollos bleiben unten.")
      Feiertag.postUpdate(ON) } 
holidays_DE.map:

Code: Alles auswählen

ALL_SAINTS                     = Allerheiligen
ALL_SOULS                      = Aller Seelen
ASSUMPTION_DAY                 = Maria Himmelfahrt
ASSUMPTION_MARY                = Maria Himmelfahrt
BANK_HOLIDAY                   = Bank Feiertag
BEER_DAY                       = Bier Tag
CHRISTMAS                      = Weihnachten
CHRISTMAS_EVE                  = Heiligabend
CONSOLIDATION                  = Tag der Einheit
CONSTITUTION_DAY               = Tag der Verfassung
CYBER_MONDAY                   = Cyber Monday
DAY_AFTER_NEW_YEAR             = Tag nach Neujahr
EUROPE_DAY                     = Europatag
LABOUR_DAY                     = Tag der Arbeit
MAY_DAY                        = Mai-Tag
MOTHERS_DAY                    = Muttertag
NATIONAL_DAY                   = Nationalfeiertag
NEW_YEAR                       = Neujahr
NEW_YEARS_EVE                  = Silvester
REFORMATION_DAY                = Reformationstag
REGIONAL                       = Regionaler Feiertag
THREE_HIERARCHS                = Heiligen drei Könige
UNIFICATION                    = Tag der Wiedervereinigung
UNIFICATION_GERMANY            = Tag der Deutschen Einheit
christian.ASCENSION_DAY        = Christi Himmelfahrt
christian.ASH_WEDNESDAY        = Aschermittwoch
christian.CARNIVAL             = Karneval
christian.CLEAN_MONDAY         = Aschermontag
christian.CORPUS_CHRISTI       = Fronleichnam
christian.EASTER               = Ostern
christian.EASTER_MONDAY        = Ostermontag
christian.EASTER_SATURDAY      = Ostersamstag
christian.EASTER_TUESDAY       = Fastnachtdienstag
christian.GENERAL_PRAYER_DAY   = Allg. Beetag
christian.GOOD_FRIDAY          = Karfreitag
christian.MAUNDY_THURSDAY      = Gründonnerstag
christian.PENTECOST            = Pfingsten
christian.PENTECOST_MONDAY     = Pfingstmontag
christian.SHROVE_MONDAY        = Aschermontag
christian.WHIT_MONDAY          = Pfingstmontag
christian.WHIT_SUNDAY          = Pfingstsonntag
FIRST_CHRISTMAS_DAY            = 1. Weihnachtsfeiertag
SECOND_CHRISTMAS_DAY           = 2. Weihnachtsfeiertag
FIRST_ADVENT                   = 1. Advent 
SECOND_ADVENT                  = 2. Advent 
THIRD_ADVENT                   = 3. Advent 
FOURTH_ADVENT                  = 4. Advent 
undefined=-
no_holiday=kein Feiertag
UNDEF=-
NULL=-
openHAB 4.3.3 @ RPi 4 / SSD - InfluxDB2 und Grafana @ Synology Docker - KNX

Benutzeravatar
udo1toni
Beiträge: 15240
Registriert: 11. Apr 2018 18:05
Answers: 242
Wohnort: Darmstadt

Re: Ephemeris - persönliche "Feiertage"

Beitrag von udo1toni »

Ja, nein, das ist für die "normalen" Feiertage unnötig, das funktioniert "einfach so"...
Diese Zeile:

Code: Alles auswählen

val nextHoliDayDe   = getHolidayDescription(getNextBankHoliday(strFile))
Holt zum internationalen Namen des nächsten Feiertags getNextBankHoliday(strFile) die Übersetzung. Nur greift die Funktion nicht "wie versprochen" auf die hinterlegte Datei holiday_descriptions_de.properties zurück. Das kann man dadurch verifizieren, dass man eine vorhandene Übersetzung abändert, z.B. aus

Code: Alles auswählen

holiday.description.christian.GOOD_FRIDAY          = Karfreitag
einfach

Code: Alles auswählen

holiday.description.christian.GOOD_FRIDAY          = Karfreutag
macht. openHAB neu starten, nächster Feiertag ist Karfreitag, und es wird weiterhin Karfreitag als Text geliefert.
Mappings habe ich auch angelegt, aber an dieser Stelle dürfen die nicht wirken, weil nirgends entsprechend verknüpft. Und auch dort kann ich die Einträge für Karfreitag verunstalten, ohne dass dies Auswirkungen auf die Meldung hat.
Es ist schlicht so, dass das System die Übersetzung mutmaßlich online holt, statt auf die lokale Version der Datei zuzugreifen.
openHAB4.3.3 stable in einem Debian-Container (bookworm) (Proxmox 8.3.5, LXC), mit openHABian eingerichtet

nw378
Beiträge: 295
Registriert: 22. Sep 2018 10:38
Answers: 5

Re: Ephemeris - persönliche "Feiertage"

Beitrag von nw378 »

Ich glaube, holiday_descriptions_de.properties hat noch nie funktioniert.

Wenn ich Dich richtig verstanden habe, ist Dein Punkt, dass getHolidayDescription(getNextBankHoliday(strFile)) nicht auf die MAP-Datei zugreift.
Das habe ich auch nicht behauptet.

Der Weg über

Code: Alles auswählen

transform("MAP", "holidays_DE.map", Ephemeris.getBankHolidayName(dtDate, strHolidays).toString)
funktioniert aber. Wenn ich die deutsche Beschreibung der Feiertage in der MAP-Datei verunstalte, wird es mir in der Rule auch entsprechend in der Notification angezeigt.

getHolidayDescription verwebde ich einfach nicht. ;)

Alternativ

Code: Alles auswählen

      strDay = transform("MAP", "holidays_DE.map", Ephemeris.getNextBankHoliday(strHolidays).toString)
klappt auch.
openHAB 4.3.3 @ RPi 4 / SSD - InfluxDB2 und Grafana @ Synology Docker - KNX

Benutzeravatar
udo1toni
Beiträge: 15240
Registriert: 11. Apr 2018 18:05
Answers: 242
Wohnort: Darmstadt

Re: Ephemeris - persönliche "Feiertage"

Beitrag von udo1toni »

Ja, wir sind dicht beieinander.

Mein Punkt ist aber, dass getHolidayDescription(getNextBankHoliday(strFile)) dennoch korrekt den nächsten Feiertag auf deutsch ausgibt.

Und der Sollzustand ist nun mal, dass man die Übersetzung in Jollyday selbst vornehmen können sollte, nicht durch ein Mapping, was man "durch Zufall" in der Anwendung nutzen kann, die Jollyday verwendet.
openHAB4.3.3 stable in einem Debian-Container (bookworm) (Proxmox 8.3.5, LXC), mit openHABian eingerichtet

Antworten