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