2015-11-11 21:25:15 [INFO ] [e.smarthome.model.script.test1:48 ] - sunrise = Sunrise (Type=DateTimeItem, State=2015-11-11T07:30:00, Label=Sunrise, Category=null)
2015-11-11 21:25:15 [INFO ] [e.smarthome.model.script.test2:48 ] - sunrise = Sunset (Type=DateTimeItem, State=2015-11-11T16:09:00, Label=Sunset, Category=null)
2015-11-11 21:25:15 [ERROR] [.s.m.s.e.ScriptExecutionThread:48 ] - Error during the execution of rule 'Landing Motion Detected': The name '<XFeatureCallImplCustom>.afterNow' cannot be resolved to an item or type.
So tests 1 & 2 work, but we fail before test3 completes. Please don’t judge me on the use of afterNow or beforeNow - I’ve tried a lot of things and that’s the latest unsuccessful attempt. Has the use of ‘now’ changed in OH2? Am I just using wrong types? Can someone make the line work? After that I can apply it to all of the rest of my rules.
Are you sure that this code works on openHAB 1?
Already the line
var DateTime daystart = Sunrise.state
looks very wrong to me. “Sunrise.state” is of an openHAB type, i.e. DateTimeType, but not org.joda.time.DateTime. In fact, there is no dependency from openHAB types to Joda at all.
What does it output if you change the second line to