[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove screenlogic from mypy ignore list #64512

Merged
merged 4 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions homeassistant/components/screenlogic/number.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -8,7 +9,7 @@
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__)
Expand Down Expand Up @@ -57,14 +58,16 @@ def value(self) -> float:

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]],
):
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/screenlogic/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ async def extract_screenlogic_config_entry_ids(service_call: ServiceCall):
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:
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2185,9 +2185,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

Expand Down
1 change: 0 additions & 1 deletion script/hassfest/mypy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"homeassistant.components.rachio.*",
"homeassistant.components.ring.*",
"homeassistant.components.ruckus_unleashed.*",
"homeassistant.components.screenlogic.*",
"homeassistant.components.search.*",
"homeassistant.components.sense.*",
"homeassistant.components.sharkiq.*",
Expand Down