Skip to content

Commit

Permalink
fix(light): map_range, reverse kelvin always return zero
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou authored Jan 24, 2025
1 parent 28f8712 commit 3c25718
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/localtuya/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c25718

Please sign in to comment.