Skip to content

Commit

Permalink
workaround for non-standard smart response, ref #109
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Apr 25, 2023
1 parent e78254f commit da3e3a8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/openmediavault/apiparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ def from_entry(entry, param, default="") -> str:
if isinstance(default, str):
ret = str(ret)
elif isinstance(default, int):
if " " in ret:
ret_tmp = ret.split(" ")
ret = ret_tmp[0]

ret = int(ret)
elif isinstance(default, float):
if " " in ret:
ret_tmp = ret.split(" ")
ret = ret_tmp[0]

ret = round(float(ret), 2)

return ret[:255] if isinstance(ret, str) and len(ret) > 255 else ret
Expand Down

0 comments on commit da3e3a8

Please sign in to comment.