Dear all,
please see parts of my implemented rule:
# Set latest End Time
events.sendCommand(ir.getItem(item.name + '_EndTime'), ZonedDateTime.now().toLocalDateTime().toString())
# Calculate latest Running Time
dtStartTime = ir.getItem(item.name + '_StartTime').state.getZonedDateTime()
log.debug(dtStartTime)
dtEndTime = ir.getItem(item.name + '_EndTime').state.getZonedDateTime()
log.debug(dtEndTime)
if isinstance(ir.getItem(item.name + '_RunningTime').state, UnDefType):
longRunningTimeExecuted = 0
else:
longRunningTimeExecuted = ir.getItem(item.name + '_RunningTime').state.intValue()
longRunningTime = dtStartTime.until(dtEndTime, ChronoUnit.MINUTES) + longRunningTimeExecuted
The Endtime was set to 0 (1970-01-01T00:00Z) by another rule before.
When I’m looking in the UI, I can see that the EndTime item has the expected value. But the RunningTime is calculated on the basis of 1970-01-01T00:00Z
Does the update of the item take longer time then the processing of the next lines of code?