Ephemeris not working?

  • Platform information:
    • Hardware: Pi4

    • OS: raspbian (Debian 10.13)

    • Java Runtime Environment: openjdk version “11.0.13” 2021-10-19 LTS
      OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
      OpenJDK Client VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)

    • openHAB version: 3.4.2

  • Issue of the topic: I have added holidays to the /etc/openhab/services/Holidays_de.xml but they are not recognized:
    <tns:SubConfigurations hierarchy=“nw” description=“North Rhine-Westphalia”>
    tns:Holidays
    <tns:Fixed month=“APRIL” day=“5” descriptionPropertiesKey=“Osterferien1”/>
    <tns:Fixed month=“APRIL” day=“6” descriptionPropertiesKey=“Osterferien2”/>
    <tns:Fixed month=“APRIL” day=“11” descriptionPropertiesKey=“Osterferien3”/>
    <tns:Fixed month=“APRIL” day=“12” descriptionPropertiesKey=“Osterferien4”/>
    <tns:Fixed month=“APRIL” day=“13” descriptionPropertiesKey=“Osterferien5”/>
    <tns:Fixed month=“APRIL” day=“14” descriptionPropertiesKey=“Osterferien6”/>
    <tns:Fixed month=“NOVEMBER” day=“1” descriptionPropertiesKey=“ALL_SAINTS”/>
    <tns:ChristianHoliday type=“CORPUS_CHRISTI”/>
    </tns:Holidays>
    </tns:SubConfigurations>

Running a script like:
var logger = Java.type(‘org.slf4j.LoggerFactory’).getLogger(‘org.openhab.rule.’ + ctx.ruleUID);
var ephemeris = Java.type(“org.openhab.core.model.script.actions.Ephemeris”);
logger.info((ephemeris.getBankHolidayName(0)));
logger.info((ephemeris.isBankHoliday(0)));
gets me
2023-04-05 11:56:44.782 [INFO ] [org.openhab.rule.57e4300b99 ] - null
2023-04-05 11:56:44.793 [INFO ] [org.openhab.rule.57e4300b99 ] - false
even it is the 5th of April

Is there a different location where I configure holidays? The setting of Country, Location and so on are done in the configurations.

Please use code fences when posting code, XML and logs.

```
code goes here
```

No, but your custom holidays XML file isn’t picked up by default. You have to tell it which file to use in the Action call. See Actions | openHAB and notice that there are a version of all the holiday Actions that take a <file> as an argument. You need to use that and pass in the full path to your XML file. Otherwise it will just look at the default set of holidays as defined by the JollyDay library.

Thank you, worked so far!