Failed: 'getMinuteOfDay'

Dear all,
I need an advice.
I have just moved from OH 2.5 to OH3.

The following rule doesn’t work anymore:


when
Item Ingresso_IR changed from OFF to ON
then
if (now.getMinuteOfDay > 1380 || now.getMinuteOfDay < 360 + 45 ) {
Tasmota_02.sendCommand(ON)
createTimer (now.plusMinutes(5), [ | Tasmota_02.sendCommand(OFF) ] )
}
end


and the below error messages is in the log:

… failed: ‘getMinuteOfDay’ is not a member of ‘java.time.ZonedDateTime’…

Can you suggest how to fix it?

Thanks

Check this. Should help DateTime Conversion (openHAB 3.x)

Add this to the top of your rule file

import org.openhab.core.model.script.ScriptServiceUtil

val getMinuteOfDay= [ZonedDateTime x |
    val int minutesOfDay= (x.getHour() * 60) + x.getMinute()
    minutesOfDay
]

and your item code changes to

            var curTime = new DateTimeType(BlindsClosedBy.state.toString("yyyy-MM-dd'T'HH:mm:00.000Z")).zonedDateTime
            blindsClosedBy = getMinuteOfDay.apply(curTime)

I don’t understand your currTime line. BlindsClosedBy is already a DateTimeType. So why create a new DateTimeType by forcing it to parse the DateTimeType you already have? Why not

var currTime = (BlindsClosedBy.state as DateTimeType).getZonedDateTime