diff --git a/alfred.py b/alfred.py index c0f9d13..086ebc7 100755 --- a/alfred.py +++ b/alfred.py @@ -14,6 +14,12 @@ class alfred: node_alias = {} if 'location' in node: node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude']) + + try: + node_alias['firmware'] = node['software']['firmware']['release'] + except KeyError: + pass + if 'hostname' in node: node_alias['name'] = node['hostname'] elif 'name' in node: diff --git a/d3mapbuilder.py b/d3mapbuilder.py index 0d824be..3daf1ee 100644 --- a/d3mapbuilder.py +++ b/d3mapbuilder.py @@ -15,6 +15,7 @@ class D3MapBuilder: output['nodes'] = [{'name': x.name, 'id': x.id, 'macs': ', '.join(x.macs), 'geo': [float(x) for x in x.gps.split(" ")] if x.gps else None, + 'firmware': x.firmware, 'flags': x.flags } for x in nodes] diff --git a/node.py b/node.py index bcd5cdd..ba0c3b0 100644 --- a/node.py +++ b/node.py @@ -10,6 +10,7 @@ class Node(): "client": False }) self.gps = None + self.firmware = None def add_mac(self, mac): mac = mac.lower() diff --git a/nodedb.py b/nodedb.py index 6e77717..b6c2a76 100644 --- a/nodedb.py +++ b/nodedb.py @@ -185,6 +185,9 @@ class NodeDB: if 'gps' in alias: node.gps = alias['gps'] + if 'firmware' in alias: + node.firmware = alias['firmware'] + # list of macs # if options['gateway']: # mark_gateways(options['gateway'])