Ephemeris issues with custom xml

Hi all, and maybe directly @rlkoshak :wink:

since hours im trying to configure Ephemeris. I configured it via the Ui to Germany, Baden-Württemberg, and weekends to SATURDAY, SUNDAY and the city to wn.

With the default holidays, its working fine now, but i wanted to add a custom holiday file. Therefore i downloaded the one from Actions | openHAB

and placed it here: /etc/openhab/services/Holidays_de.xml
The file is owned by user openhab and is set to ‘rw’.

In my Rules DSL file automation.rules i have the following:

rule "Ephemeris test"
when
    Time cron "0 * * * * ? *" 
then

        logInfo("Ephemeris", "Ephemeris: " + Ephemeris.getNextBankHoliday('/etc/openhab/services/Holidays_de.xml'))
end

but the log then just mentions:

2024-02-19 18:10:00.981 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'automation-1' failed: Cannot instantiate configuration from URL 'file:/etc/openhab/services/Holidays_de.xml'. in automation

Has anybody any idea, how to get that to work?

And directly the next two question:

  1. Is it possible to give a custom name, e.g.: schulferien? So this would allow to have multiple lists to distinguish between.
  2. How would one define a time range in the xml file, e.g. 25.03.2024 - 05.05.2024 ? Is this possible or do i have to define each and every day? By reading jollday spec I absolutely do not understand how to do so.
  3. How would one specify a lookup to a CALDAV path?

Thanks in advance for guiding me here :+1:

I did a test with a DSL rule:

rule "ephemeris message"
when Time cron "0/10 * * * * ?"
then
logInfo("Rules", Ephemeris.getNextBankHoliday("/etc/openhab/services/MyEntry_de.xml"))
end

With MyEntry_de.xml contains:

<?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:Fixed month="DECEMBER" day="26" descriptionPropertiesKey="MY_SECOND_CHRISTMAS_DAY"/>
        <tns:Fixed month="DECEMBER" day="28" descriptionPropertiesKey="XXXXXXXXX"/>
    </tns:Holidays>
</tns:Configuration>

and the output in openhab.log file then is

2024-02-19 22:41:20.811 [INFO ] [org.openhab.core.model.script.Rules ] - MY_SECOND_CHRISTMAS_DAY
2024-02-19 22:41:30.811 [INFO ] [org.openhab.core.model.script.Rules ] - MY_SECOND_CHRISTMAS_DAY
2024-02-19 22:41:40.811 [INFO ] [org.openhab.core.model.script.Rules ] - MY_SECOND_CHRISTMAS_DAY
2024-02-19 22:41:50.812 [INFO ] [org.openhab.core.model.script.Rules ] - MY_SECOND_CHRISTMAS_DAY
2024-02-19 22:42:00.811 [INFO ] [org.openhab.core.model.script.Rules ] - MY_SECOND_CHRISTMAS_DAY

I think this is answered as I used a customimzed name …?

Hello,
I’m using my own file for birthdays and placed it here “/openhab/conf/services/birthdays.xml” with OpenHAB 4.1.1 under Docker.
In JS the code to read the

            nextBithday = actions.Ephemeris.getNextBankHoliday('/openhab/conf/services/birthdays.xml');

Hi @Wolfgang_S ,

great, thanks for your reply. I now just simply copied exactly what you have specified, and its now perfectly working and this is a superb starting point for me. Thanks also for question no 1 (also to @uk59821 ).

Has anybody hints to Questions 2 and 3?

Thanks in advance

On jollyday related github issues there is also a question about vacation … it is unanswered.
I did not try it but it may be possible to do something like


               <tns:FixedWeekdayBetweenFixed weekday="MONDAY" descriptionPropertiesKey="VACATION">
                        <tns:from month="JANUARY" day="19" />
                        <tns:to month="JANUARY" day="25" />
                </tns:FixedWeekdayBetweenFixed>
               <tns:FixedWeekdayBetweenFixed weekday="TUESDAY" descriptionPropertiesKey="VACATION">
                        <tns:from month="JANUARY" day="19" />
                        <tns:to month="JANUARY" day="25" />
                </tns:FixedWeekdayBetweenFixed>
               <tns:FixedWeekdayBetweenFixed weekday="WEDNESDAY" descriptionPropertiesKey="VACATION">
                        <tns:from month="JANUARY" day="19" />
                        <tns:to month="JANUARY" day="25" />
                </tns:FixedWeekdayBetweenFixed>
               <tns:FixedWeekdayBetweenFixed weekday="THURSDAY" descriptionPropertiesKey="VACATION">
                        <tns:from month="JANUARY" day="19" />
                        <tns:to month="JANUARY" day="25" />
                </tns:FixedWeekdayBetweenFixed>
               <tns:FixedWeekdayBetweenFixed weekday="FRIDAY" descriptionPropertiesKey="VACATION">
                        <tns:from month="JANUARY" day="19" />
                        <tns:to month="JANUARY" day="25" />
                </tns:FixedWeekdayBetweenFixed>

FixedWeekdayBetweenFixed is taken from the examples. It is just copied and manipulated with regard to show every weekday ( MONDAY … FRIDAY ).

I think 1 and 2 are answered above. 3 is not possible through Ephemeris as far as I know nor do I know of binding that supports caldav (only iCalendar).

You might be able to make something work through the HTTP binding and actions but it’s probably going to be a lot of work.