From 8a696cbaf2e63d44eca03e3ab9a35a045d115213 Mon Sep 17 00:00:00 2001 From: Fabien Brachere Date: Tue, 28 Jun 2022 08:50:25 +0200 Subject: [PATCH 1/5] Add "1/0" entry for HVAC_MODE_SETS BHT-002 thermostat DP #4 set the heating mode (auto or manual). The accepted values are strings "0" for auto mode and "1" for manual mode. This commit add an entry "1/0" to support this behaviour. --- custom_components/localtuya/climate.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/localtuya/climate.py b/custom_components/localtuya/climate.py index 1400ec7..f6433b2 100644 --- a/custom_components/localtuya/climate.py +++ b/custom_components/localtuya/climate.py @@ -72,6 +72,10 @@ HVAC_MODE_SETS = { "True/False": { HVAC_MODE_HEAT: True, }, + "1/0": { + HVAC_MODE_HEAT: "1", + HVAC_MODE_AUTO: "0", + }, } HVAC_ACTION_SETS = { "True/False": { 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 2/5] 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 3/5] 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 4/5] 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) From 2bae03c679a24525def2bdb0a2999530aefa68e4 Mon Sep 17 00:00:00 2001 From: rospogrigio <49229287+rospogrigio@users.noreply.github.com> Date: Tue, 30 Aug 2022 10:28:08 +0200 Subject: [PATCH 5/5] Release 4.0.2 --- custom_components/localtuya/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/localtuya/manifest.json b/custom_components/localtuya/manifest.json index bfaf4cc..67c90f4 100644 --- a/custom_components/localtuya/manifest.json +++ b/custom_components/localtuya/manifest.json @@ -1,7 +1,7 @@ { "domain": "localtuya", "name": "LocalTuya integration", - "version": "4.0.1", + "version": "4.0.2", "documentation": "https://github.com/rospogrigio/localtuya/", "dependencies": [], "codeowners": [