Compare commits

...

2 commits

Author SHA1 Message Date
Daniel Ehlers 01fa5e7a0b nodedb.py: Transport new data to node entry 2014-02-09 15:27:25 +01:00
Daniel Ehlers 02a2862ca9 alfred.py: Transfer more data from alfred into the alias list 2014-02-09 15:27:25 +01:00
2 changed files with 44 additions and 5 deletions

View file

@ -13,12 +13,36 @@ class alfred:
for mac,node in alfred_data.items():
node_alias = {}
if 'location' in node:
node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude'])
if 'latitude' in node['location'] and 'longitude' in node['location']:
node_alias['gps'] = str(node['location']['latitude']) + ' ' + str(node['location']['longitude'])
try:
node_alias['firmware'] = node['software']['firmware']['release']
except KeyError:
pass
if 'software' in node:
if 'firmware' in node['software']:
if 'base' in node['software']['firmware']:
node_alias['firmware-base'] = node['software']['firmware']['base']
if 'release' in node['software']['firmware']:
node_alias['firmware'] = node['software']['firmware']['release']
if 'autoupdater' in node['software']:
if 'branch' in node['software']['autoupdater']:
node_alias['autoupdater-branch'] = node['software']['autoupdater']['branch']
if 'enabled' in node['software']['autoupdater']:
node_alias['autoupdater-enabled'] = node['software']['autoupdater']['enabled']
if 'fastd' in node['software']:
if 'enabled' in node['software']['fastd']:
node_alias['fastd-enabled'] = node['software']['fastd']['enabled']
if 'version' in node['software']['fastd']:
node_alias['fastd-version'] = node['software']['fastd']['version']
if 'hardware' in node:
if 'model' in node['hardware']:
node_alias['hardware-model'] = node['hardware']['model']
if 'network' in node:
if 'gateway' in node['network']:
node_alias['selected-gateway'] = node['network']['gateway']
if 'hostname' in node:
node_alias['name'] = node['hostname']

View file

@ -188,6 +188,21 @@ class NodeDB:
if 'firmware' in alias:
node.firmware = alias['firmware']
if 'firmware-base' in alias:
node.firmware-base = alias['firmware-base']
if 'hardware-model' in alias:
node.hardware-model = alias['hardware-model']
if 'selected-gateway' in alias:
node.selected-gateway = alias['selected-gateway']
if 'autoupdater-branch' in alias:
node.autoupdater-branch = alias['autoupdater-branch']
if 'autoupdater-enabled' in alias:
node.autoupdater-branch = alias['autoupdater-enabled']
# list of macs
# if options['gateway']:
# mark_gateways(options['gateway'])