|
| float | convert_interval (cls, float interval, str from_unit, str to_unit) |
| |
| Callable[[float], float] | converter_factory (cls, str|None from_unit, str|None to_unit) |
| |
| Callable[[float|None], float|None] | converter_factory_allow_none (cls, str|None from_unit, str|None to_unit) |
| |
| float | convert (cls, float value, str|None from_unit, str|None to_unit) |
| |
| float | get_unit_ratio (cls, str|None from_unit, str|None to_unit) |
| |
Utility to convert temperature values.
Definition at line 485 of file unit_conversion.py.
◆ _celsius_to_fahrenheit()
| float homeassistant.util.unit_conversion.TemperatureConverter._celsius_to_fahrenheit |
( |
|
cls, |
|
|
float |
celsius |
|
) |
| |
|
private |
◆ _celsius_to_kelvin()
| float homeassistant.util.unit_conversion.TemperatureConverter._celsius_to_kelvin |
( |
|
cls, |
|
|
float |
celsius |
|
) |
| |
|
private |
◆ _converter_factory()
| Callable[[float], float] homeassistant.util.unit_conversion.TemperatureConverter._converter_factory |
( |
|
cls, |
|
|
str | None |
from_unit, |
|
|
str | None
|
to_unit |
|
) |
| |
|
private |
Convert a temperature from one unit to another.
eg. 10°C will return 50°F
For converting an interval between two temperatures, please use
`convert_interval` instead.
Definition at line 529 of file unit_conversion.py.
◆ _fahrenheit_to_celsius()
| float homeassistant.util.unit_conversion.TemperatureConverter._fahrenheit_to_celsius |
( |
|
cls, |
|
|
float |
fahrenheit |
|
) |
| |
|
private |
◆ _fahrenheit_to_kelvin()
| float homeassistant.util.unit_conversion.TemperatureConverter._fahrenheit_to_kelvin |
( |
|
cls, |
|
|
float |
fahrenheit |
|
) |
| |
|
private |
◆ _kelvin_to_celsius()
| float homeassistant.util.unit_conversion.TemperatureConverter._kelvin_to_celsius |
( |
|
cls, |
|
|
float |
kelvin |
|
) |
| |
|
private |
◆ _kelvin_to_fahrenheit()
| float homeassistant.util.unit_conversion.TemperatureConverter._kelvin_to_fahrenheit |
( |
|
cls, |
|
|
float |
kelvin |
|
) |
| |
|
private |
◆ convert_interval()
| float homeassistant.util.unit_conversion.TemperatureConverter.convert_interval |
( |
|
cls, |
|
|
float |
interval, |
|
|
str |
from_unit, |
|
|
str |
to_unit |
|
) |
| |
Convert a temperature interval from one unit to another.
eg. a 10°C interval (10°C to 20°C) will return a 18°F (50°F to 68°F) interval
For converting a temperature value, please use `convert` as this method
skips floor adjustment.
Definition at line 572 of file unit_conversion.py.
◆ converter_factory()
| Callable[[float], float] homeassistant.util.unit_conversion.TemperatureConverter.converter_factory |
( |
|
cls, |
|
|
str | None |
from_unit, |
|
|
str | None
|
to_unit |
|
) |
| |
◆ converter_factory_allow_none()
| Callable[[float | None], float | None] homeassistant.util.unit_conversion.TemperatureConverter.converter_factory_allow_none |
( |
|
cls, |
|
|
str | None |
from_unit, |
|
|
str | None
|
to_unit |
|
) |
| |
◆ _UNIT_CONVERSION
| dictionary homeassistant.util.unit_conversion.TemperatureConverter._UNIT_CONVERSION |
|
staticprivate |
Initial value:= {
UnitOfTemperature.CELSIUS: 1.0,
UnitOfTemperature.FAHRENHEIT: 1.8,
UnitOfTemperature.KELVIN: 1.0,
}
Definition at line 494 of file unit_conversion.py.
◆ UNIT_CLASS
| string homeassistant.util.unit_conversion.TemperatureConverter.UNIT_CLASS = "temperature" |
|
static |
◆ VALID_UNITS
| dictionary homeassistant.util.unit_conversion.TemperatureConverter.VALID_UNITS |
|
static |
Initial value:= {
UnitOfTemperature.CELSIUS,
UnitOfTemperature.FAHRENHEIT,
UnitOfTemperature.KELVIN,
}
Definition at line 489 of file unit_conversion.py.
The documentation for this class was generated from the following file: