Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@attr.s
class ClimateState(EntityState):
mode = attr.ib(type=ClimateMode, converter=ClimateMode,
default=ClimateMode.OFF)
action = attr.ib(type=ClimateAction, converter=ClimateAction,
default=ClimateAction.OFF)
current_temperature = attr.ib(type=float, default=0.0)
target_temperature = attr.ib(type=float, default=0.0)
target_temperature_low = attr.ib(type=float, default=0.0)
target_temperature_high = attr.ib(type=float, default=0.0)
away = attr.ib(type=bool, default=False)
fan_mode = attr.ib(
type=ClimateFanMode, converter=ClimateFanMode, default=ClimateFanMode.AUTO
)
swing_mode = attr.ib(
type=ClimateSwingMode, converter=ClimateSwingMode, default=ClimateSwingMode.OFF
)
COMPONENT_TYPE_TO_INFO = {
'binary_sensor': BinarySensorInfo,
'cover': CoverInfo,
'fan': FanInfo,
'light': LightInfo,
'sensor': SensorInfo,
'switch': SwitchInfo,
'text_sensor': TextSensorInfo,
'camera': CameraInfo,
'climate': ClimateInfo,
}
def _convert_climate_swing_modes(value):
return [ClimateSwingMode(val) for val in value]
@attr.s
class ClimateInfo(EntityInfo):
supports_current_temperature = attr.ib(type=bool, default=False)
supports_two_point_target_temperature = attr.ib(type=bool, default=False)
supported_modes = attr.ib(type=List[ClimateMode], converter=_convert_climate_modes,
factory=list)
visual_min_temperature = attr.ib(type=float, default=0.0)
visual_max_temperature = attr.ib(type=float, default=0.0)
visual_temperature_step = attr.ib(type=float, default=0.0)
supports_away = attr.ib(type=bool, default=False)
supports_action = attr.ib(type=bool, default=False)
supported_fan_modes = attr.ib(
type=List[ClimateFanMode], converter=_convert_climate_fan_modes, factory=list
)
supported_swing_modes = attr.ib(
type=List[ClimateSwingMode], converter=_convert_climate_swing_modes, factory=list
)
@attr.s
class ClimateState(EntityState):
mode = attr.ib(type=ClimateMode, converter=ClimateMode,
default=ClimateMode.OFF)
action = attr.ib(type=ClimateAction, converter=ClimateAction,
default=ClimateAction.OFF)
current_temperature = attr.ib(type=float, default=0.0)
target_temperature = attr.ib(type=float, default=0.0)
target_temperature_low = attr.ib(type=float, default=0.0)
target_temperature_high = attr.ib(type=float, default=0.0)
away = attr.ib(type=bool, default=False)
fan_mode = attr.ib(
type=ClimateFanMode, converter=ClimateFanMode, default=ClimateFanMode.AUTO