Functions | |
| int | int_states_in_range (tuple[float, float] low_high_range) |
| int | scale_ranged_value_to_int_range (tuple[float, float] source_low_high_range, tuple[float, float] target_low_high_range, float value) |
| float | scale_to_ranged_value (tuple[float, float] source_low_high_range, tuple[float, float] target_low_high_range, float value) |
| float | states_in_range (tuple[float, float] low_high_range) |
Scaling util functions.
| int homeassistant.util.scaling.int_states_in_range | ( | tuple[float, float] | low_high_range | ) |
Given a range of low and high values return how many integer states exist.
Definition at line 61 of file scaling.py.
| int homeassistant.util.scaling.scale_ranged_value_to_int_range | ( | tuple[float, float] | source_low_high_range, |
| tuple[float, float] | target_low_high_range, | ||
| float | value | ||
| ) |
Given a range of low and high values convert a single value to another range. Given a source low value of 1 and a high value of 255 and a target range from 1 to 100 this function will return: (1,255), (1,100), 255: 100 (1,255), (1,100), 127: 49 (1,255), (1,100), 10: 3
Definition at line 6 of file scaling.py.
| float homeassistant.util.scaling.scale_to_ranged_value | ( | tuple[float, float] | source_low_high_range, |
| tuple[float, float] | target_low_high_range, | ||
| float | value | ||
| ) |
Given a range of low and high values convert a single value to another range. Do not include 0 in a range if 0 means off, e.g. for brightness or fan speed. Given a source low value of 1 and a high value of 255 and a target range from 1 to 100 this function will return: (1,255), 255: 100 (1,255), 127: ~49.8039 (1,255), 10: ~3.9216
Definition at line 31 of file scaling.py.
| float homeassistant.util.scaling.states_in_range | ( | tuple[float, float] | low_high_range | ) |
Given a range of low and high values return how many states exist.
Definition at line 56 of file scaling.py.