I get the following error during the execution of my rule, See both below:
Error:
2017-12-20 08:29:01.112 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule XYZ: org.eclipse.smarthome.core.library.types.DateTimeType
Rule extract:
import org.joda.time.*
var Timer tRandomLights = null
var randomStarter = null
rule "XYZ"
when
Time cron "0 */10 7-23 * * ?"
then
if (now.isBefore((Sunrise_Time.state as DateTimeType).calendar.timeInMillis) || now.isAfter((Sunset_Time.state as DateTimeType).calendar.timeInMillis)) {
…
}
I have installed the astro binding and created the items Sunrise_Time and Sunset_Time. The rule should be invoked every 10 minutes and work after sunset and before sunrise. But there seems to be an issue with the IF statement
At first, please use hypens (``` for your Code, makes it better to read or use some of those neat Icons on the right side for code fences).
Then to your code. I think, you’re using the actual “Astro”-binding for openHAB2, which means, there’s Things and Channels. Therefore, the code you’re using is for Astro1-binding, which was developed for openHAB1.x
Please check Astro Binding for reference and try this: