Skip to content

Commit 470f408

Browse files
committed
Treat empty values from syncvalues as None
Elsewhere it's assumed that unavailable values are either not set in state dictionary or are None. Where empty strings are used it's logging some warnings about float conversions which aren't needed.
1 parent 64ba6ed commit 470f408

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

custom_components/wundasmart/pywundasmart.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def parse_syncvalues(data: str):
8080
for device_state in data.splitlines():
8181
raw_values = device_state.split(";")
8282
device_values = {
83-
k: urllib.parse.unquote(v) for k, v in (
83+
k: (urllib.parse.unquote(v) if v else None)
84+
for k, v in (
8485
x.split(":") for x in raw_values if ":" in x
8586
)
8687
}
@@ -90,7 +91,7 @@ def parse_syncvalues(data: str):
9091
if device_sn is None:
9192
raise RuntimeError("No device_sn found")
9293

93-
hw_version = hw_version or float(device_values.get("device_hard_version", 0.0))
94+
hw_version = hw_version or float(device_values.get("device_hard_version") or 0.0)
9495
if not hw_version:
9596
raise RuntimeError("No device_hard_version found")
9697

0 commit comments

Comments
 (0)