Remove somfy from mypy ignore list (#64462)

* Adjust somfy

* Remove somfy from mypy-config

* Fix pylint
This commit is contained in:
epenet 2022-01-19 21:46:26 +01:00 committed by GitHub
parent 10538aabbf
commit 7592347715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 9 deletions

View File

@ -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]:

View File

@ -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]:

View File

@ -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.

View File

@ -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

View File

@ -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.*",