firstseen

legacy
Nils Schneider 2014-09-20 21:16:37 +02:00
parent 65655a38bb
commit 48a1744639
2 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ class Node():
self.firmware = None self.firmware = None
self.clientcount = 0 self.clientcount = 0
self.lastseen = 0 self.lastseen = 0
self.firstseen = 0
def add_mac(self, mac): def add_mac(self, mac):
mac = mac.lower() mac = mac.lower()

View File

@ -31,6 +31,7 @@ class NodeDB:
obj.append({ 'id': node.id obj.append({ 'id': node.id
, 'name': node.name , 'name': node.name
, 'lastseen': node.lastseen , 'lastseen': node.lastseen
, 'firstseen': node.firstseen
, 'geo': node.gps , 'geo': node.gps
}) })
@ -53,6 +54,9 @@ class NodeDB:
node.gps = n['geo'] node.gps = n['geo']
self._nodes.append(node) self._nodes.append(node)
if 'firstseen' in n:
node.firstseen = n['firstseen']
except: except:
pass pass
@ -80,6 +84,7 @@ class NodeDB:
except: except:
node = Node() node = Node()
node.lastseen = self.time node.lastseen = self.time
node.firstseen = self.time
node.flags['online'] = True node.flags['online'] = True
self._nodes.append(node) self._nodes.append(node)
@ -97,6 +102,7 @@ class NodeDB:
except: except:
node = Node() node = Node()
node.lastseen = self.time node.lastseen = self.time
node.firstseen = self.time
node.flags['online'] = True node.flags['online'] = True
node.add_mac(x['router']) node.add_mac(x['router'])
self._nodes.append(node) self._nodes.append(node)
@ -115,6 +121,7 @@ class NodeDB:
except: except:
node = Node() node = Node()
node.lastseen = self.time node.lastseen = self.time
node.firstseen = self.time
node.flags['online'] = True node.flags['online'] = True
node.add_mac(x['neighbor']) node.add_mac(x['neighbor'])
self._nodes.append(node) self._nodes.append(node)