From f79ed9a0cd274227b44000430e0d48b69de9f568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Mon, 30 Jan 2023 13:10:50 +0100 Subject: [PATCH 1/3] Use async_forward_entry_setups() --- custom_components/weatherlink/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/custom_components/weatherlink/__init__.py b/custom_components/weatherlink/__init__.py index d6a0772..9a5b54e 100644 --- a/custom_components/weatherlink/__init__.py +++ b/custom_components/weatherlink/__init__.py @@ -37,15 +37,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await coordinator.async_config_entry_first_refresh() _LOGGER.debug("First data: %s", coordinator.data) - hass.config_entries.async_setup_platforms(entry, PLATFORMS) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" - unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) - if unload_ok: + if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS): hass.data[DOMAIN].pop(entry.entry_id) return unload_ok From 0d14c88826098784ed9bacff8b26227aa1d7d96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Mon, 30 Jan 2023 13:22:48 +0100 Subject: [PATCH 2/3] Correct state_class for precipitation sensors --- custom_components/weatherlink/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/weatherlink/sensor.py b/custom_components/weatherlink/sensor.py index 2881c8e..c955bc9 100644 --- a/custom_components/weatherlink/sensor.py +++ b/custom_components/weatherlink/sensor.py @@ -108,7 +108,7 @@ class WLSensorDescription(SensorEntityDescription): device_class=SensorDeviceClass.PRECIPITATION, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, convert=lambda x: x * 25.4, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.TOTAL_INCREASING, ), WLSensorDescription( key="RainRate", @@ -128,7 +128,7 @@ class WLSensorDescription(SensorEntityDescription): device_class=SensorDeviceClass.PRECIPITATION, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, convert=lambda x: x * 25.4, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.TOTAL_INCREASING, ), WLSensorDescription( key="RainInYear", From 1a7bb103023e5e5ea7140eb9e4ede41f1584ef7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Mon, 30 Jan 2023 13:36:06 +0100 Subject: [PATCH 3/3] Use python3.10 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aea9375..75b4212 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ lint: flake8 $(src_dir) .venv: - python3.9 -m venv .venv + python3.10 -m venv .venv install_dev: | .venv (. .venv/bin/activate; \