aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schneider <nils@nilsschneider.net>2014-05-02 10:49:01 +0200
committerNils Schneider <nils@nilsschneider.net>2014-05-02 10:49:32 +0200
commit26fc2a9aef905b0ce32c8a93cc99a4fda15d597d (patch)
tree8616be69df4d82ce7728de95508438d0e3b5c44d
parentb3a921347c7a15aae6e62e163e0d99adab684ce6 (diff)
alfred: use network.mac as ID if present
-rwxr-xr-xalfred.py5
-rw-r--r--nodedb.py3
2 files changed, 8 insertions, 0 deletions
diff --git a/alfred.py b/alfred.py
index c92bc12..63296c9 100755
--- a/alfred.py
+++ b/alfred.py
@@ -23,6 +23,11 @@ class alfred:
except KeyError:
pass
+ try:
+ node_alias['id'] = node['network']['mac']
+ except KeyError:
+ pass
+
if 'hostname' in node:
node_alias['name'] = node['hostname']
elif 'name' in node:
diff --git a/nodedb.py b/nodedb.py
index 6a4726f..25c0e8c 100644
--- a/nodedb.py
+++ b/nodedb.py
@@ -191,6 +191,9 @@ class NodeDB:
if 'firmware' in alias:
node.firmware = alias['firmware']
+ if 'id' in alias:
+ node.id = alias['id']
+
# list of macs
# if options['gateway']:
# mark_gateways(options['gateway'])