# HG changeset patch # User drewp@bigasterisk.com # Date 1460618064 25200 # Node ID 4685fbd208d1a12a2bdd434e7104e028bd89a5d0 # Parent 1ae78fe6f36e3043bf823a4e8af82db90af4e4ee 'seesRecently30' in piNode Ignore-this: 551255c6d6eb3e791c5a61eb59f2aec8 diff -r 1ae78fe6f36e -r 4685fbd208d1 service/piNode/devices.py --- a/service/piNode/devices.py Thu Apr 14 00:13:06 2016 -0700 +++ b/service/piNode/devices.py Thu Apr 14 00:14:24 2016 -0700 @@ -146,23 +146,26 @@ return {'latest': [ (self.uri, ROOM['sees'], ROOM['motion'] if motion else ROOM['noMotion']), - self.recentMotionStatement(motion), - ], 'oneshot': oneshot} + ] + self.recentMotionStatements(motion), + 'oneshot': oneshot} - def recentMotionStatement(self, motion): + def recentMotionStatements(self, motion): if not hasattr(self, 'lastMotionTime'): self.lastMotionTime = 0 now = time.time() if motion: self.lastMotionTime = now - recentMotion = now - self.lastMotionTime < 60 * 10 - return (self.uri, ROOM['seesRecently'], - ROOM['motion'] if recentMotion else ROOM['noMotion']) + dt = now - self.lastMotionTime + return [(self.uri, ROOM['seesRecently'], + ROOM['motion'] if (dt < 60 * 10) else ROOM['noMotion']), + (self.uri, ROOM['seesRecently30'], + ROOM['motion'] if (dt < 30) else ROOM['noMotion'])] def watchPrefixes(self): return [ (self.uri, ROOM['sees']), (self.uri, ROOM['seesRecently']), + (self.uri, ROOM['seesRecently30']), ]