1 """Utility methods for the Tuya integration."""
3 from __future__
import annotations
12 reverse: bool =
False,
14 """Remap a value from its current range, to a new range."""
16 value = from_max - value + from_min
17 return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
float remap_value(float value, float from_min=0, float from_max=255, float to_min=0, float to_max=255, bool reverse=False)