From d44e323e951bfc3851d8a4156b5e4639ec6c2729 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 12 Oct 2021 11:34:18 +0200 Subject: [PATCH] Move Tuya remap method from base to light entity class (#57527) --- homeassistant/components/tuya/base.py | 7 ------- homeassistant/components/tuya/light.py | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/tuya/base.py b/homeassistant/components/tuya/base.py index 2ddfe484ffd..a8bb492f17b 100644 --- a/homeassistant/components/tuya/base.py +++ b/homeassistant/components/tuya/base.py @@ -22,13 +22,6 @@ class TuyaHaEntity(Entity): self.tuya_device = device self.tuya_device_manager = device_manager - @staticmethod - def remap(old_value, old_min, old_max, new_min, new_max): - """Remap old_value to new_value.""" - return ((old_value - old_min) / (old_max - old_min)) * ( - new_max - new_min - ) + new_min - @property def name(self) -> str | None: """Return Tuya device name.""" diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index 6a119e71ba9..f2136da431f 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -384,3 +384,10 @@ class TuyaHaLight(TuyaHaEntity, LightEntity): ): color_modes.append(COLOR_MODE_HS) return set(color_modes) + + @staticmethod + def remap(old_value, old_min, old_max, new_min, new_max): + """Remap old_value to new_value.""" + return ((old_value - old_min) / (old_max - old_min)) * ( + new_max - new_min + ) + new_min