diff --git a/homeassistant/components/asuswrt/device_tracker.py b/homeassistant/components/asuswrt/device_tracker.py index 3e954eb25b9..d5d3d9026b5 100644 --- a/homeassistant/components/asuswrt/device_tracker.py +++ b/homeassistant/components/asuswrt/device_tracker.py @@ -19,7 +19,7 @@ async def async_setup_entry( ) -> None: """Set up device tracker for AsusWrt component.""" router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT] - tracked = set() + tracked: set = set() @callback def update_router(): diff --git a/homeassistant/components/asuswrt/router.py b/homeassistant/components/asuswrt/router.py index 9d1bcb35c9e..9acea7ba762 100644 --- a/homeassistant/components/asuswrt/router.py +++ b/homeassistant/components/asuswrt/router.py @@ -3,7 +3,7 @@ from __future__ import annotations from datetime import datetime, timedelta import logging -from typing import Any +from typing import Any, Callable from aioasuswrt.asuswrt import AsusWrt @@ -209,16 +209,16 @@ class AsusWrtRouter: self._protocol = entry.data[CONF_PROTOCOL] self._host = entry.data[CONF_HOST] self._model = "Asus Router" - self._sw_v = None + self._sw_v: str | None = None self._devices: dict[str, Any] = {} self._connected_devices = 0 self._connect_error = False - self._sensors_data_handler: AsusWrtSensorDataHandler = None + self._sensors_data_handler: AsusWrtSensorDataHandler | None = None self._sensors_coordinator: dict[str, Any] = {} - self._on_close = [] + self._on_close: list[Callable] = [] self._options = { CONF_DNSMASQ: DEFAULT_DNSMASQ, @@ -229,7 +229,7 @@ class AsusWrtRouter: async def setup(self) -> None: """Set up a AsusWrt router.""" - self._api = get_api(self._entry.data, self._options) + self._api = get_api(dict(self._entry.data), self._options) try: await self._api.connection.async_connect() diff --git a/homeassistant/components/asuswrt/sensor.py b/homeassistant/components/asuswrt/sensor.py index 287ea3e8938..5392b419bca 100644 --- a/homeassistant/components/asuswrt/sensor.py +++ b/homeassistant/components/asuswrt/sensor.py @@ -3,7 +3,7 @@ from __future__ import annotations from dataclasses import dataclass import logging -from numbers import Number +from numbers import Real from homeassistant.components.sensor import ( STATE_CLASS_MEASUREMENT, @@ -149,7 +149,7 @@ class AsusWrtSensor(CoordinatorEntity, SensorEntity): ) -> None: """Initialize a AsusWrt sensor.""" super().__init__(coordinator) - self.entity_description = description + self.entity_description: AsusWrtSensorEntityDescription = description self._attr_name = f"{DEFAULT_PREFIX} {description.name}" self._attr_unique_id = f"{DOMAIN} {self.name}" @@ -157,10 +157,10 @@ class AsusWrtSensor(CoordinatorEntity, SensorEntity): self._attr_extra_state_attributes = {"hostname": router.host} @property - def native_value(self) -> str | None: + def native_value(self) -> float | str | None: """Return current state.""" descr = self.entity_description state = self.coordinator.data.get(descr.key) - if state is not None and descr.factor and isinstance(state, Number): + if state is not None and descr.factor and isinstance(state, Real): return round(state / descr.factor, descr.precision) return state diff --git a/mypy.ini b/mypy.ini index cb6adf5d62e..cd2bc0f36e6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1277,9 +1277,6 @@ ignore_errors = true [mypy-homeassistant.components.analytics.*] ignore_errors = true -[mypy-homeassistant.components.asuswrt.*] -ignore_errors = true - [mypy-homeassistant.components.atag.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 73081ddfc53..eec262ce8bd 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -18,7 +18,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.aemet.*", "homeassistant.components.almond.*", "homeassistant.components.analytics.*", - "homeassistant.components.asuswrt.*", "homeassistant.components.atag.*", "homeassistant.components.awair.*", "homeassistant.components.azure_event_hub.*",