From 48a17446391aa70d0713a76fda3b914f30ea28ff Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sat, 20 Sep 2014 21:16:37 +0200 Subject: [PATCH] firstseen --- node.py | 1 + nodedb.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/node.py b/node.py index fce1866..bece59c 100644 --- a/node.py +++ b/node.py @@ -12,6 +12,7 @@ class Node(): self.firmware = None self.clientcount = 0 self.lastseen = 0 + self.firstseen = 0 def add_mac(self, mac): mac = mac.lower() diff --git a/nodedb.py b/nodedb.py index a45c7a1..d0d081d 100644 --- a/nodedb.py +++ b/nodedb.py @@ -31,6 +31,7 @@ class NodeDB: obj.append({ 'id': node.id , 'name': node.name , 'lastseen': node.lastseen + , 'firstseen': node.firstseen , 'geo': node.gps }) @@ -53,6 +54,9 @@ class NodeDB: node.gps = n['geo'] self._nodes.append(node) + if 'firstseen' in n: + node.firstseen = n['firstseen'] + except: pass @@ -80,6 +84,7 @@ class NodeDB: except: node = Node() node.lastseen = self.time + node.firstseen = self.time node.flags['online'] = True self._nodes.append(node) @@ -97,6 +102,7 @@ class NodeDB: except: node = Node() node.lastseen = self.time + node.firstseen = self.time node.flags['online'] = True node.add_mac(x['router']) self._nodes.append(node) @@ -115,6 +121,7 @@ class NodeDB: except: node = Node() node.lastseen = self.time + node.firstseen = self.time node.flags['online'] = True node.add_mac(x['neighbor']) self._nodes.append(node)