Skip to content

Commit

Permalink
Merge pull request #20 from astrandb/Deprecations2023.2
Browse files Browse the repository at this point in the history
Adapt to Home Assistant 2023.2 and later
  • Loading branch information
astrandb authored Jan 30, 2023
2 parents 1b575b5 + 1a7bb10 commit 7b1d61d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
5 changes: 2 additions & 3 deletions custom_components/weatherlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions custom_components/weatherlink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 7b1d61d

Please sign in to comment.