Home Assistant Unofficial Reference 2024.12.1
homeassistant.util.unit_conversion.SpeedConverter Class Reference
Inheritance diagram for homeassistant.util.unit_conversion.SpeedConverter:
[legend]
Collaboration diagram for homeassistant.util.unit_conversion.SpeedConverter:
[legend]

Public Member Functions

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)
 
- Public Member Functions inherited from homeassistant.util.unit_conversion.BaseUnitConverter
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)
 

Static Public Attributes

string UNIT_CLASS = "speed"
 
dictionary VALID_UNITS
 

Private Member Functions

float _beaufort_to_ms (cls, float beaufort)
 
Callable[[float], float] _converter_factory (cls, str|None from_unit, str|None to_unit)
 
float _ms_to_beaufort (cls, float ms)
 

Detailed Description

Utility to convert speed values.

Definition at line 387 of file unit_conversion.py.

Member Function Documentation

◆ _beaufort_to_ms()

float homeassistant.util.unit_conversion.SpeedConverter._beaufort_to_ms (   cls,
float  beaufort 
)
private
Convert a speed in Beaufort to m/s.

Definition at line 480 of file unit_conversion.py.

◆ _converter_factory()

Callable[[float], float] homeassistant.util.unit_conversion.SpeedConverter._converter_factory (   cls,
str | None  from_unit,
str | None   to_unit 
)
private
Convert a speed from one unit to another, eg. 14m/s will return 7Bft.

Definition at line 450 of file unit_conversion.py.

◆ _ms_to_beaufort()

float homeassistant.util.unit_conversion.SpeedConverter._ms_to_beaufort (   cls,
float  ms 
)
private
Convert a speed in m/s to Beaufort.

Definition at line 475 of file unit_conversion.py.

◆ converter_factory()

Callable[[float], float] homeassistant.util.unit_conversion.SpeedConverter.converter_factory (   cls,
str | None  from_unit,
str | None   to_unit 
)
Return a function to convert a speed from one unit to another.

Reimplemented from homeassistant.util.unit_conversion.BaseUnitConverter.

Definition at line 422 of file unit_conversion.py.

◆ converter_factory_allow_none()

Callable[[float | None], float | None] homeassistant.util.unit_conversion.SpeedConverter.converter_factory_allow_none (   cls,
str | None  from_unit,
str | None   to_unit 
)
Return a function to convert a speed from one unit to another which allows None.

Reimplemented from homeassistant.util.unit_conversion.BaseUnitConverter.

Definition at line 436 of file unit_conversion.py.

Member Data Documentation

◆ UNIT_CLASS

string homeassistant.util.unit_conversion.SpeedConverter.UNIT_CLASS = "speed"
static

Definition at line 390 of file unit_conversion.py.

◆ VALID_UNITS

dictionary homeassistant.util.unit_conversion.SpeedConverter.VALID_UNITS
static
Initial value:
= {
UnitOfVolumetricFlux.INCHES_PER_DAY,
UnitOfVolumetricFlux.INCHES_PER_HOUR,
UnitOfVolumetricFlux.MILLIMETERS_PER_DAY,
UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
UnitOfSpeed.INCHES_PER_SECOND,
UnitOfSpeed.FEET_PER_SECOND,
UnitOfSpeed.KILOMETERS_PER_HOUR,
UnitOfSpeed.KNOTS,
UnitOfSpeed.METERS_PER_SECOND,
UnitOfSpeed.MILES_PER_HOUR,
UnitOfSpeed.MILLIMETERS_PER_SECOND,
UnitOfSpeed.BEAUFORT,
}

Definition at line 405 of file unit_conversion.py.


The documentation for this class was generated from the following file: