round complex numbers to account for SML provided precision

This commit is contained in:
Andreas Thienemann 2022-02-26 18:49:35 +01:00
parent d9ab8d9d96
commit ab6d472510

View File

@ -68,7 +68,7 @@ class TasmotaSMLParser:
precision = 0 precision = 0
try: try:
human_readable = f"{msg.value * pow(10, msg.scaler)}{unit} ({name})" human_readable = f"{round(msg.value * pow(10, msg.scaler), precision)}{unit} ({name})"
except TypeError: except TypeError:
if msg.unit in UNITS and msg.name in OBIS_NAMES: if msg.unit in UNITS and msg.name in OBIS_NAMES:
human_readable = f"{msg.value}{unit} ({name})" human_readable = f"{msg.value}{unit} ({name})"