def getItemLastChange(itemOrName): item = _getItem(itemOrName) lastChange = PersistenceExtensions.lastUpdate(item, "jdbc") if lastChange is None: raise NotInitialisedException("Item lastChange for '" + item.getName() + "' not found") return lastChange
def getItemLastUpdate(itemOrName): item = _getItem(itemOrName) lastUpdate = PersistenceExtensions.lastUpdate(item) if lastUpdate is None: return ZonedDateTime.ofInstant(Instant.ofEpochMilli(0), ZoneId.systemDefault()) #raise NotInitialisedException("Item lastUpdate for '" + item.getName() + "' not found") return lastUpdate
def getLastUpdate(self): ''' Returns the sensors last update time (if available). type is 'org.joda.time.DateTime', http://joda-time.sourceforge.net/apidocs/org/joda/time/DateTime.html ''' try: lastUpdate = PersistenceExtensions.lastUpdate( itemRegistry.getItem(self.name)).toDateTime() except: lastUpdate = DateTime(0) self.log.info('Could not retrieve persistence data for sensor: ' + self.name.decode('utf8')) return lastUpdate
def lastUpdate(item, serviceName=None): return pe.lastUpdate( item, serviceName) if serviceName is not None else pe.lastUpdate(item)