Adjust type hints for WaterHeaterEntityFeature (#82270)
This commit is contained in:
parent
ced16da576
commit
9d607c8bd5
5 changed files with 30 additions and 27 deletions
|
@ -30,7 +30,6 @@ class AtagWaterHeater(AtagEntity, WaterHeaterEntity):
|
|||
"""Representation of an ATAG water heater."""
|
||||
|
||||
_attr_operation_list = OPERATION_LIST
|
||||
_attr_supported_features = 0
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
|
|
|
@ -106,7 +106,7 @@ class EcoNetWaterHeater(EcoNetEntity, WaterHeaterEntity):
|
|||
return op_list
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
def supported_features(self) -> WaterHeaterEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
if self.water_heater.modes:
|
||||
if self.water_heater.supports_away:
|
||||
|
|
|
@ -88,11 +88,6 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
|||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return the list of supported features."""
|
||||
return 0
|
||||
|
||||
@property
|
||||
def current_operation(self) -> str:
|
||||
"""Return the current operation mode."""
|
||||
|
|
|
@ -167,7 +167,7 @@ class WaterHeaterEntity(Entity):
|
|||
_attr_operation_list: list[str] | None = None
|
||||
_attr_precision: float
|
||||
_attr_state: None = None
|
||||
_attr_supported_features: int
|
||||
_attr_supported_features: WaterHeaterEntityFeature | int = 0
|
||||
_attr_target_temperature_high: float | None = None
|
||||
_attr_target_temperature_low: float | None = None
|
||||
_attr_target_temperature: float | None = None
|
||||
|
@ -341,6 +341,11 @@ class WaterHeaterEntity(Entity):
|
|||
DEFAULT_MAX_TEMP, TEMP_FAHRENHEIT, self.temperature_unit
|
||||
)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> WaterHeaterEntityFeature | int:
|
||||
"""Return the list of supported features."""
|
||||
return self._attr_supported_features
|
||||
|
||||
|
||||
async def async_service_away_mode(
|
||||
entity: WaterHeaterEntity, service: ServiceCall
|
||||
|
|
|
@ -2510,24 +2510,36 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
base_class="WaterHeaterEntity",
|
||||
matches=[
|
||||
TypeHintMatch(
|
||||
function_name="precision",
|
||||
function_name="current_operation",
|
||||
return_type=["str", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="current_temperature",
|
||||
return_type=["float", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="is_away_mode_on",
|
||||
return_type=["bool", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="max_temp",
|
||||
return_type="float",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="temperature_unit",
|
||||
return_type="str",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="current_operation",
|
||||
return_type=["str", None],
|
||||
function_name="min_temp",
|
||||
return_type="float",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="operation_list",
|
||||
return_type=["list[str]", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="current_temperature",
|
||||
return_type=["float", None],
|
||||
function_name="precision",
|
||||
return_type="float",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="supported_features",
|
||||
return_type=["WaterHeaterEntityFeature", "int"],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="target_temperature",
|
||||
|
@ -2542,8 +2554,8 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
return_type=["float", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="is_away_mode_on",
|
||||
return_type=["bool", None],
|
||||
function_name="temperature_unit",
|
||||
return_type="str",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="set_temperature",
|
||||
|
@ -2567,14 +2579,6 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
return_type=None,
|
||||
has_async_counterpart=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="min_temp",
|
||||
return_type="float",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="max_temp",
|
||||
return_type="float",
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue