Ephemeris Rule


i am running OH2.5 and got trouble with an Ephemeris Rule.

rule "Wichtiger Tag"
        Time cron "0 0 1 ? * * *" or 
        Item Dummy received update or 
        System started
        val String naechsterTag          =   Ephemeris.getNextBankHoliday('/etc/openhab2/services/wichtige_tage.xml')
        val long TagebiswichtigerTag    =   Ephemeris.getDaysUntil(naechsterTag, '/etc/openhab2/services/wichtige_tage.xml')

        // wichtigerTag.postUpdate(TagebiswichtigerTagAnzeige.toString)
      var int zahlversuch = (TagebiswichtigerTagAnzeige.state as Number).intValue
      var wichtigerTagDatumCalc = now.plusDays(zahlversuch)  
      wichtigerTag.postUpdate(naechsterTag + "  " + wichtigerTagDatumCalc.toString("dd-MM-yyyy") + ", noch " + TagebiswichtigerTag.toString + " Tage " )

        if (TagebiswichtigerTag < 1) {
            logInfo("Info","Heutiges Event: " + naechsterTag)
        else {
            logInfo("Info","Heute liegt nichts an. Nächster wichtiger Tag: " + naechsterTag + " " + wichtigerTagDatumCalc + ", noch " + TagebiswichtigerTag + " Tage")

When it runs with the cronjob it gets the day wrong “Geburtstag Sandra 2021-03-11”. The Birthday is on the 10th. The 10th is specified as day in the xml file.
If i run it with the dummy trigger, it works correct and shows the 10th as Birthday “Geburtstag Sandra 2021-03-10”.
The day count towards that day is correct in both cases…

Please, if anyone has an idea, let me know. My Brain allready hurts :slight_smile:

Thnx in advance

The cron runs at 01:00, right ?
What if - just for test purposes - you would run it at e.g. 14:00. It it correct then ?
Your timezone is configured correct ?
In case you go to the karaf console and check it from there is it set to the correct one ?

env | grep timezone

the Timezone is correct.
I tried different times, 04:00, 06:00 etc. and all have the same behaviour. Ill try again with times in the evening to see if there is any hour difference etc.


what you also could do to get more insight in what is happening is to do more logInfo statemens.
Log the content of your variables then you have more knowledge about the content of them and you might get a clue what the difference is.