Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.esphome.enum_mapper Namespace Reference

Classes

class  EsphomeEnumMapper
 

Functions

None __init__ (self, dict[_EnumT, _ValT] mapping)
 
_ValT from_esphome (self, _EnumT value)
 
_ValT|None from_esphome (self, _EnumT|None value)
 
_EnumT from_hass (self, _ValT value)
 

Variables

 _mapping
 

Detailed Description

Helper class to convert between Home Assistant and ESPHome enum values.

Function Documentation

◆ __init__()

None homeassistant.components.esphome.enum_mapper.__init__ (   self,
dict[_EnumT, _ValT]  mapping 
)
Helper class to convert between hass and esphome enum values.
Construct a EsphomeEnumMapper.

Definition at line 11 of file enum_mapper.py.

◆ from_esphome() [1/2]

_ValT homeassistant.components.esphome.enum_mapper.from_esphome (   self,
_EnumT  value 
)

Definition at line 21 of file enum_mapper.py.

◆ from_esphome() [2/2]

_ValT | None homeassistant.components.esphome.enum_mapper.from_esphome ( self  ,
_EnumT|None  value 
)
Convert from an esphome int representation to a hass string.

Definition at line 24 of file enum_mapper.py.

◆ from_hass()

_EnumT homeassistant.components.esphome.enum_mapper.from_hass (   self,
_ValT  value 
)
Convert from a hass string to a esphome int representation.

Definition at line 30 of file enum_mapper.py.

Variable Documentation

◆ _mapping

homeassistant.components.esphome.enum_mapper._mapping
private

Definition at line 17 of file enum_mapper.py.