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."""
|
"""Representation of an ATAG water heater."""
|
||||||
|
|
||||||
_attr_operation_list = OPERATION_LIST
|
_attr_operation_list = OPERATION_LIST
|
||||||
_attr_supported_features = 0
|
|
||||||
_attr_temperature_unit = TEMP_CELSIUS
|
_attr_temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -106,7 +106,7 @@ class EcoNetWaterHeater(EcoNetEntity, WaterHeaterEntity):
|
||||||
return op_list
|
return op_list
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self) -> WaterHeaterEntityFeature:
|
||||||
"""Return the list of supported features."""
|
"""Return the list of supported features."""
|
||||||
if self.water_heater.modes:
|
if self.water_heater.modes:
|
||||||
if self.water_heater.supports_away:
|
if self.water_heater.supports_away:
|
||||||
|
|
|
@ -88,11 +88,6 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return 0
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_operation(self) -> str:
|
def current_operation(self) -> str:
|
||||||
"""Return the current operation mode."""
|
"""Return the current operation mode."""
|
||||||
|
|
|
@ -167,7 +167,7 @@ class WaterHeaterEntity(Entity):
|
||||||
_attr_operation_list: list[str] | None = None
|
_attr_operation_list: list[str] | None = None
|
||||||
_attr_precision: float
|
_attr_precision: float
|
||||||
_attr_state: None = None
|
_attr_state: None = None
|
||||||
_attr_supported_features: int
|
_attr_supported_features: WaterHeaterEntityFeature | int = 0
|
||||||
_attr_target_temperature_high: float | None = None
|
_attr_target_temperature_high: float | None = None
|
||||||
_attr_target_temperature_low: float | None = None
|
_attr_target_temperature_low: float | None = None
|
||||||
_attr_target_temperature: float | None = None
|
_attr_target_temperature: float | None = None
|
||||||
|
@ -341,6 +341,11 @@ class WaterHeaterEntity(Entity):
|
||||||
DEFAULT_MAX_TEMP, TEMP_FAHRENHEIT, self.temperature_unit
|
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(
|
async def async_service_away_mode(
|
||||||
entity: WaterHeaterEntity, service: ServiceCall
|
entity: WaterHeaterEntity, service: ServiceCall
|
||||||
|
|
|
@ -2510,24 +2510,36 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
base_class="WaterHeaterEntity",
|
base_class="WaterHeaterEntity",
|
||||||
matches=[
|
matches=[
|
||||||
TypeHintMatch(
|
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",
|
return_type="float",
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="temperature_unit",
|
function_name="min_temp",
|
||||||
return_type="str",
|
return_type="float",
|
||||||
),
|
|
||||||
TypeHintMatch(
|
|
||||||
function_name="current_operation",
|
|
||||||
return_type=["str", None],
|
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="operation_list",
|
function_name="operation_list",
|
||||||
return_type=["list[str]", None],
|
return_type=["list[str]", None],
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="current_temperature",
|
function_name="precision",
|
||||||
return_type=["float", None],
|
return_type="float",
|
||||||
|
),
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="supported_features",
|
||||||
|
return_type=["WaterHeaterEntityFeature", "int"],
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="target_temperature",
|
function_name="target_temperature",
|
||||||
|
@ -2542,8 +2554,8 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
return_type=["float", None],
|
return_type=["float", None],
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="is_away_mode_on",
|
function_name="temperature_unit",
|
||||||
return_type=["bool", None],
|
return_type="str",
|
||||||
),
|
),
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="set_temperature",
|
function_name="set_temperature",
|
||||||
|
@ -2567,14 +2579,6 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
return_type=None,
|
return_type=None,
|
||||||
has_async_counterpart=True,
|
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