From fdc9862a3398ab2dade00c1cec10bb5ddeb40f64 Mon Sep 17 00:00:00 2001 From: rospogrigio <49229287+rospogrigio@users.noreply.github.com> Date: Tue, 16 Aug 2022 16:20:41 +0200 Subject: [PATCH 1/3] Update requirements_test.txt --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index 8cfbf7c..bc7bfbf 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,4 +5,4 @@ mypy==0.901 pydocstyle==6.1.1 pylint==2.8.2 pylint-strict-informational==0.1 -homeassistant==2021.12.10 +homeassistant==2022.8.1 From 205a8445eec3a8295b604b2fe6e87967b23f71e4 Mon Sep 17 00:00:00 2001 From: rospogrigio <49229287+rospogrigio@users.noreply.github.com> Date: Tue, 16 Aug 2022 16:49:33 +0200 Subject: [PATCH 2/3] Reverting requirements.txt --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index bc7bfbf..8cfbf7c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,4 +5,4 @@ mypy==0.901 pydocstyle==6.1.1 pylint==2.8.2 pylint-strict-informational==0.1 -homeassistant==2022.8.1 +homeassistant==2021.12.10 From 43c01eefd93215d4a8cb035dbcb927ecee7c52e3 Mon Sep 17 00:00:00 2001 From: Mark Breen Date: Fri, 8 Jul 2022 00:27:08 +0100 Subject: [PATCH 3/3] Refactor number entity overrides Relates to issues [929](https://github.com/rospogrigio/localtuya/issues/929), [939](https://github.com/rospogrigio/localtuya/issues/939) & [941](https://github.com/rospogrigio/localtuya/issues/941) I do not have any suitable tuya devices in use to test against this number entity however the warning in logs "LocaltuyaNumber is overriding deprecated methods on an instance of NumberEntity] is now gone https://developers.home-assistant.io/blog/2022/06/14/number_entity_refactoring/ --- custom_components/localtuya/number.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/localtuya/number.py b/custom_components/localtuya/number.py index 596eb01..ba7c3ba 100644 --- a/custom_components/localtuya/number.py +++ b/custom_components/localtuya/number.py @@ -10,8 +10,8 @@ from .common import LocalTuyaEntity, async_setup_entry _LOGGER = logging.getLogger(__name__) -CONF_MIN_VALUE = "min_value" -CONF_MAX_VALUE = "max_value" +CONF_MIN_VALUE = "native_min_value" +CONF_MAX_VALUE = "native_max_value" DEFAULT_MIN = 0 DEFAULT_MAX = 100000 @@ -52,17 +52,17 @@ class LocaltuyaNumber(LocalTuyaEntity, NumberEntity): self._max_value = self._config.get(CONF_MAX_VALUE) @property - def value(self) -> float: + def native_value(self) -> float: """Return sensor state.""" return self._state @property - def min_value(self) -> float: + def native_min_value(self) -> float: """Return the minimum value.""" return self._min_value @property - def max_value(self) -> float: + def native_max_value(self) -> float: """Return the maximum value.""" return self._max_value @@ -71,7 +71,7 @@ class LocaltuyaNumber(LocalTuyaEntity, NumberEntity): """Return the class of this device.""" return self._config.get(CONF_DEVICE_CLASS) - 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._device.set_dp(value, self._dp_id)