forked from hellkun/XiaomiGateway3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_models.py
33 lines (27 loc) · 823 Bytes
/
print_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from custom_components.xiaomi_gateway3.core.bluetooth import DEVICES as BT
from custom_components.xiaomi_gateway3.core.utils import DEVICES as ZB
zigbee = {}
for device in ZB:
for k, v in device.items():
if k in ('params', 'mi_spec') or v[1] == 'Gateway 3' or len(v) < 3:
continue
name = f"{v[0]} {v[1]}"
zigbee.setdefault(name, []).append(v[2])
print('Zigbee')
for k, v in sorted(zigbee.items(), key=lambda kv: kv[0]):
models = ','.join(sorted(set(v)))
print(f"- {k} ({models})")
ble = []
mesh = []
for v in BT.values():
if len(v) < 3:
continue
name = f"- {v[0]} {v[1]} ({v[2]})"
if 'Mesh' in name:
mesh.append(name)
else:
ble.append(name)
print('BLE')
print('\n'.join(sorted(ble)))
print('Mesh')
print('\n'.join(sorted(mesh)))