summaryrefslogtreecommitdiffstats
path: root/at.py
diff options
context:
space:
mode:
Diffstat (limited to 'at.py')
-rw-r--r--at.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/at.py b/at.py
index 5f545b8..01347bb 100644
--- a/at.py
+++ b/at.py
@@ -254,30 +254,28 @@ def list_all():
def now_at():
+ result = dict()
devices = app.updater.get_active_devices()
device_infos = list(get_device_infos(g.db, devices.keys()))
device_infos.sort(key=lambda di: devices.__getitem__)
all_unknown = set(devices.keys()) - set(d.hwaddr for d in device_infos)
# das kektop sorting maschine
- kektops = set()
- unknown = set()
- esps = set()
- for u in all_unknown:
- if u.startswith('90:e6:ba:84'):
- kektops.add(u)
- elif u.startswith('5c:cf:7f'):
- esps.add(u)
- else:
- unknown.add(u)
+ unknown = all_unknown
+ for name, prefixes in app.config['SPECIAL_DEVICES'].items():
+ result[name] = set()
+ for u in all_unknown:
+ if u.startswith(prefixes):
+ result[name].add(u)
+ unknown.discard(u)
+ result['unknown'] = unknown
users = {}
for info in device_infos:
if info.owner not in users:
users[info.owner] = devices[info.hwaddr][0]
- users_sorted = sorted(users.items(), key=lambda (u, a): a, reverse=True)
+ result['users'] = sorted(users.items(), key=lambda (u, a): a, reverse=True)
- return dict(users=users_sorted, unknown=unknown, kektops=kektops,
- esps=esps)
+ return result
restrict_to_hs = restrict_ip(prefix=app.config['CLAIMABLE_PREFIX'],