From e35be26cdd91f3355f0afdb02950be648c395238 Mon Sep 17 00:00:00 2001 From: Pavel S Date: Mon, 13 Jan 2025 18:35:32 +0100 Subject: [PATCH] feat: MIN/MAX humidity (#38) fixes #38 --- README.md | 8 ++++--- custom_components/clientraw/manifest.json | 2 +- custom_components/clientraw/sensor.py | 26 ++++++++++++++++++++++- info.md | 6 ++++-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3073f3a..4c7c953 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,9 @@ Configuration variables: - **rain_rate**: Rain rate (mm or in) - **pressure**: Pressure (hPa or inHg) - **humidity**: Relative humidity (%) - - **humidity_indoor**: Relative humidity (%) + - **humidity_indoor**: Relative indoor humidity (%) + - **humidity_max**: Max relative humidity (%) + - **humidity_min**: Min relative humidity (%) - **cloud_height**: Cloud Height (m or ft) - **forecast**: string based output ie.: night showers - **station**: station name with time added @@ -54,8 +56,8 @@ Configuration variables: - **vp_solar**: Solar Irradiation (W/m² or BTU/(h×ft²)) - **uv_index**: UV Index - **apparent_temp**: Apparent temperature (°C or °F) - - **apparent_temp_min**: Min pparent temperature (°C or °F) - - **apparent_temp_max**: Max pparent temperature (°C or °F) + - **apparent_temp_min**: Min apparent temperature (°C or °F) + - **apparent_temp_max**: Max apparent temperature (°C or °F) ## Install via [HACS](https://github.com/custom-components/hacs) You can find this integration in a store. diff --git a/custom_components/clientraw/manifest.json b/custom_components/clientraw/manifest.json index 82ab253..228de84 100644 --- a/custom_components/clientraw/manifest.json +++ b/custom_components/clientraw/manifest.json @@ -7,5 +7,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/pilotak/homeassistant-clientraw/issues", "requirements": [], - "version": "2.7.1" + "version": "2.8.0" } diff --git a/custom_components/clientraw/sensor.py b/custom_components/clientraw/sensor.py index 4a3ac93..bb03ff9 100644 --- a/custom_components/clientraw/sensor.py +++ b/custom_components/clientraw/sensor.py @@ -24,7 +24,7 @@ async_call_later) from homeassistant.util.unit_system import METRIC_SYSTEM -__version__ = '2.7.1' +__version__ = '2.8.0' _LOGGER = logging.getLogger(__name__) @@ -147,6 +147,16 @@ PERCENTAGE, PERCENTAGE, 'mdi:water-percent'], + 'humidity_max': [ + 'Max Humidity', + PERCENTAGE, + PERCENTAGE, + 'mdi:water-percent'], + 'humidity_min': [ + 'Min Humidity', + PERCENTAGE, + PERCENTAGE, + 'mdi:water-percent'], 'cloud_height': [ 'Cloud Height', UnitOfLength.METERS, @@ -760,6 +770,20 @@ def try_again(err: str): else: new_state = STATE_UNAVAILABLE + elif dev.type == 'humidity_min': + if self.data[164] != '-' and self.data[164] != '--' \ + and self.data[164] != '---': + new_state = float(self.data[164]) + else: + new_state = STATE_UNAVAILABLE + + elif dev.type == 'humidity_max': + if self.data[163] != '-' and self.data[163] != '--' \ + and self.data[163] != '---': + new_state = float(self.data[163]) + else: + new_state = STATE_UNAVAILABLE + _LOGGER.debug("%s %s", dev.type, new_state) # pylint: disable=protected-access diff --git a/info.md b/info.md index 08c904d..bddea2b 100644 --- a/info.md +++ b/info.md @@ -40,6 +40,8 @@ Configuration variables: - **pressure**: Pressure (hPa or inHg) - **humidity**: Relative humidity (%) - **humidity_indoor**: Relative humidity (%) + - **humidity_max**: Max relative humidity (%) + - **humidity_min**: Min relative humidity (%) - **cloud_height**: Cloud Height (m or ft) - **forecast**: string based output ie.: night showers - **station**: station name with time added @@ -50,8 +52,8 @@ Configuration variables: - **vp_solar**: Solar Irradiation (W/m² or BTU/(h×ft²)) - **uv_index**: UV Index - **apparent_temp**: Apparent temperature (°C or °F) - - **apparent_temp_min**: Min pparent temperature (°C or °F) - - **apparent_temp_max**: Max pparent temperature (°C or °F) + - **apparent_temp_min**: Min apparent temperature (°C or °F) + - **apparent_temp_max**: Max apparent temperature (°C or °F) A full configuration example can be found below: