Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove float conversions and let None values through #121

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions custom_components/weatherlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ def _preprocess(indata: str): # noqa: C901
0
][f"wet_leaf_{numb}"]
outdata[tx_id][DataKey.BAR_SEA_LEVEL] = sensor["data"][0]["bar"]
outdata[tx_id][DataKey.BAR_TREND] = (
float(sensor["data"][0].get("bar_trend", 0)) / 1000
)
if (xx := sensor["data"][0].get("bar_trend", 0)) is not None:
xx = xx / 1000
outdata[tx_id][DataKey.BAR_TREND] = xx
outdata[tx_id][DataKey.HUM_OUT] = sensor["data"][0]["hum_out"]
outdata[tx_id][DataKey.HUM_IN] = sensor["data"][0]["hum_in"]
outdata[tx_id][DataKey.WIND_MPH] = sensor["data"][0]["wind_speed"]
Expand All @@ -300,8 +300,8 @@ def _preprocess(indata: str): # noqa: C901
outdata[tx_id][DataKey.DEWPOINT] = sensor["data"][0]["dew_point"]
outdata[tx_id][DataKey.HEAT_INDEX] = sensor["data"][0]["heat_index"]
outdata[tx_id][DataKey.WIND_CHILL] = sensor["data"][0]["wind_chill"]
outdata[tx_id][DataKey.RAIN_DAY] = float(
sensor["data"][0].get("rain_day_in", 0)
outdata[tx_id][DataKey.RAIN_DAY] = sensor["data"][0].get(
"rain_day_in"
)
if (xx := sensor["data"][0].get("rain_storm_in", 0.0)) is None:
xx = 0.0
Expand Down
Loading