From 7d117f734f57eef5bf0e67243ad4b29fe44697b6 Mon Sep 17 00:00:00 2001 From: Erik Kastelec Date: Mon, 12 Sep 2022 11:54:47 +0200 Subject: [PATCH] Fix deprecated methods for numbers platform. Closes #34 --- custom_components/wemportal/manifest.json | 2 +- custom_components/wemportal/number.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/wemportal/manifest.json b/custom_components/wemportal/manifest.json index b1184ab..5b92d3d 100644 --- a/custom_components/wemportal/manifest.json +++ b/custom_components/wemportal/manifest.json @@ -4,7 +4,7 @@ "documentation": "https://github.com/erikkastelec/hass-WEM-Portal", "issue_tracker": "https://github.com/erikkastelec/hass-WEM-Portal/issues", "dependencies": [], - "version": "1.3.7", + "version": "1.3.8", "codeowners": [ "@erikkastelec" ], diff --git a/custom_components/wemportal/number.py b/custom_components/wemportal/number.py index 61c5066..cc3660c 100644 --- a/custom_components/wemportal/number.py +++ b/custom_components/wemportal/number.py @@ -42,13 +42,13 @@ def __init__(self, coordinator, _unique_id, entity_data): self._icon = entity_data["icon"] self._unit = entity_data["unit"] self._state = self.state - self._attr_min_value = entity_data["min_value"] - self._attr_max_value = entity_data["max_value"] - self._attr_step = entity_data["step"] + self._attr_native_min_value = entity_data["min_value"] + self._attr_native_max_value = entity_data["max_value"] + self._attr_native_step = entity_data["step"] self._module_index = entity_data["ModuleIndex"] self._module_type = entity_data["ModuleType"] - async def async_set_value(self, value: float) -> None: + async def async_set_native_value(self, value: float) -> None: """Update the current value.""" await self.hass.async_add_executor_job( self.coordinator.api.change_value, @@ -108,7 +108,7 @@ def state(self): return None @property - def unit_of_measurement(self): + def native_unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit