mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
Improve type hint in ephember climate entity (#77138)
This commit is contained in:
parent
d7685f869a
commit
b108ddbfd3
@ -80,6 +80,9 @@ def setup_platform(
|
|||||||
class EphEmberThermostat(ClimateEntity):
|
class EphEmberThermostat(ClimateEntity):
|
||||||
"""Representation of a EphEmber thermostat."""
|
"""Representation of a EphEmber thermostat."""
|
||||||
|
|
||||||
|
_attr_hvac_modes = OPERATION_LIST
|
||||||
|
_attr_temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
def __init__(self, ember, zone):
|
def __init__(self, ember, zone):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self._ember = ember
|
self._ember = ember
|
||||||
@ -87,23 +90,15 @@ class EphEmberThermostat(ClimateEntity):
|
|||||||
self._zone = zone
|
self._zone = zone
|
||||||
self._hot_water = zone_is_hot_water(zone)
|
self._hot_water = zone_is_hot_water(zone)
|
||||||
|
|
||||||
@property
|
self._attr_name = self._zone_name
|
||||||
def supported_features(self):
|
|
||||||
"""Return the list of supported features."""
|
self._attr_supported_features = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.AUX_HEAT
|
||||||
|
)
|
||||||
|
self._attr_target_temperature_step = 0.5
|
||||||
if self._hot_water:
|
if self._hot_water:
|
||||||
return ClimateEntityFeature.AUX_HEAT
|
self._attr_supported_features = ClimateEntityFeature.AUX_HEAT
|
||||||
|
self._attr_target_temperature_step = None
|
||||||
return ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.AUX_HEAT
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the thermostat, if any."""
|
|
||||||
return self._zone_name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def temperature_unit(self):
|
|
||||||
"""Return the unit of measurement which this thermostat uses."""
|
|
||||||
return TEMP_CELSIUS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
@ -116,15 +111,7 @@ class EphEmberThermostat(ClimateEntity):
|
|||||||
return zone_target_temperature(self._zone)
|
return zone_target_temperature(self._zone)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature_step(self):
|
def hvac_action(self) -> HVACAction:
|
||||||
"""Return the supported step of target temperature."""
|
|
||||||
if self._hot_water:
|
|
||||||
return None
|
|
||||||
|
|
||||||
return 0.5
|
|
||||||
|
|
||||||
@property
|
|
||||||
def hvac_action(self):
|
|
||||||
"""Return current HVAC action."""
|
"""Return current HVAC action."""
|
||||||
if zone_is_active(self._zone):
|
if zone_is_active(self._zone):
|
||||||
return HVACAction.HEATING
|
return HVACAction.HEATING
|
||||||
@ -132,16 +119,11 @@ class EphEmberThermostat(ClimateEntity):
|
|||||||
return HVACAction.IDLE
|
return HVACAction.IDLE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self):
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return current operation ie. heat, cool, idle."""
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
mode = zone_mode(self._zone)
|
mode = zone_mode(self._zone)
|
||||||
return self.map_mode_eph_hass(mode)
|
return self.map_mode_eph_hass(mode)
|
||||||
|
|
||||||
@property
|
|
||||||
def hvac_modes(self):
|
|
||||||
"""Return the supported operations."""
|
|
||||||
return OPERATION_LIST
|
|
||||||
|
|
||||||
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||||
"""Set the operation mode."""
|
"""Set the operation mode."""
|
||||||
mode = self.map_mode_hass_eph(hvac_mode)
|
mode = self.map_mode_hass_eph(hvac_mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user