From 3c25718f20f7f087048e821cb75232a576190997 Mon Sep 17 00:00:00 2001 From: Bander <46300268+xZetsubou@users.noreply.github.com> Date: Fri, 24 Jan 2025 10:21:48 +0300 Subject: [PATCH] fix(light): map_range, reverse kelvin always return zero --- custom_components/localtuya/light.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/localtuya/light.py b/custom_components/localtuya/light.py index 367c5f278..9336fc4df 100644 --- a/custom_components/localtuya/light.py +++ b/custom_components/localtuya/light.py @@ -166,7 +166,7 @@ def map_range( """Maps a value from one range to another.""" if reverse: - value = from_max - (value + from_min) + value = from_max - (value - from_min) scale = (to_max - to_min) / (from_max - from_min) mapped_value = to_min + (value - from_min) * scale