Remove screenlogic from mypy ignore list (#64512)

* Adjust screenlogic

* Adjust mypy_config

* Adjust coordinator cast

* Move cast higher up

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-20 09:06:44 +01:00 committed by GitHub
parent ca6dd09fc2
commit e56c64db07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,6 @@
"""Support for a ScreenLogic number entity."""
import logging
from typing import cast
from screenlogicpy.const import BODY_TYPE, DATA as SL_DATA, EQUIPMENT, SCG
@ -8,7 +9,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ScreenlogicEntity
from . import ScreenlogicDataUpdateCoordinator, ScreenlogicEntity
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
@ -57,14 +58,16 @@ class ScreenLogicNumber(ScreenlogicEntity, NumberEntity):
async def async_set_value(self, value: float) -> None:
"""Update the current value."""
coordinator = cast(ScreenlogicDataUpdateCoordinator, self.coordinator)
# Need to set both levels at the same time, so we gather
# both existing level values and override the one that changed.
levels = {}
for level in SUPPORTED_SCG_NUMBERS:
levels[level] = self.coordinator.data[SL_DATA.KEY_SCG][level]["value"]
levels[level] = coordinator.data[SL_DATA.KEY_SCG][level]["value"]
levels[self._data_key] = int(value)
if await self.coordinator.gateway.async_set_scg_config(
if await coordinator.gateway.async_set_scg_config(
levels[SUPPORTED_SCG_NUMBERS[BODY_TYPE.POOL]],
levels[SUPPORTED_SCG_NUMBERS[BODY_TYPE.SPA]],
):

View file

@ -37,7 +37,8 @@ def async_load_screenlogic_services(hass: HomeAssistant):
return [
entry_id
for entry_id in await async_extract_config_entry_ids(hass, service_call)
if hass.config_entries.async_get_entry(entry_id).domain == DOMAIN
if (entry := hass.config_entries.async_get_entry(entry_id))
and entry.domain == DOMAIN
]
async def async_set_color_mode(service_call: ServiceCall) -> None:

View file

@ -2182,9 +2182,6 @@ ignore_errors = true
[mypy-homeassistant.components.ruckus_unleashed.*]
ignore_errors = true
[mypy-homeassistant.components.screenlogic.*]
ignore_errors = true
[mypy-homeassistant.components.search.*]
ignore_errors = true

View file

@ -69,7 +69,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.profiler.*",
"homeassistant.components.ring.*",
"homeassistant.components.ruckus_unleashed.*",
"homeassistant.components.screenlogic.*",
"homeassistant.components.search.*",
"homeassistant.components.sense.*",
"homeassistant.components.sharkiq.*",