Replace it with .getZonedDateTime.toInstant.toEpochMilli
The docs need to updated.
If you apply Design Pattern: How to Structure a Rule you can greatly reduce the lines of code and number of indents which will make the rule easier to expand or update in the future.
rule "Muellabfuhr Benachrichtigung Termin1"
when
Item CurrentDate changed
then
var newMuellswitch = OFF
var newGreen = OFF
var tts = ""
if(now.isAfter(new DateTime((CalDav_Date.state as DateTimeType).getZonedDateTime.toInstant.toEpochMilli).minusMinutes(870) &&
now.isBefore(new DateTime((CalDav_DateE.state as DateTimeType).getZonedDateTime.toInstant.toEpochMilli).minusMinutes(870) &&
Muellswitch.state == OFF) {
newGreen = ON
newMuellswitch = ON
switch CalDav_Muelltonne.state {
case "Leichtverpackungen": tts = 'Hallo zusammen! Morgen wird der gelbe Sack und der Hausmüll abgeholt. Könnt Ihr diese bitte rausstellen! Dank euch!'
case "Restabfall": tts = 'Hallo zusammen! Morgen wird der Hausmüll abgeholt. Könnt Ihr diesen bitte rausstellen! Dank euch!'
case "Bioabfall": tts = 'Hallo zusammen! Morgen wird der Biomüll abgeholt. Könnt Ihr diesen bitte rausstellen! Dank euch!'
case "Papier": tts = 'Hallo zusammen! Morgen wird der Papiermüll abgeholt. Könnt Ihr diesen bitte rausstellen! Dank euch!'
}
}
if(Muellswitch.state != newMuellswitch) Muellswitch.sendCommand(newMuellswitch)
if(newGreen == ON) {
green.sendCommand(newGreen)
Wohnzimmer_TTS.sendCommand(tts)
}
end