Use until datetime on rule based on datetime item

Try

val mins_between = Duration.between((HouseAlarmOff.state as DateTimeType).zonedDateTime, now).toMinutes

I hate RulesDSL’s primitively verbose type casting. It makes a very messy code that is harder to read.

Consider switching to JRuby. This is the syntax in JRuby:

mins_between = (Time.now - HouseAlarmOff.state).to_minutes

Date/time calculation and comparisons, as with almost everything else, are much more straight forward in JRuby.