forked from AlexxIT/XiaomiGateway3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_models.py
41 lines (35 loc) · 1.01 KB
/
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
34
35
36
37
38
39
40
41
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})")
print(
'BLE\n' + '\n'.join(sorted([
f"- {v[0]} {v[1]} ({v[2]})"
for k, v in BT[0].items()
if len(v) == 3
]))
)
print(
'Mesh Bulbs\n' + '\n'.join(sorted([
f"- {v[0]} {v[1]} ({v[2]})"
for k, v in BT[1].items()
if len(v) == 3 and k != 'params'
]))
)
print(
'Mesh Switches\n' + '\n'.join(sorted([
f"- {v[0]} {v[1]} ({v[2]})"
for d in BT[2:]
for k, v in d.items()
if len(v) == 3 and k != 'params'
]))
)