Besseres Fehlerverhalten bei fehlendem Scaler
This commit is contained in:
parent
4fcf826e03
commit
ce17b68bfb
1 changed files with 9 additions and 5 deletions
|
|
@ -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:
|
||||
except:
|
||||
try:
|
||||
human_readable = f"{msg.value}{unit}"
|
||||
else:
|
||||
except:
|
||||
try:
|
||||
human_readable = f"{msg.value}"
|
||||
except:
|
||||
human_readable = ""
|
||||
|
||||
data = {
|
||||
"obis": msg.obis,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue