Remove evohome climate from mypy ignore list (#75169)
* Remove evohome climate from mypy ignore list * Raise error
This commit is contained in:
parent
c260413e2a
commit
e16bd1e471
4 changed files with 15 additions and 26 deletions
|
@ -540,11 +540,11 @@ class EvoDevice(Entity):
|
|||
return
|
||||
await self.async_tcs_svc_request(payload["service"], payload["data"])
|
||||
|
||||
async def async_tcs_svc_request(self, service: dict, data: dict) -> None:
|
||||
async def async_tcs_svc_request(self, service: str, data: dict[str, Any]) -> None:
|
||||
"""Process a service request (system mode) for a controller."""
|
||||
raise NotImplementedError
|
||||
|
||||
async def async_zone_svc_request(self, service: dict, data: dict) -> None:
|
||||
async def async_zone_svc_request(self, service: str, data: dict[str, Any]) -> None:
|
||||
"""Process a service request (setpoint override) for a zone."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from datetime import datetime as dt
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.climate import ClimateEntity
|
||||
from homeassistant.components.climate.const import (
|
||||
|
@ -15,6 +16,7 @@ from homeassistant.components.climate.const import (
|
|||
)
|
||||
from homeassistant.const import PRECISION_TENTHS, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
@ -93,9 +95,8 @@ async def async_setup_platform(
|
|||
broker.params[CONF_LOCATION_IDX],
|
||||
)
|
||||
|
||||
controller = EvoController(broker, broker.tcs)
|
||||
entities: list[EvoClimateEntity] = [EvoController(broker, broker.tcs)]
|
||||
|
||||
zones = []
|
||||
for zone in broker.tcs.zones.values():
|
||||
if zone.modelType == "HeatingZone" or zone.zoneType == "Thermostat":
|
||||
_LOGGER.debug(
|
||||
|
@ -107,7 +108,7 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
new_entity = EvoZone(broker, zone)
|
||||
zones.append(new_entity)
|
||||
entities.append(new_entity)
|
||||
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
|
@ -119,7 +120,7 @@ async def async_setup_platform(
|
|||
zone.name,
|
||||
)
|
||||
|
||||
async_add_entities([controller] + zones, update_before_add=True)
|
||||
async_add_entities(entities, update_before_add=True)
|
||||
|
||||
|
||||
class EvoClimateEntity(EvoDevice, ClimateEntity):
|
||||
|
@ -168,7 +169,7 @@ class EvoZone(EvoChild, EvoClimateEntity):
|
|||
ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
|
||||
async def async_zone_svc_request(self, service: dict, data: dict) -> None:
|
||||
async def async_zone_svc_request(self, service: str, data: dict[str, Any]) -> None:
|
||||
"""Process a service request (setpoint override) for a zone."""
|
||||
if service == SVC_RESET_ZONE_OVERRIDE:
|
||||
await self._evo_broker.call_client_api(
|
||||
|
@ -272,7 +273,7 @@ class EvoZone(EvoChild, EvoClimateEntity):
|
|||
self._evo_device.cancel_temp_override()
|
||||
)
|
||||
|
||||
async def async_set_preset_mode(self, preset_mode: str | None) -> None:
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set the preset mode; if None, then revert to following the schedule."""
|
||||
evo_preset_mode = HA_PRESET_TO_EVO.get(preset_mode, EVO_FOLLOW)
|
||||
|
||||
|
@ -332,7 +333,7 @@ class EvoController(EvoClimateEntity):
|
|||
ClimateEntityFeature.PRESET_MODE if self._attr_preset_modes else 0
|
||||
)
|
||||
|
||||
async def async_tcs_svc_request(self, service: dict, data: dict) -> None:
|
||||
async def async_tcs_svc_request(self, service: str, data: dict[str, Any]) -> None:
|
||||
"""Process a service request (system mode) for a controller.
|
||||
|
||||
Data validation is not required, it will have been done upstream.
|
||||
|
@ -385,25 +386,17 @@ class EvoController(EvoClimateEntity):
|
|||
"""Return the current preset mode, e.g., home, away, temp."""
|
||||
return TCS_PRESET_TO_HA.get(self._evo_tcs.systemModeStatus["mode"])
|
||||
|
||||
@property
|
||||
def min_temp(self) -> float:
|
||||
"""Return None as Controllers don't have a target temperature."""
|
||||
return None
|
||||
|
||||
@property
|
||||
def max_temp(self) -> float:
|
||||
"""Return None as Controllers don't have a target temperature."""
|
||||
return None
|
||||
|
||||
async def async_set_temperature(self, **kwargs) -> None:
|
||||
"""Raise exception as Controllers don't have a target temperature."""
|
||||
raise NotImplementedError("Evohome Controllers don't have target temperatures.")
|
||||
|
||||
async def async_set_hvac_mode(self, hvac_mode: str) -> None:
|
||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set an operating mode for a Controller."""
|
||||
await self._set_tcs_mode(HA_HVAC_TO_TCS.get(hvac_mode))
|
||||
if not (tcs_mode := HA_HVAC_TO_TCS.get(hvac_mode)):
|
||||
raise HomeAssistantError(f"Invalid hvac_mode: {hvac_mode}")
|
||||
await self._set_tcs_mode(tcs_mode)
|
||||
|
||||
async def async_set_preset_mode(self, preset_mode: str | None) -> None:
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set the preset mode; if None, then revert to 'Auto' mode."""
|
||||
await self._set_tcs_mode(HA_PRESET_TO_TCS.get(preset_mode, EVO_AUTO))
|
||||
|
||||
|
|
3
mypy.ini
3
mypy.ini
|
@ -2665,9 +2665,6 @@ ignore_errors = true
|
|||
[mypy-homeassistant.components.evohome]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.evohome.climate]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.minecraft_server]
|
||||
ignore_errors = true
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||
"homeassistant.components.cloud.client",
|
||||
"homeassistant.components.cloud.http_api",
|
||||
"homeassistant.components.evohome",
|
||||
"homeassistant.components.evohome.climate",
|
||||
"homeassistant.components.minecraft_server",
|
||||
"homeassistant.components.minecraft_server.helpers",
|
||||
"homeassistant.components.minecraft_server.sensor",
|
||||
|
|
Loading…
Add table
Reference in a new issue