Openhab 2 doesn't understand now variable

Hey community,

I got a problem with a rule.

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import java.lang.Math
import java.util.Calendar
import java.util.Date
import java.util.TimeZone
import java.text.SimpleDateFormat
import org.openhab.action.squeezebox.*
import org.joda.time.*

rule "Heizung ON"
	when
		Item OG_TEMP_Esszimmer changed or
		Item OG_Heizung_TimeStartMessage changed or
		Item OG_Heizung_TimeEndMessage changed
	then
		var hour   = now.getHourOfDay
                var minute = now.getMinuteOfHour
		var TEMP = OG_TEMP_Esszimmer.state as DecimalType
		var int ACT_TIME = hour.intValue * 60 + minute.intValue
		var int START_TIME = (OG_Heizung_Ein_TimeHour.state as DecimalType).intValue * 60 + (OG_Heizung_Ein_TimeMinute.state as DecimalType).intValue
		var int END_TIME = (OG_Heizung_Aus_TimeHour.state as DecimalType).intValue * 60 + (OG_Heizung_Aus_TimeMinute.state as DecimalType).intValue
		
		if (TEMP < OG_Heizung_Esszimmer.state as DecimalType) {
			if ( ACT_TIME > START_TIME) && ( ACT_TIME < END_TIME) {
				if ( MOB137 == ON) || ( MOB188 == ON) {
					sendCommand(OG_Heizung, ON)
				}
			}
		} else {
			sendCommand(OG_Heizung, OFF)
		}
end

the openhab.log give me only this information.

2016-12-09 21:44:33.495 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Heizung ON': An error occured during the script execution: Unhandled parameter types: [null, org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext@11d55b, org.eclipse.xtext.util.CancelIndicator$1@6df8d]

I figurate out its the “now.” variable

Could anyone of you tell me what I’m doing wrong.

For one thing, if you are truly running this on OH 2, your imports are wrong.

In OH 2 everything that was once in org.openhab.core and org.openhab.model have moved to new packages.

Furthermore, these imports and the import for org.joda.time.* are not longer needed so those four imports should be removed.

After hours of trying I solved the problem.

rule "Heizung ON"
when
	Item OG_TEMP_Esszimmer changed or
	Item OG_Heizung_TimeStartMessage changed or
	Item OG_Heizung_TimeEndMessage changed or
	Item OG_Heizung_Esszimmer changed
then
	var hour = now.getHourOfDay
	var minute = now.getMinuteOfHour
	var TEMP = OG_TEMP_Esszimmer.state as DecimalType
	var ACT_TIME = hour * 60 + minute
	var START_TIME = (OG_Heizung_Ein_TimeHour.state as DecimalType) * 60 + (OG_Heizung_Ein_TimeMinute.state as DecimalType)
	var END_TIME = (OG_Heizung_Aus_TimeHour.state as DecimalType) * 60 + (OG_Heizung_Aus_TimeMinute.state as DecimalType)
	postUpdate(ACT_TIME1, ACT_TIME)
	postUpdate(START_TIME1, START_TIME)
	postUpdate(END_TIME1, END_TIME)
	
	if (TEMP < OG_Heizung_Esszimmer.state as DecimalType) {
		if ( ACT_TIME > START_TIME &&  ACT_TIME < END_TIME) {
			//if ( MOB137 == ON || MOB188 == ON) {
				sendCommand(OG_Heizung, ON)
			//} 
		}
	} else {
		if (TEMP > OG_Heizung_MIN.state as DecimalType) {
			sendCommand(OG_Heizung, OFF)
		}
	}			

end

I removed to define the values as integer and the IF was incorrect.