mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Remove integrations from mypy ignored modules (part 3) (#64414)
* Adjust kaiterra * Adjust keenetic_ndms2 * Adjust kodi * Adjust kulersky * Adjust litejet * Adjust motion_blinds * Cleanup mypy_config * Adjust kulersky * Adjust keenetic_ndms2 * Adjust kodi * Adjust motion_blinds * Introduce RequiredKeysMixin in kaiterra Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
29d13110af
commit
f6bc21d2aa
@ -69,7 +69,7 @@ CONF_AQI_STANDARD = "aqi_standard"
|
||||
CONF_PREFERRED_UNITS = "preferred_units"
|
||||
|
||||
DEFAULT_AQI_STANDARD = "us"
|
||||
DEFAULT_PREFERRED_UNIT = []
|
||||
DEFAULT_PREFERRED_UNIT: list[str] = []
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
PLATFORMS = [Platform.SENSOR, Platform.AIR_QUALITY]
|
||||
|
@ -1,6 +1,8 @@
|
||||
"""Support for Kaiterra Temperature ahn Humidity Sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@ -14,14 +16,29 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import DISPATCHER_KAITERRA, DOMAIN
|
||||
|
||||
|
||||
@dataclass
|
||||
class KaiterraSensorRequiredKeysMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
suffix: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class KaiterraSensorEntityDescription(
|
||||
SensorEntityDescription, KaiterraSensorRequiredKeysMixin
|
||||
):
|
||||
"""Class describing Renault sensor entities."""
|
||||
|
||||
|
||||
SENSORS = [
|
||||
SensorEntityDescription(
|
||||
name="Temperature",
|
||||
KaiterraSensorEntityDescription(
|
||||
suffix="Temperature",
|
||||
key="rtemp",
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
name="Humidity",
|
||||
KaiterraSensorEntityDescription(
|
||||
suffix="Humidity",
|
||||
key="rhumid",
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
),
|
||||
@ -52,13 +69,15 @@ class KaiterraSensor(SensorEntity):
|
||||
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(self, api, name, device_id, description: SensorEntityDescription):
|
||||
def __init__(
|
||||
self, api, name, device_id, description: KaiterraSensorEntityDescription
|
||||
):
|
||||
"""Initialize the sensor."""
|
||||
self._api = api
|
||||
self._device_id = device_id
|
||||
self.entity_description = description
|
||||
self._attr_name = f"{name} {description.name}"
|
||||
self._attr_unique_id = f"{device_id}_{description.name.lower()}"
|
||||
self._attr_name = f"{name} {description.suffix}"
|
||||
self._attr_unique_id = f"{device_id}_{description.suffix.lower()}"
|
||||
|
||||
@property
|
||||
def _sensor(self):
|
||||
|
@ -85,10 +85,11 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
||||
_LOGGER.debug("Removing entity %s", entity_entry.entity_id)
|
||||
|
||||
ent_reg.async_remove(entity_entry.entity_id)
|
||||
dev_reg.async_update_device(
|
||||
entity_entry.device_id,
|
||||
remove_config_entry_id=config_entry.entry_id,
|
||||
)
|
||||
if entity_entry.device_id:
|
||||
dev_reg.async_update_device(
|
||||
entity_entry.device_id,
|
||||
remove_config_entry_id=config_entry.entry_id,
|
||||
)
|
||||
|
||||
_LOGGER.debug("Finished cleaning device_tracker entities")
|
||||
|
||||
|
@ -130,7 +130,7 @@ class KeeneticOptionsFlowHandler(config_entries.OptionsFlow):
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize options flow."""
|
||||
self.config_entry = config_entry
|
||||
self._interface_options = {}
|
||||
self._interface_options: dict[str, str] = {}
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
|
@ -31,7 +31,7 @@ async def async_setup_entry(
|
||||
"""Set up device tracker for Keenetic NDMS2 component."""
|
||||
router: KeeneticRouter = hass.data[DOMAIN][config_entry.entry_id][ROUTER]
|
||||
|
||||
tracked = set()
|
||||
tracked: set[str] = set()
|
||||
|
||||
@callback
|
||||
def update_from_router():
|
||||
|
@ -105,7 +105,7 @@ class KodiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
) -> FlowResult:
|
||||
"""Handle zeroconf discovery."""
|
||||
self._host = discovery_info.host
|
||||
self._port = int(discovery_info.port)
|
||||
self._port = discovery_info.port or DEFAULT_PORT
|
||||
self._name = discovery_info.hostname[: -len(".local.")]
|
||||
if not (uuid := discovery_info.properties.get("uuid")):
|
||||
return self.async_abort(reason="no_uuid")
|
||||
|
@ -66,7 +66,7 @@ class KulerskyLight(LightEntity):
|
||||
def __init__(self, light: pykulersky.Light) -> None:
|
||||
"""Initialize a Kuler Sky light."""
|
||||
self._light = light
|
||||
self._available = None
|
||||
self._available = False
|
||||
self._attr_supported_color_modes = {COLOR_MODE_RGBW}
|
||||
self._attr_color_mode = COLOR_MODE_RGBW
|
||||
|
||||
|
@ -25,7 +25,7 @@ class LiteJetOptionsFlow(config_entries.OptionsFlow):
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
) -> FlowResult:
|
||||
"""Manage LiteJet options."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(title="", data=user_input)
|
||||
|
@ -2,6 +2,7 @@
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from socket import timeout
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from motionblinds import AsyncMotionMulticast, ParseException
|
||||
|
||||
@ -157,6 +158,9 @@ async def async_setup_entry(
|
||||
else:
|
||||
version = f"Protocol: {motion_gateway.protocol}"
|
||||
|
||||
if TYPE_CHECKING:
|
||||
assert entry.unique_id is not None
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=entry.entry_id,
|
||||
|
@ -22,7 +22,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Perform the setup for Motion Blinds."""
|
||||
entities = []
|
||||
entities: list[SensorEntity] = []
|
||||
motion_gateway = hass.data[DOMAIN][config_entry.entry_id][KEY_GATEWAY]
|
||||
coordinator = hass.data[DOMAIN][config_entry.entry_id][KEY_COORDINATOR]
|
||||
|
||||
|
18
mypy.ini
18
mypy.ini
@ -2090,27 +2090,12 @@ ignore_errors = true
|
||||
[mypy-homeassistant.components.izone.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.kaiterra.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.keenetic_ndms2.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.kodi.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.konnected.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.kostal_plenticore.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.kulersky.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.litejet.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.litterrobot.*]
|
||||
ignore_errors = true
|
||||
|
||||
@ -2135,9 +2120,6 @@ ignore_errors = true
|
||||
[mypy-homeassistant.components.mobile_app.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.motion_blinds.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.ness_alarm.*]
|
||||
ignore_errors = true
|
||||
|
||||
|
@ -42,13 +42,8 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||
"homeassistant.components.input_datetime.*",
|
||||
"homeassistant.components.isy994.*",
|
||||
"homeassistant.components.izone.*",
|
||||
"homeassistant.components.kaiterra.*",
|
||||
"homeassistant.components.keenetic_ndms2.*",
|
||||
"homeassistant.components.kodi.*",
|
||||
"homeassistant.components.konnected.*",
|
||||
"homeassistant.components.kostal_plenticore.*",
|
||||
"homeassistant.components.kulersky.*",
|
||||
"homeassistant.components.litejet.*",
|
||||
"homeassistant.components.litterrobot.*",
|
||||
"homeassistant.components.lovelace.*",
|
||||
"homeassistant.components.lutron_caseta.*",
|
||||
@ -57,7 +52,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||
"homeassistant.components.meteo_france.*",
|
||||
"homeassistant.components.minecraft_server.*",
|
||||
"homeassistant.components.mobile_app.*",
|
||||
"homeassistant.components.motion_blinds.*",
|
||||
"homeassistant.components.ness_alarm.*",
|
||||
"homeassistant.components.nest.legacy.*",
|
||||
"homeassistant.components.netgear.*",
|
||||
|
Loading…
x
Reference in New Issue
Block a user