From 88cc736cd3851f1118ca6e8254dcc6b395daab52 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Mon, 3 Jun 2024 18:44:52 -0600 Subject: [PATCH] feat: add `winddir_name` entity (#998) * feat: add `winddir_name` entity * add HASS entity description --- README.md | 2 + ecowitt2mqtt/const.py | 1 + ecowitt2mqtt/data.py | 4 ++ ecowitt2mqtt/helpers/calculator/wind.py | 42 +++++++++++ ecowitt2mqtt/helpers/publisher/mqtt/hass.py | 5 ++ tests/data/test_battery.py | 7 ++ tests/data/test_data_processing.py | 70 +++++++++++++++++++ tests/data/test_units.py | 28 ++++++++ .../publisher/mqtt/test_topic_publisher.py | 2 +- tests/test_runtime.py | 8 +-- 10 files changed, 164 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 19e202ed..536332ed 100644 --- a/README.md +++ b/README.md @@ -432,6 +432,8 @@ data exists: - **[Wind Chill][wind-chill]:** how cold the air feels to the human body when factoring in relative humidity, wind speed, etc. (applicable when the apparent temperature is lower than the air temperature) +- **Wind Direction Name:** a conversion from degrees to a human-friendly label (e.g., + "NNW") (Special thanks to the excellent [`thermal_comfort` library][thermal-comfort-library] for inspiration on many of these.) diff --git a/ecowitt2mqtt/const.py b/ecowitt2mqtt/const.py index 51c51b42..9dfb4563 100644 --- a/ecowitt2mqtt/const.py +++ b/ecowitt2mqtt/const.py @@ -132,6 +132,7 @@ DATA_POINT_WH90BATT_PC: Final = "wh90battpc" DATA_POINT_WH90CAP_VOLT: Final = "ws90cap_volt" DATA_POINT_WINDCHILL: Final = "windchill" +DATA_POINT_WINDDIR_NAME: Final = "winddir_name" DATA_POINT_WINDSPEED: Final = "windspeed" DATA_POINT_WRAIN_PIEZO: Final = "wrain_piezo" DATA_POINT_WS90_VER: Final = "ws90_ver" diff --git a/ecowitt2mqtt/data.py b/ecowitt2mqtt/data.py index 2f8acc51..e8dde947 100644 --- a/ecowitt2mqtt/data.py +++ b/ecowitt2mqtt/data.py @@ -63,6 +63,7 @@ DATA_POINT_THERMAL_PERCEPTION, DATA_POINT_UV, DATA_POINT_WINDCHILL, + DATA_POINT_WINDDIR_NAME, LOGGER, ) from ecowitt2mqtt.helpers.calculator import ( @@ -118,6 +119,7 @@ from ecowitt2mqtt.helpers.calculator.wind import ( BeaufortScaleCalculator, WindDirCalculator, + WindDirNameCalculator, WindSpeedCalculator, ) from ecowitt2mqtt.helpers.device import Device, get_device_from_raw_payload @@ -181,6 +183,7 @@ DATA_POINT_THERMAL_PERCEPTION: ThermalPerceptionCalculator, DATA_POINT_UV: UVIndexCalculator, DATA_POINT_WINDCHILL: WindChillCalculator, + DATA_POINT_WINDDIR_NAME: WindDirNameCalculator, } DEFAULT_KEYS_TO_IGNORE = [ @@ -286,6 +289,7 @@ class ProcessedData: DATA_POINT_SOLARRADIATION_PERCEIVED, DATA_POINT_THERMAL_PERCEPTION, DATA_POINT_WINDCHILL, + DATA_POINT_WINDDIR_NAME, ) config: Config diff --git a/ecowitt2mqtt/helpers/calculator/wind.py b/ecowitt2mqtt/helpers/calculator/wind.py index a74beeb9..a69fa724 100644 --- a/ecowitt2mqtt/helpers/calculator/wind.py +++ b/ecowitt2mqtt/helpers/calculator/wind.py @@ -7,6 +7,7 @@ from ecowitt2mqtt.const import ( CONF_OUTPUT_UNIT_SPEED, + DATA_POINT_GLOB_WINDDIR, DATA_POINT_WINDSPEED, DEGREE, UnitOfSpeed, @@ -20,6 +21,26 @@ from ecowitt2mqtt.helpers.typing import PreCalculatedValueType from ecowitt2mqtt.util.unit_conversion import SpeedConverter +WIND_DIR_NAMES = [ + "N", + "NNE", + "NE", + "ENE", + "E", + "ESE", + "SE", + "SSE", + "S", + "SSW", + "SW", + "WSW", + "W", + "WNW", + "NW", + "NNW", + "N", +] + @dataclass class BeaufortScaleRating: # pylint: disable=too-many-instance-attributes @@ -271,6 +292,27 @@ def output_unit(self) -> str: return DEGREE +class WindDirNameCalculator(Calculator): + """Define a wind direction name calculator.""" + + @Calculator.requires_keys(DATA_POINT_GLOB_WINDDIR) + def calculate_from_payload( + self, payload: dict[str, PreCalculatedValueType] + ) -> CalculatedDataPoint: + """Perform the calculation. + + Args: + payload: An Ecowitt data payload. + + Returns: + A parsed CalculatedDataPoint object. + """ + wind_dir = float(payload[DATA_POINT_GLOB_WINDDIR]) + return self.get_calculated_data_point( + WIND_DIR_NAMES[int((wind_dir + 11.25) % 360 / 22.5)] + ) + + class WindSpeedCalculator(Calculator): """Define a wind speed calculator.""" diff --git a/ecowitt2mqtt/helpers/publisher/mqtt/hass.py b/ecowitt2mqtt/helpers/publisher/mqtt/hass.py index 6fa06d76..7455867d 100644 --- a/ecowitt2mqtt/helpers/publisher/mqtt/hass.py +++ b/ecowitt2mqtt/helpers/publisher/mqtt/hass.py @@ -77,6 +77,7 @@ DATA_POINT_UV, DATA_POINT_WEEKLY_RAIN, DATA_POINT_WINDCHILL, + DATA_POINT_WINDDIR_NAME, DATA_POINT_WRAIN_PIEZO, DATA_POINT_WS90_VER, DATA_POINT_YEARLY_RAIN, @@ -420,6 +421,10 @@ class HassDiscoveryInfo: device_class=DeviceClass.TEMPERATURE, state_class=StateClass.MEASUREMENT, ), + DATA_POINT_WINDDIR_NAME: EntityDescription( + icon="mdi:compass", + state_class=StateClass.MEASUREMENT, + ), DATA_POINT_WS90_VER: EntityDescription(entity_category=EntityCategory.DIAGNOSTIC), } diff --git a/tests/data/test_battery.py b/tests/data/test_battery.py index 6256a18c..4c6e479f 100644 --- a/tests/data/test_battery.py +++ b/tests/data/test_battery.py @@ -1195,6 +1195,13 @@ def test_unknown_battery(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), "playstationbattery1": CalculatedDataPoint( "batt", BooleanBatteryState.OFF, diff --git a/tests/data/test_data_processing.py b/tests/data/test_data_processing.py index ef6be327..b095db34 100644 --- a/tests/data/test_data_processing.py +++ b/tests/data/test_data_processing.py @@ -652,6 +652,13 @@ def test_missing_distance(device_data: dict[str, Any], ecowitt: Ecowitt) -> None attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="E", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), } @@ -1038,6 +1045,13 @@ def test_nonnumeric_value(device_data: dict[str, Any], ecowitt: Ecowitt) -> None attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), "Random New Key": CalculatedDataPoint("Random New Key", "Some Value"), } @@ -1425,6 +1439,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), } @@ -1809,6 +1830,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -2132,6 +2160,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="NE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -2928,6 +2963,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="E", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -3707,6 +3749,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="NNW", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -4138,6 +4187,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="WNW", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -4506,6 +4562,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SW", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -4821,6 +4884,13 @@ def test_precision(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="W", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ], diff --git a/tests/data/test_units.py b/tests/data/test_units.py index bd5ad1a7..36b44e6e 100644 --- a/tests/data/test_units.py +++ b/tests/data/test_units.py @@ -447,6 +447,13 @@ def test_output_units(device_data: dict[str, Any], ecowitt: Ecowitt) -> None: attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), } @@ -843,6 +850,13 @@ def test_unit_conversion_to_imperial( attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), } @@ -1230,6 +1244,13 @@ def test_unit_conversion_to_imperial( attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="SE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ( @@ -1553,6 +1574,13 @@ def test_unit_conversion_to_imperial( attributes={}, data_type=DataPointType.NON_BOOLEAN, ), + "winddir_name": CalculatedDataPoint( + data_point_key="winddir_name", + value="NE", + unit=None, + attributes={}, + data_type=DataPointType.NON_BOOLEAN, + ), }, ), ], diff --git a/tests/helpers/publisher/mqtt/test_topic_publisher.py b/tests/helpers/publisher/mqtt/test_topic_publisher.py index deb74905..37193d3b 100644 --- a/tests/helpers/publisher/mqtt/test_topic_publisher.py +++ b/tests/helpers/publisher/mqtt/test_topic_publisher.py @@ -41,7 +41,7 @@ async def test_publish_processed( await publishers[0].async_publish(device_data) mock_aiomqtt_client.publish.assert_awaited_with( TEST_MQTT_TOPIC, - payload=b'{"runtime": 319206.0, "tempin": 79.52, "humidityin": 31.0, "baromrel": 24.74, "baromabs": 24.74, "temp": 93.2, "humidity": 64.0, "winddir": 139.0, "windspeed": 20.89, "windgust": 1.12, "maxdailygust": 8.05, "solarradiation": 264.61, "uv": 2.0, "rainrate": 0.0, "eventrain": 0.0, "hourlyrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.0, "monthlyrain": 2.177, "yearlyrain": 4.441, "lightning_num": 13.0, "lightning": 0.6213711922373341, "lightning_time": "2022-04-20T17:17:17+00:00", "wh65batt": "OFF", "beaufortscale": 5, "dewpoint": 79.19328776816637, "feelslike": 111.0553021896001, "frostpoint": 70.28882284994654, "frostrisk": "No risk", "heatindex": 111.0553021896001, "humidex": 48, "humidex_perception": "Dangerous", "humidityabs": 0.001501643470436062, "humidityabsin": 0.001501643470436062, "relative_strain_index": 0.54, "relative_strain_index_perception": "Extreme discomfort", "safe_exposure_time_skin_type_1": 83.3, "safe_exposure_time_skin_type_2": 100.0, "safe_exposure_time_skin_type_3": 133.3, "safe_exposure_time_skin_type_4": 166.7, "safe_exposure_time_skin_type_5": 266.7, "safe_exposure_time_skin_type_6": 433.3, "simmerindex": 113.90619200000002, "simmerzone": "Danger of heatstroke", "solarradiation_perceived": 90.49958322993245, "thermalperception": "Severely high", "windchill": null}', # noqa: E501 + payload=b'{"runtime": 319206.0, "tempin": 79.52, "humidityin": 31.0, "baromrel": 24.74, "baromabs": 24.74, "temp": 93.2, "humidity": 64.0, "winddir": 139.0, "windspeed": 20.89, "windgust": 1.12, "maxdailygust": 8.05, "solarradiation": 264.61, "uv": 2.0, "rainrate": 0.0, "eventrain": 0.0, "hourlyrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.0, "monthlyrain": 2.177, "yearlyrain": 4.441, "lightning_num": 13.0, "lightning": 0.6213711922373341, "lightning_time": "2022-04-20T17:17:17+00:00", "wh65batt": "OFF", "beaufortscale": 5, "dewpoint": 79.19328776816637, "feelslike": 111.0553021896001, "frostpoint": 70.28882284994654, "frostrisk": "No risk", "heatindex": 111.0553021896001, "humidex": 48, "humidex_perception": "Dangerous", "humidityabs": 0.001501643470436062, "humidityabsin": 0.001501643470436062, "relative_strain_index": 0.54, "relative_strain_index_perception": "Extreme discomfort", "safe_exposure_time_skin_type_1": 83.3, "safe_exposure_time_skin_type_2": 100.0, "safe_exposure_time_skin_type_3": 133.3, "safe_exposure_time_skin_type_4": 166.7, "safe_exposure_time_skin_type_5": 266.7, "safe_exposure_time_skin_type_6": 433.3, "simmerindex": 113.90619200000002, "simmerzone": "Danger of heatstroke", "solarradiation_perceived": 90.49958322993245, "thermalperception": "Severely high", "windchill": null, "winddir_name": "SE"}', # noqa: E501 retain=False, ) diff --git a/tests/test_runtime.py b/tests/test_runtime.py index 1e9679ec..36539e8f 100644 --- a/tests/test_runtime.py +++ b/tests/test_runtime.py @@ -96,7 +96,7 @@ async def test_publish_ambient_weather_new_format_success( assert resp.status == 204 mock_aiomqtt_client.publish.assert_awaited_with( TEST_MQTT_TOPIC, - payload=b'{"tempin": 67.3, "humidityin": 33.0, "baromrel": 29.616, "baromabs": 24.679, "temp": 53.8, "humidity": 30.0, "winddir": 99.0, "windspeed": 4.5, "windgust": 6.9, "maxdailygust": 14.8, "hourlyrain": 0.0, "eventrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.024, "monthlyrain": 0.311, "totalrain": 48.811, "solarradiation": 39.02, "uv": 0.0, "batt_co2": "ON", "beaufortscale": 2, "dewpoint": 23.12793817902528, "feelslike": 53.8, "frostpoint": 20.34536144435649, "frostrisk": "No risk", "heatindex": 50.28999999999999, "humidex": 9, "humidex_perception": "Comfortable", "humidityabs": 0.00020090062644380612, "humidityabsin": 0.00020090062644380612, "relative_strain_index": null, "relative_strain_index_perception": null, "safe_exposure_time_skin_type_1": null, "safe_exposure_time_skin_type_2": null, "safe_exposure_time_skin_type_3": null, "safe_exposure_time_skin_type_4": null, "safe_exposure_time_skin_type_5": null, "safe_exposure_time_skin_type_6": null, "simmerindex": null, "simmerzone": null, "solarradiation_perceived": 73.87320347536115, "thermalperception": "Dry", "windchill": null}', # noqa: E501 + payload=b'{"tempin": 67.3, "humidityin": 33.0, "baromrel": 29.616, "baromabs": 24.679, "temp": 53.8, "humidity": 30.0, "winddir": 99.0, "windspeed": 4.5, "windgust": 6.9, "maxdailygust": 14.8, "hourlyrain": 0.0, "eventrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.024, "monthlyrain": 0.311, "totalrain": 48.811, "solarradiation": 39.02, "uv": 0.0, "batt_co2": "ON", "beaufortscale": 2, "dewpoint": 23.12793817902528, "feelslike": 53.8, "frostpoint": 20.34536144435649, "frostrisk": "No risk", "heatindex": 50.28999999999999, "humidex": 9, "humidex_perception": "Comfortable", "humidityabs": 0.00020090062644380612, "humidityabsin": 0.00020090062644380612, "relative_strain_index": null, "relative_strain_index_perception": null, "safe_exposure_time_skin_type_1": null, "safe_exposure_time_skin_type_2": null, "safe_exposure_time_skin_type_3": null, "safe_exposure_time_skin_type_4": null, "safe_exposure_time_skin_type_5": null, "safe_exposure_time_skin_type_6": null, "simmerindex": null, "simmerzone": null, "solarradiation_perceived": 73.87320347536115, "thermalperception": "Dry", "windchill": null, "winddir_name": "E"}', # noqa: E501 retain=False, ) @@ -138,7 +138,7 @@ async def test_publish_ambient_weather_old_format_success( assert resp.status == 204 mock_aiomqtt_client.publish.assert_awaited_with( TEST_MQTT_TOPIC, - payload=b'{"tempin": 67.3, "humidityin": 33.0, "baromrel": 29.616, "baromabs": 24.679, "temp": 53.8, "humidity": 30.0, "winddir": 99.0, "windspeed": 4.5, "windgust": 6.9, "maxdailygust": 14.8, "hourlyrain": 0.0, "eventrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.024, "monthlyrain": 0.311, "totalrain": 48.811, "solarradiation": 39.02, "uv": 0.0, "batt_co2": "ON", "beaufortscale": 2, "dewpoint": 23.12793817902528, "feelslike": 53.8, "frostpoint": 20.34536144435649, "frostrisk": "No risk", "heatindex": 50.28999999999999, "humidex": 9, "humidex_perception": "Comfortable", "humidityabs": 0.00020090062644380612, "humidityabsin": 0.00020090062644380612, "relative_strain_index": null, "relative_strain_index_perception": null, "safe_exposure_time_skin_type_1": null, "safe_exposure_time_skin_type_2": null, "safe_exposure_time_skin_type_3": null, "safe_exposure_time_skin_type_4": null, "safe_exposure_time_skin_type_5": null, "safe_exposure_time_skin_type_6": null, "simmerindex": null, "simmerzone": null, "solarradiation_perceived": 73.87320347536115, "thermalperception": "Dry", "windchill": null}', # noqa: E501 + payload=b'{"tempin": 67.3, "humidityin": 33.0, "baromrel": 29.616, "baromabs": 24.679, "temp": 53.8, "humidity": 30.0, "winddir": 99.0, "windspeed": 4.5, "windgust": 6.9, "maxdailygust": 14.8, "hourlyrain": 0.0, "eventrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.024, "monthlyrain": 0.311, "totalrain": 48.811, "solarradiation": 39.02, "uv": 0.0, "batt_co2": "ON", "beaufortscale": 2, "dewpoint": 23.12793817902528, "feelslike": 53.8, "frostpoint": 20.34536144435649, "frostrisk": "No risk", "heatindex": 50.28999999999999, "humidex": 9, "humidex_perception": "Comfortable", "humidityabs": 0.00020090062644380612, "humidityabsin": 0.00020090062644380612, "relative_strain_index": null, "relative_strain_index_perception": null, "safe_exposure_time_skin_type_1": null, "safe_exposure_time_skin_type_2": null, "safe_exposure_time_skin_type_3": null, "safe_exposure_time_skin_type_4": null, "safe_exposure_time_skin_type_5": null, "safe_exposure_time_skin_type_6": null, "simmerindex": null, "simmerzone": null, "solarradiation_perceived": 73.87320347536115, "thermalperception": "Dry", "windchill": null, "winddir_name": "E"}', # noqa: E501 retain=False, ) @@ -184,7 +184,7 @@ async def test_publish_ecowitt_success( assert resp.status == 204 mock_aiomqtt_client.publish.assert_awaited_with( TEST_MQTT_TOPIC, - payload=b'{"runtime": 319206.0, "tempin": 79.52, "humidityin": 31.0, "baromrel": 24.74, "baromabs": 24.74, "temp": 93.2, "humidity": 64.0, "winddir": 139.0, "windspeed": 20.89, "windgust": 1.12, "maxdailygust": 8.05, "solarradiation": 264.61, "uv": 2.0, "rainrate": 0.0, "eventrain": 0.0, "hourlyrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.0, "monthlyrain": 2.177, "yearlyrain": 4.441, "lightning_num": 13.0, "lightning": 0.6213711922373341, "lightning_time": "2022-04-20T17:17:17+00:00", "wh65batt": "OFF", "beaufortscale": 5, "dewpoint": 79.19328776816637, "feelslike": 111.0553021896001, "frostpoint": 70.28882284994654, "frostrisk": "No risk", "heatindex": 111.0553021896001, "humidex": 48, "humidex_perception": "Dangerous", "humidityabs": 0.001501643470436062, "humidityabsin": 0.001501643470436062, "relative_strain_index": 0.54, "relative_strain_index_perception": "Extreme discomfort", "safe_exposure_time_skin_type_1": 83.3, "safe_exposure_time_skin_type_2": 100.0, "safe_exposure_time_skin_type_3": 133.3, "safe_exposure_time_skin_type_4": 166.7, "safe_exposure_time_skin_type_5": 266.7, "safe_exposure_time_skin_type_6": 433.3, "simmerindex": 113.90619200000002, "simmerzone": "Danger of heatstroke", "solarradiation_perceived": 90.49958322993245, "thermalperception": "Severely high", "windchill": null}', # noqa: E501 + payload=b'{"runtime": 319206.0, "tempin": 79.52, "humidityin": 31.0, "baromrel": 24.74, "baromabs": 24.74, "temp": 93.2, "humidity": 64.0, "winddir": 139.0, "windspeed": 20.89, "windgust": 1.12, "maxdailygust": 8.05, "solarradiation": 264.61, "uv": 2.0, "rainrate": 0.0, "eventrain": 0.0, "hourlyrain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.0, "monthlyrain": 2.177, "yearlyrain": 4.441, "lightning_num": 13.0, "lightning": 0.6213711922373341, "lightning_time": "2022-04-20T17:17:17+00:00", "wh65batt": "OFF", "beaufortscale": 5, "dewpoint": 79.19328776816637, "feelslike": 111.0553021896001, "frostpoint": 70.28882284994654, "frostrisk": "No risk", "heatindex": 111.0553021896001, "humidex": 48, "humidex_perception": "Dangerous", "humidityabs": 0.001501643470436062, "humidityabsin": 0.001501643470436062, "relative_strain_index": 0.54, "relative_strain_index_perception": "Extreme discomfort", "safe_exposure_time_skin_type_1": 83.3, "safe_exposure_time_skin_type_2": 100.0, "safe_exposure_time_skin_type_3": 133.3, "safe_exposure_time_skin_type_4": 166.7, "safe_exposure_time_skin_type_5": 266.7, "safe_exposure_time_skin_type_6": 433.3, "simmerindex": 113.90619200000002, "simmerzone": "Danger of heatstroke", "solarradiation_perceived": 90.49958322993245, "thermalperception": "Severely high", "windchill": null, "winddir_name": "SE"}', # noqa: E501 retain=False, ) @@ -275,7 +275,7 @@ async def test_publish_wunderground_success( assert resp.status == 204 mock_aiomqtt_client.publish.assert_awaited_with( TEST_MQTT_TOPIC, - payload=b'{"ID": "MCKEAN", "PASSWORD": 1909.0, "temp": 89.42, "humidity": 54.0, "dewptf": 70.7, "winddir": 269.0, "windspeed": 0.0, "windgust": 9.17, "rain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.476, "monthlyrain": 4.831, "yearlyrain": 4.831, "solarradiation": 732.04, "UV": 6.0, "indoortemp": 79.34, "indoorhumidity": 55.0, "barom": 30.135, "lowbatt": "OFF", "action": "updateraw", "realtime": 1.0, "rtfreq": 5.0, "beaufortscale": 0, "dewpoint": 70.5763744258485, "feelslike": 95.3087917601561, "frostpoint": 62.320677884203384, "frostrisk": "No risk", "heatindex": 95.3087917601561, "humidex": 41, "humidex_perception": "Great discomfort", "humidityabs": 0.0011334789215741161, "humidityabsin": 0.0011334789215741161, "relative_strain_index": 0.34, "relative_strain_index_perception": "Discomfort", "simmerindex": 104.48206520000001, "simmerzone": "Caution: Heat exhaustion", "solarradiation_perceived": 99.33815442116924, "thermalperception": "Quite uncomfortable", "windchill": null}', # noqa: E501 + payload=b'{"ID": "MCKEAN", "PASSWORD": 1909.0, "temp": 89.42, "humidity": 54.0, "dewptf": 70.7, "winddir": 269.0, "windspeed": 0.0, "windgust": 9.17, "rain": 0.0, "dailyrain": 0.0, "weeklyrain": 0.476, "monthlyrain": 4.831, "yearlyrain": 4.831, "solarradiation": 732.04, "UV": 6.0, "indoortemp": 79.34, "indoorhumidity": 55.0, "barom": 30.135, "lowbatt": "OFF", "action": "updateraw", "realtime": 1.0, "rtfreq": 5.0, "beaufortscale": 0, "dewpoint": 70.5763744258485, "feelslike": 95.3087917601561, "frostpoint": 62.320677884203384, "frostrisk": "No risk", "heatindex": 95.3087917601561, "humidex": 41, "humidex_perception": "Great discomfort", "humidityabs": 0.0011334789215741161, "humidityabsin": 0.0011334789215741161, "relative_strain_index": 0.34, "relative_strain_index_perception": "Discomfort", "simmerindex": 104.48206520000001, "simmerzone": "Caution: Heat exhaustion", "solarradiation_perceived": 99.33815442116924, "thermalperception": "Quite uncomfortable", "windchill": null, "winddir_name": "W"}', # noqa: E501 retain=False, )