diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-05-12 04:33:32 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-05-12 04:33:32 +0300 |
commit | f2a7cafc9be2e1e2ad01c77917108b76624e4a66 (patch) | |
tree | e67646ebcdb5c6674bca26b1c8004740b0e00b26 /src/temphum_nodes_util.py | |
parent | 883f3181392b1f46c9299cf28396cf635c8ac492 (diff) |
temphum: refactoring in progress
Diffstat (limited to 'src/temphum_nodes_util.py')
-rwxr-xr-x | src/temphum_nodes_util.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/temphum_nodes_util.py b/src/temphum_nodes_util.py new file mode 100755 index 0000000..c700ca8 --- /dev/null +++ b/src/temphum_nodes_util.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +from home.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}') |