Hi, I run into problems with the migration this days from openHAB 2.5 to 3.0 with my rules, which use the now.getMinuteOfDay method. It seems, that this method is not available anymore. I used this for Time comparison to see, if a special time or an astro time is the first one, which should be used. One example:
var aktuelle_zeit = now.getMinuteOfDay
var buergerliche_abenddaemmerung = new DateTime(astro_buergerliche_abenddaemmerung_startzeit.state.toString).getMinuteOfDay
if (aktuelle_zeit == 1140 || buergerliche_abenddaemmerung <= 1140) {
r_eg_badezimmer_rolllade_fenster.sendCommand(DOWN)
logInfo("rolladensteuerung.rules", "Badezimmerrolllade geschlossen")
}
I looked here, but did not understand what to do. I also read the Release notes, but there was no sentence about getMinuteofDay.
If you go back to the release notes, scroll down to Rules. Does the date related information there, and the link(s) help?
Rules now use Java Time API instead of Jodatime so some expressions need to be adapted:
getHourOfDay → getHour, getMinuteOfHour → getMinute, getMonthOfYear → getMonthValue
Some simple >and < comparisons may no longer work and you may need to use isAfter()/isBefore() instead.
See also this thread for more information.
I changed my rules by writing an lambda.
val getMinuteOfDay= [ZonedDateTime x |
val int minutesOfDay= (x.getHour() * 60) + x.getMinute()
minutesOfDay
]
and using like this: val int tSunrise = getMinuteOfDay.apply((dtSunrise_Time.state as DateTimeType).zonedDateTime)