mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Enable strict typing for Climate component (#99301)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
8bfdc5d3d9
commit
f24c4ceab6
@ -88,6 +88,7 @@ homeassistant.components.camera.*
|
|||||||
homeassistant.components.canary.*
|
homeassistant.components.canary.*
|
||||||
homeassistant.components.clickatell.*
|
homeassistant.components.clickatell.*
|
||||||
homeassistant.components.clicksend.*
|
homeassistant.components.clicksend.*
|
||||||
|
homeassistant.components.climate.*
|
||||||
homeassistant.components.cloud.*
|
homeassistant.components.cloud.*
|
||||||
homeassistant.components.configurator.*
|
homeassistant.components.configurator.*
|
||||||
homeassistant.components.cover.*
|
homeassistant.components.cover.*
|
||||||
|
@ -242,8 +242,9 @@ class ClimateEntity(Entity):
|
|||||||
hvac_mode = self.hvac_mode
|
hvac_mode = self.hvac_mode
|
||||||
if hvac_mode is None:
|
if hvac_mode is None:
|
||||||
return None
|
return None
|
||||||
|
# Support hvac_mode as string for custom integration backwards compatibility
|
||||||
if not isinstance(hvac_mode, HVACMode):
|
if not isinstance(hvac_mode, HVACMode):
|
||||||
return HVACMode(hvac_mode).value
|
return HVACMode(hvac_mode).value # type: ignore[unreachable]
|
||||||
return hvac_mode.value
|
return hvac_mode.value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -458,11 +459,11 @@ class ClimateEntity(Entity):
|
|||||||
"""
|
"""
|
||||||
return self._attr_swing_modes
|
return self._attr_swing_modes
|
||||||
|
|
||||||
def set_temperature(self, **kwargs) -> None:
|
def set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
await self.hass.async_add_executor_job(
|
await self.hass.async_add_executor_job(
|
||||||
ft.partial(self.set_temperature, **kwargs)
|
ft.partial(self.set_temperature, **kwargs)
|
||||||
|
@ -92,9 +92,9 @@ def async_condition_from_config(
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if config[CONF_TYPE] == "is_hvac_mode":
|
if config[CONF_TYPE] == "is_hvac_mode":
|
||||||
return state.state == config[const.ATTR_HVAC_MODE]
|
return bool(state.state == config[const.ATTR_HVAC_MODE])
|
||||||
|
|
||||||
return (
|
return bool(
|
||||||
state.attributes.get(const.ATTR_PRESET_MODE)
|
state.attributes.get(const.ATTR_PRESET_MODE)
|
||||||
== config[const.ATTR_PRESET_MODE]
|
== config[const.ATTR_PRESET_MODE]
|
||||||
)
|
)
|
||||||
|
@ -38,7 +38,9 @@ async def _async_reproduce_states(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Reproduce component states."""
|
"""Reproduce component states."""
|
||||||
|
|
||||||
async def call_service(service: str, keys: Iterable, data=None):
|
async def call_service(
|
||||||
|
service: str, keys: Iterable, data: dict[str, Any] | None = None
|
||||||
|
) -> None:
|
||||||
"""Call service with set of attributes given."""
|
"""Call service with set of attributes given."""
|
||||||
data = data or {}
|
data = data or {}
|
||||||
data["entity_id"] = state.entity_id
|
data["entity_id"] = state.entity_id
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -641,6 +641,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.components.climate.*]
|
||||||
|
check_untyped_defs = true
|
||||||
|
disallow_incomplete_defs = true
|
||||||
|
disallow_subclassing_any = true
|
||||||
|
disallow_untyped_calls = true
|
||||||
|
disallow_untyped_decorators = true
|
||||||
|
disallow_untyped_defs = true
|
||||||
|
warn_return_any = true
|
||||||
|
warn_unreachable = true
|
||||||
|
|
||||||
[mypy-homeassistant.components.cloud.*]
|
[mypy-homeassistant.components.cloud.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user