From 6b7f9e7f99c0049e33de681886bc2b0a8ac7199e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Thu, 10 Oct 2024 09:35:16 +0000 Subject: [PATCH 1/2] Change negative gust values to 0.0 --- custom_components/weatherlink/sensor.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/custom_components/weatherlink/sensor.py b/custom_components/weatherlink/sensor.py index 867bd1e..2b6740f 100644 --- a/custom_components/weatherlink/sensor.py +++ b/custom_components/weatherlink/sensor.py @@ -784,7 +784,22 @@ def generate_model(self): def native_value(self): """Return the state of the sensor.""" # _LOGGER.debug("Key: %s", self.entity_description.key) - if self.entity_description.key not in ["WindDir", "BarTrend"]: + if self.entity_description.key not in ["WindDir", "BarTrend", "WindGust"]: + return self.coordinator.data[self.tx_id].get(self.entity_description.tag) + + if self.entity_description.tag in [DataKey.WIND_GUST_MPH]: + if ( + self.coordinator.data[self.tx_id].get(self.entity_description.tag) + is None + ): + return None + if ( + float( + self.coordinator.data[self.tx_id].get(self.entity_description.tag) + ) + < 0 + ): + return 0.0 return self.coordinator.data[self.tx_id].get(self.entity_description.tag) if self.entity_description.tag in [DataKey.WIND_DIR]: From dfe179c9d387834e105ccff8f62980b699182be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Thu, 10 Oct 2024 10:15:12 +0000 Subject: [PATCH 2/2] Bump version to 2024.10.0b0 --- custom_components/weatherlink/const.py | 2 +- custom_components/weatherlink/manifest.json | 2 +- setup.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/weatherlink/const.py b/custom_components/weatherlink/const.py index 66ea2a5..62aa558 100644 --- a/custom_components/weatherlink/const.py +++ b/custom_components/weatherlink/const.py @@ -3,7 +3,7 @@ from enum import StrEnum DOMAIN = "weatherlink" -VERSION = "2024.4.0b0" +VERSION = "2024.10.0b0" MANUFACTURER = "Davis Instruments" CONFIG_URL = "https://www.weatherlink.com/" diff --git a/custom_components/weatherlink/manifest.json b/custom_components/weatherlink/manifest.json index c6557e7..5f784b1 100644 --- a/custom_components/weatherlink/manifest.json +++ b/custom_components/weatherlink/manifest.json @@ -13,6 +13,6 @@ "issue_tracker": "https://github.com/astrandb/weatherlink/issues", "requirements": [], "ssdp": [], - "version": "2024.4.0b0", + "version": "2024.10.0b0", "zeroconf": [] } diff --git a/setup.cfg b/setup.cfg index f04f4d6..a7af098 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpver] -current_version = 2024.4.0b0 +current_version = 2024.10.0b0 version_pattern = YYYY.MM.PATCH[PYTAGNUM] commit_message = "Bump version from {old_version} to {new_version}" commit = False