diff --git a/homeassistant/components/lyric/climate.py b/homeassistant/components/lyric/climate.py index b5c1fb05efa..8353ae15b3c 100644 --- a/homeassistant/components/lyric/climate.py +++ b/homeassistant/components/lyric/climate.py @@ -4,6 +4,7 @@ from __future__ import annotations import asyncio import logging from time import localtime, strftime, time +from typing import Any from aiolyric.objects.device import LyricDevice from aiolyric.objects.location import LyricLocation @@ -186,7 +187,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity): return self.device.indoorTemperature @property - def hvac_action(self) -> HVACAction: + def hvac_action(self) -> HVACAction | None: """Return the current hvac action.""" action = HVAC_ACTIONS.get(self.device.operationStatus.mode, None) if action == HVACAction.OFF and self.hvac_mode != HVACMode.OFF: @@ -265,7 +266,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity): return device.maxHeatSetpoint return device.maxCoolSetpoint - async def async_set_temperature(self, **kwargs) -> None: + async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" if self.hvac_mode == HVACMode.OFF: return diff --git a/homeassistant/components/lyric/config_flow.py b/homeassistant/components/lyric/config_flow.py index 12f91cfe206..de6808dd0de 100644 --- a/homeassistant/components/lyric/config_flow.py +++ b/homeassistant/components/lyric/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Honeywell Lyric.""" +from __future__ import annotations + from collections.abc import Mapping import logging from typing import Any @@ -25,13 +27,15 @@ class OAuth2FlowHandler( """Perform reauth upon an API authentication error.""" return await self.async_step_reauth_confirm() - async def async_step_reauth_confirm(self, user_input=None): + async def async_step_reauth_confirm( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Dialog that informs the user that reauth is required.""" if user_input is None: return self.async_show_form(step_id="reauth_confirm") return await self.async_step_user() - async def async_oauth_create_entry(self, data: dict) -> dict: + async def async_oauth_create_entry(self, data: dict[str, Any]) -> FlowResult: """Create an oauth config entry or update existing entry for reauth.""" existing_entry = await self.async_set_unique_id(DOMAIN) if existing_entry: diff --git a/homeassistant/components/lyric/sensor.py b/homeassistant/components/lyric/sensor.py index 5b60935d667..d727b24eee4 100644 --- a/homeassistant/components/lyric/sensor.py +++ b/homeassistant/components/lyric/sensor.py @@ -47,9 +47,11 @@ class LyricSensorEntityDescription(SensorEntityDescription): value: Callable[[LyricDevice], StateType | datetime] = round -def get_datetime_from_future_time(time: str) -> datetime: +def get_datetime_from_future_time(time_str: str) -> datetime: """Get datetime from future time provided.""" - time = dt_util.parse_time(time) + time = dt_util.parse_time(time_str) + if time is None: + raise ValueError(f"Unable to parse time {time_str}") now = dt_util.utcnow() if time <= now.time(): now = now + timedelta(days=1) @@ -64,7 +66,7 @@ async def async_setup_entry( entities = [] - def get_setpoint_status(status: str, time: str) -> str: + def get_setpoint_status(status: str, time: str) -> str | None: if status == PRESET_HOLD_UNTIL: return f"Held until {time}" return LYRIC_SETPOINT_STATUS_NAMES.get(status, None) diff --git a/mypy.ini b/mypy.ini index 91dc7f9e71f..52c4dce061f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2752,15 +2752,6 @@ ignore_errors = true [mypy-homeassistant.components.lovelace.websocket] ignore_errors = true -[mypy-homeassistant.components.lyric.climate] -ignore_errors = true - -[mypy-homeassistant.components.lyric.config_flow] -ignore_errors = true - -[mypy-homeassistant.components.lyric.sensor] -ignore_errors = true - [mypy-homeassistant.components.meteo_france.sensor] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index d987a76d41d..521c98ea93d 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -59,9 +59,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.lovelace.dashboard", "homeassistant.components.lovelace.resources", "homeassistant.components.lovelace.websocket", - "homeassistant.components.lyric.climate", - "homeassistant.components.lyric.config_flow", - "homeassistant.components.lyric.sensor", "homeassistant.components.meteo_france.sensor", "homeassistant.components.meteo_france.weather", "homeassistant.components.minecraft_server",