diff --git a/sml_decoder.py b/sml_decoder.py index 5b0f091..50044e0 100755 --- a/sml_decoder.py +++ b/sml_decoder.py @@ -84,12 +84,16 @@ class TasmotaSMLParser: f"{round(msg.value * pow(10, msg.scaler), precision)}{unit} ({name})" ) except TypeError: - if msg.unit in UNITS and msg.name in OBIS_NAMES: + try: human_readable = f"{msg.value}{unit} ({name})" - elif msg.unit in UNITS and msg.name not in OBIS_NAMES: - human_readable = f"{msg.value}{unit}" - else: - human_readable = f"{msg.value}" + except: + try: + human_readable = f"{msg.value}{unit}" + except: + try: + human_readable = f"{msg.value}" + except: + human_readable = "" data = { "obis": msg.obis,