ich habe heute morgen meinen Alexa Family Report angepasst, weil mir Geburtstage angesagt wurden, die noch weit in der Zukunft liegen.
Kurz zum Aufbau.
Ich baue mir über Ephemeris die Termine zusammen und nutze sie dann in der Rule
Code: Alles auswählen
val long untBirth = Ephemeris.getDaysUntil(nextBirth, '/etc/openhab/services/anniversaries.xml')
Code: Alles auswählen
aText += "<amazon:effect name='whispered'>"
if (untBirth >= 2) {aText += "Übrigens, in " + untBirth + " Tagen ist " + nextBirth "."}
if (untBirth == 1) {aText += "Übrigens, morgen ist " + nextBirth "."}
if (untBirth == 0) {aText += "Heute ist " + nextBirth ". Juhuuuuu"}
aText += "</amazon:effect>"
Code: Alles auswählen
if (untBirth <= 30) {
aText += "<amazon:effect name='whispered'>"
if (untBirth >= 2) {aText += "Übrigens, in " + untBirth + " Tagen ist " + nextBirth "."}
if (untBirth == 1) {aText += "Übrigens, morgen ist " + nextBirth "."}
if (untBirth == 0) {aText += "Heute ist " + nextBirth ". Juhuuuuu"}
aText += "</amazon:effect>"
}
Code: Alles auswählen
2021-04-12 08:46:03.213 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'AlexaFamilyReport.rules', using it anyway:
This expression is not allowed in this context, since it doesn't cause any side effects.
Code: Alles auswählen
if (untBirth <= 30)
Code: Alles auswählen
if
aText += "<amazon:effect name='whispered'>"
if (untBirth >= 2) {aText += "Übrigens, in " + untBirth + " Tagen ist " + nextBirth "."}
if (untBirth == 1) {aText += "Übrigens, morgen ist " + nextBirth "."}
if (untBirth == 0) {aText += "Heute ist " + nextBirth ". Juhuuuuu"}
aText += "</amazon:effect>"
Beste Grüße