diff --git a/homeassistant/components/somfy/climate.py b/homeassistant/components/somfy/climate.py index e0d45ee0f0d..1e1e3cdca95 100644 --- a/homeassistant/components/somfy/climate.py +++ b/homeassistant/components/somfy/climate.py @@ -126,7 +126,7 @@ class SomfyClimate(SomfyEntity, ClimateEntity): """Return hvac operation ie. heat, cool mode.""" if self._climate.get_regulation_state() == RegulationState.TIMETABLE: return HVAC_MODE_AUTO - return HVAC_MODES_MAPPING.get(self._climate.get_hvac_state()) + return HVAC_MODES_MAPPING[self._climate.get_hvac_state()] @property def hvac_modes(self) -> list[str]: diff --git a/homeassistant/components/somfy/coordinator.py b/homeassistant/components/somfy/coordinator.py index c9633c4fa4d..a22f8185702 100644 --- a/homeassistant/components/somfy/coordinator.py +++ b/homeassistant/components/somfy/coordinator.py @@ -33,7 +33,7 @@ class SomfyDataUpdateCoordinator(DataUpdateCoordinator): ) self.data = {} self.client = client - self.site_device = {} + self.site_device: dict[str, list] = {} self.last_site_index = -1 async def _async_update_data(self) -> dict[str, Device]: diff --git a/homeassistant/components/somfy/cover.py b/homeassistant/components/somfy/cover.py index e3bc6ef6d94..91bebc1da0d 100644 --- a/homeassistant/components/somfy/cover.py +++ b/homeassistant/components/somfy/cover.py @@ -1,4 +1,8 @@ """Support for Somfy Covers.""" +from __future__ import annotations + +from typing import cast + from pymfy.api.devices.blind import Blind from pymfy.api.devices.category import Category @@ -23,6 +27,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity from .const import COORDINATOR, DOMAIN +from .coordinator import SomfyDataUpdateCoordinator from .entity import SomfyEntity BLIND_DEVICE_CATEGORIES = {Category.INTERIOR_BLIND.value, Category.EXTERIOR_BLIND.value} @@ -68,7 +73,9 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity): def _create_device(self) -> Blind: """Update the device with the latest data.""" - self._cover = Blind(self.device, self.coordinator.client) + self._cover = Blind( + self.device, cast(SomfyDataUpdateCoordinator, self.coordinator).client + ) @property def supported_features(self) -> int: @@ -155,7 +162,7 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity): return self._is_closing @property - def is_closed(self) -> bool: + def is_closed(self) -> bool | None: """Return if the cover is closed.""" is_closed = None if self.has_state("position"): @@ -165,7 +172,7 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity): return is_closed @property - def current_cover_tilt_position(self) -> int: + def current_cover_tilt_position(self) -> int | None: """Return current position of cover tilt. None is unknown, 0 is closed, 100 is fully open. diff --git a/mypy.ini b/mypy.ini index 983b10c9eb6..0cdcc020e42 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2206,9 +2206,6 @@ ignore_errors = true [mypy-homeassistant.components.solaredge.*] ignore_errors = true -[mypy-homeassistant.components.somfy.*] -ignore_errors = true - [mypy-homeassistant.components.sonos.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 1570579a605..a31c95f0cd2 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -77,7 +77,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.sma.*", "homeassistant.components.smartthings.*", "homeassistant.components.solaredge.*", - "homeassistant.components.somfy.*", "homeassistant.components.sonos.*", "homeassistant.components.spotify.*", "homeassistant.components.stt.*",