Ich habe meinen eigene Geburtstags.xml angelegt und möchte nun zu dem nächsten Geburtstag auch noch den übernächsten angezeigt bekommen.
Dazu möchte ich Ephemeris.getNextBankHoliday(<offset>,<file>) verwenden und habe ich folgende Rule erstellt:
Code: Alles auswählen
rule "Ephemeris Regel"
when System started
//or Time cron "0 0 * * * ?"
or Time cron "15 * * * * ?"
then
//Geburtstage
val String nextGeburtstag = Ephemeris.getNextBankHoliday('/srv/openhab2-conf/services/Eph_Geburtstage.xml')
val long untilGeburtstag = Ephemeris.getDaysUntil(nextGeburtstag, '/srv/openhab2-conf/services/Eph_Geburtstage.xml')
Geburtstag_next.postUpdate(nextGeburtstag)
Geburtstag_until.postUpdate(untilGeburtstag)
if(Eph_log) logInfo("Ephemeris >>>","1: " + Geburtstag_next.state + "`s Geburtstag in "+ Geburtstag_until.state + " Tagen!")
var int offset = Geburtstag_until.state as Number
val String nextGeburtstag2 = Ephemeris.getNextBankHoliday(offset,'/srv/openhab2-conf/services/Eph_Geburtstage.xml')
val long untilGeburtstag2 = Ephemeris.getDaysUntil(nextGeburtstag2, '/srv/openhab2-conf/services/Eph_Geburtstage.xml')
Geburtstag_2_next.postUpdate(nextGeburtstag2)
Geburtstag_2_until.postUpdate(untilGeburtstag2)
if(Eph_log) logInfo("Ephemeris >>>","2: " + Geburtstag_2_next.state + "`s Geburtstag in "+ Geburtstag_2_until.state + " Tagen!")
Code: Alles auswählen
var int offset = Geburtstag_until.state as Number
Code: Alles auswählen
2020-03-01 16:44:15.026 [INFO ] [smarthome.model.script.Ephemeris >>>] - 1: Melanie`s Geburtstag in 18 Tagen!
2020-03-01 16:44:15.031 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Ephemeris Regel': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.Ephemeris.getNextBankHoliday(int,java.lang.String) on instance: null
Wenn ich anstatt Offset eine direkte Zahl eingebe, funktioniert es.
Code: Alles auswählen
val String nextGeburtstag2 = Ephemeris.getNextBankHoliday(20,'/srv/openhab2-conf/services/Eph_Geburtstage.xml')
Danke vorab
Morty