I’m experiencing a strange behaviour with isAfter and isBefore. The result is not as expected. It is before and after the time the same. See code and result below.
Worth to mention is that it used to work. But than I updated the Jython package from 2.7.0 to 2.7.2 and also the helper libraries from 05.08.20 to 30.11.20. I don’t see that this should have an impact to these functions. Might there be a configuration I have overwritten?
OH is 2.5.10.
******************************************************************************* Jython version: 2.7.2.final Operating system: Linux OS Version: 4.19.66-v7+ Java vendor: Oracle Corporation Java VM name: Java HotSpot(TM) Client VM Java runtime name: Java(TM) SE Runtime Environment Java runtime version: 1.8.0_181-b13 configuration.py installed: True sys.path: /etc/openhab2/automation/lib/python /etc/openhab2/automation/jython/Lib /etc/openhab2/automation/jython/jython-standalone-2.7.2.jar/Lib __classpath__ __pyclasspath__/ *******************************************************************************
@rule("Rolladen: Rolladen am Morgen rauf")
@when("Item swi_Astro_Nacht changed to OFF")
@when("Time cron 33 59 7 ? * *")
def RollershutterOpenAtMorning(event):
Time8000 = DateTime.now().withTime(7, 30, 59, 30) # 8 Uhr morgens (7:59:30)
Before8 = DateTime.now().isBefore(Time8000)
After8 = DateTime.now().isAfter(Time8000)
BankHoliday = Ephemeris.isBankHoliday()
Weekend = Ephemeris.isWeekend()
LogAction.logInfo("Rolladen: RollershutterOpenAtMorning", "vor 8: {}, nach 8: {}, Feiertag: {}, Wochenende: {}".format(Before8, After8, BankHoliday, Weekend))
The resulting log is:
03-Dez-2020 07:34:01.295 [INFO ] [Rolladen: RollershutterOpenAtMorning] - vor 8: 0, nach 8: 1, Feiertag: 0, Wochenende: 0 03-Dez-2020 07:59:33.555 [INFO ] [Rolladen: RollershutterOpenAtMorning] - vor 8: 0, nach 8: 1, Feiertag: 0, Wochenende: 0