summaryrefslogtreecommitdiff
path: root/bin/temphum_nodes_util.py
blob: 4015f19888cb5d06df9a4249cd5bacbafbbdb3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
import include_homekit

from homekit.mqtt.temphum import MqttTempHumNodes

if __name__ == '__main__':
    max_name_len = 0
    for node in MqttTempHumNodes:
        if len(node.name) > max_name_len:
            max_name_len = len(node.name)

    values = []
    for node in MqttTempHumNodes:
        hash = node.hash()
        if hash in values:
            raise ValueError(f'collision detected: {hash}')
        values.append(values)
        print(' '*(max_name_len-len(node.name)), end='')
        print(f'{node.name}: {hash}')