now.isAfter rule

Hi,

what am I doing wrong? I am using latest docker 2.4 version.

rule "Rolladen etwas früher hoch"
when
    Channel "astro:sun:local:civilDawn#event" triggered START or
Time cron "0 26 7 1/1 * ? *"
then
   if (now.isAfter(Min_Rolladen_Open_Zeit)) {
    logInfo("sonne.rules", "Now is after Min_Rolladen_Open_Zeit")
    EG_Rolladen_Switch.sendCommand(OFF)

} else {
    logInfo("sonne.rules", "Now is before Min_Rolladen_Open_Zeit --> keine Rolladen öffnen")

}
end

I get the following error in the logs:

2020-03-19 07:26:00.734 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Rolladen etwas früher hoch': An error occurred during the script execution: Could not invoke method: org.joda.time.base.AbstractInstant.isAfter(org.joda.time.ReadableInstant) on instance: 2020-03-19T07:26:00.733+01:00

Min_Rolladen_Open_Zeit is defined as:

DateTime Min_Rolladen_Open_Zeit "Min Rolladen Öffnungszeit" <sunrise> (gSonne)  {channel="astro:sun:local:civilDawn#end"}

Thank you,

Daniel

Your rule has two issues:

1 Like

This is also a very good explaination: DateTime Conversion

A quick solution:
if (now.isAfter(new DateTime(Min_Rolladen_Open_Zeit.state.toString) )) {