diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index dbd74d1c5e8..cc26bcc9bcc 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -19,7 +19,7 @@ from homeassistant.const import ( STATE_ON, TEMP_CELSIUS, ) -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, ServiceCall import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, @@ -29,7 +29,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401 from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.temperature import display_temp as show_temp -from homeassistant.helpers.typing import ConfigType, ServiceDataType +from homeassistant.helpers.typing import ConfigType from homeassistant.util.temperature import convert as convert_temperature from .const import ( @@ -248,7 +248,7 @@ class ClimateEntity(Entity): def state_attributes(self) -> dict[str, Any]: """Return the optional state attributes.""" supported_features = self.supported_features - data = { + data: dict[str, str | float | None] = { ATTR_CURRENT_TEMPERATURE: show_temp( self.hass, self.current_temperature, @@ -498,7 +498,7 @@ class ClimateEntity(Entity): """Turn the entity on.""" if hasattr(self, "turn_on"): # pylint: disable=no-member - await self.hass.async_add_executor_job(self.turn_on) + await self.hass.async_add_executor_job(self.turn_on) # type: ignore[attr-defined] return # Fake turn on @@ -512,7 +512,7 @@ class ClimateEntity(Entity): """Turn the entity off.""" if hasattr(self, "turn_off"): # pylint: disable=no-member - await self.hass.async_add_executor_job(self.turn_off) + await self.hass.async_add_executor_job(self.turn_off) # type: ignore[attr-defined] return # Fake turn off @@ -554,23 +554,23 @@ class ClimateEntity(Entity): async def async_service_aux_heat( - entity: ClimateEntity, service: ServiceDataType + entity: ClimateEntity, service_call: ServiceCall ) -> None: """Handle aux heat service.""" - if service.data[ATTR_AUX_HEAT]: + if service_call.data[ATTR_AUX_HEAT]: await entity.async_turn_aux_heat_on() else: await entity.async_turn_aux_heat_off() async def async_service_temperature_set( - entity: ClimateEntity, service: ServiceDataType + entity: ClimateEntity, service_call: ServiceCall ) -> None: """Handle set temperature service.""" hass = entity.hass kwargs = {} - for value, temp in service.data.items(): + for value, temp in service_call.data.items(): if value in CONVERTIBLE_ATTRIBUTE: kwargs[value] = convert_temperature( temp, hass.config.units.temperature_unit, entity.temperature_unit diff --git a/homeassistant/components/climate/device_condition.py b/homeassistant/components/climate/device_condition.py index 3fc6d94ba4f..97bb4515f14 100644 --- a/homeassistant/components/climate/device_condition.py +++ b/homeassistant/components/climate/device_condition.py @@ -85,7 +85,7 @@ def async_condition_from_config( def test_is_state(hass: HomeAssistant, variables: TemplateVarsType) -> bool: """Test if an entity is a certain state.""" state = hass.states.get(config[ATTR_ENTITY_ID]) - return state and state.attributes.get(attribute) == config[attribute] + return state.attributes.get(attribute) == config[attribute] if state else False return test_is_state diff --git a/mypy.ini b/mypy.ini index 4e27da2fcb5..08bcedaf900 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1058,9 +1058,6 @@ ignore_errors = true [mypy-homeassistant.components.climacell.*] ignore_errors = true -[mypy-homeassistant.components.climate.*] -ignore_errors = true - [mypy-homeassistant.components.cloud.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index c63033dacc8..35d38a581a7 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -33,7 +33,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.cast.*", "homeassistant.components.cert_expiry.*", "homeassistant.components.climacell.*", - "homeassistant.components.climate.*", "homeassistant.components.cloud.*", "homeassistant.components.cloudflare.*", "homeassistant.components.config.*",