I’ve tried the following, unfortunately without success:
....
from dateutil.parser import parse
....
MeterUseSum = PersistenceExtensions.sumSince(ir.getItem("ZWaveNode2_PowerNode_ElectricMeterkwH_Day"), parse("2019-03-01")) # line 19
openhab.log:
2020-03-05 19:11:46.779 [ERROR] [ion.module.script.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/personal/powerusage.py': ImportError: No module named dateutil in <script> at line number 19
Persistence currently uses Joda, but that has been changed in OH 3.0. For this, you need an AbstractInstant. You’ve shown a day and month, but what time of day? Assuming 0:00…
from org.joda.time import DateTime
MeterUseSum = PersistenceExtensions.sumSince(ir.getItem("ZWaveNode2_PowerNode_ElectricMeterkwH_Day"), DateTime.now().withYear(2019).withMonthOfYear(3).withDayOfMonth(1).withTime(0, 0, 0, 0)) # line 67
I like doing it this way, because it’s more readable, but you could also do…