Improve typing in climate.py (#89577)
This commit is contained in:
parent
431a8d0047
commit
429e52cf3d
1 changed files with 12 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Support for the iZone HVAC."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
|
@ -246,7 +247,7 @@ class ControllerDevice(ClimateEntity):
|
|||
zone.async_schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
def unique_id(self) -> str:
|
||||
"""Return the ID of the controller device."""
|
||||
return self._controller.device_uid
|
||||
|
||||
|
@ -256,7 +257,7 @@ class ControllerDevice(ClimateEntity):
|
|||
return f"iZone Controller {self._controller.device_uid}"
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||
"""Return the optional state attributes."""
|
||||
return {
|
||||
"supply_temperature": show_temp(
|
||||
|
@ -306,13 +307,13 @@ class ControllerDevice(ClimateEntity):
|
|||
|
||||
@property
|
||||
@_return_on_connection_error(PRESET_NONE)
|
||||
def preset_mode(self):
|
||||
def preset_mode(self) -> str:
|
||||
"""Eco mode is external air."""
|
||||
return PRESET_ECO if self._controller.free_air else PRESET_NONE
|
||||
|
||||
@property
|
||||
@_return_on_connection_error([PRESET_NONE])
|
||||
def preset_modes(self):
|
||||
def preset_modes(self) -> list[str]:
|
||||
"""Available preset modes, normal or eco."""
|
||||
if self._controller.free_air_enabled:
|
||||
return [PRESET_NONE, PRESET_ECO]
|
||||
|
@ -507,7 +508,7 @@ class ZoneDevice(ClimateEntity):
|
|||
return self._controller.available
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
def unique_id(self) -> str:
|
||||
"""Return the ID of the controller device."""
|
||||
return f"{self._controller.unique_id}_z{self._zone.index + 1}"
|
||||
|
||||
|
@ -539,29 +540,29 @@ class ZoneDevice(ClimateEntity):
|
|||
return list(self._state_to_pizone)
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
def current_temperature(self) -> float:
|
||||
"""Return the current temperature."""
|
||||
return self._zone.temp_current
|
||||
|
||||
@property
|
||||
def target_temperature(self):
|
||||
def target_temperature(self) -> float | None:
|
||||
"""Return the temperature we try to reach."""
|
||||
if self._zone.type != Zone.Type.AUTO:
|
||||
return None
|
||||
return self._zone.temp_setpoint
|
||||
|
||||
@property
|
||||
def target_temperature_step(self):
|
||||
def target_temperature_step(self) -> float:
|
||||
"""Return the supported step of target temperature."""
|
||||
return 0.5
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
def min_temp(self) -> float:
|
||||
"""Return the minimum temperature."""
|
||||
return self._controller.min_temp
|
||||
|
||||
@property
|
||||
def max_temp(self):
|
||||
def max_temp(self) -> float:
|
||||
"""Return the maximum temperature."""
|
||||
return self._controller.max_temp
|
||||
|
||||
|
@ -626,7 +627,7 @@ class ZoneDevice(ClimateEntity):
|
|||
return self._zone.index
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||
"""Return the optional state attributes."""
|
||||
return {
|
||||
"airflow_max": self._zone.airflow_max,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue