diff --git a/homeassistant/components/withings/__init__.py b/homeassistant/components/withings/__init__.py index 1b77faa7a61..da2174c3822 100644 --- a/homeassistant/components/withings/__init__.py +++ b/homeassistant/components/withings/__init__.py @@ -6,6 +6,7 @@ For more details about this platform, please refer to the documentation at from __future__ import annotations import asyncio +from typing import Any from aiohttp.web import Request, Response import voluptuous as vol @@ -103,7 +104,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Withings from a config entry.""" - config_updates = {} + config_updates: dict[str, Any] = {} # Add a unique id if it's an older config entry. if entry.unique_id != entry.data["token"]["userid"] or not isinstance( @@ -197,7 +198,7 @@ async def async_webhook_handler( return json_message_response("Parameter appli not provided", message_code=20) try: - appli = NotifyAppli(int(params.getone("appli"))) + appli = NotifyAppli(int(params.getone("appli"))) # type: ignore[arg-type] except ValueError: return json_message_response("Invalid appli provided", message_code=21) diff --git a/homeassistant/components/withings/binary_sensor.py b/homeassistant/components/withings/binary_sensor.py index b0af5051124..ff98e6e0d45 100644 --- a/homeassistant/components/withings/binary_sensor.py +++ b/homeassistant/components/withings/binary_sensor.py @@ -32,6 +32,6 @@ class WithingsHealthBinarySensor(BaseWithingsSensor, BinarySensorEntity): _attr_device_class = BinarySensorDeviceClass.OCCUPANCY @property - def is_on(self) -> bool: + def is_on(self) -> bool | None: """Return true if the binary sensor is on.""" return self._state_data diff --git a/homeassistant/components/withings/common.py b/homeassistant/components/withings/common.py index 90f60cd4112..93c3800e42f 100644 --- a/homeassistant/components/withings/common.py +++ b/homeassistant/components/withings/common.py @@ -10,7 +10,7 @@ from enum import Enum, IntEnum from http import HTTPStatus import logging import re -from typing import Any +from typing import Any, Union from aiohttp.web import Response import requests @@ -589,7 +589,7 @@ class DataManager: update_method=self.async_subscribe_webhook, ) self.poll_data_update_coordinator = DataUpdateCoordinator[ - dict[MeasureType, Any] + Union[dict[MeasureType, Any], None] ]( hass, _LOGGER, @@ -951,7 +951,7 @@ class BaseWithingsSensor(Entity): return self._unique_id @property - def icon(self) -> str: + def icon(self) -> str | None: """Icon to use in the frontend, if any.""" return self._attribute.icon @@ -1005,7 +1005,7 @@ async def async_get_data_manager( config_entry_data = hass.data[const.DOMAIN][config_entry.entry_id] if const.DATA_MANAGER not in config_entry_data: - profile = config_entry.data.get(const.PROFILE) + profile: str = config_entry.data[const.PROFILE] _LOGGER.debug("Creating withings data manager for profile: %s", profile) config_entry_data[const.DATA_MANAGER] = DataManager( diff --git a/mypy.ini b/mypy.ini index 3cdd8b2880f..17887f7c78c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2760,15 +2760,3 @@ ignore_errors = true [mypy-homeassistant.components.template.sensor] ignore_errors = true - -[mypy-homeassistant.components.withings] -ignore_errors = true - -[mypy-homeassistant.components.withings.binary_sensor] -ignore_errors = true - -[mypy-homeassistant.components.withings.common] -ignore_errors = true - -[mypy-homeassistant.components.withings.config_flow] -ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 76304419c6c..e1b2d60ddd1 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -51,10 +51,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.sonos.statistics", "homeassistant.components.template.number", "homeassistant.components.template.sensor", - "homeassistant.components.withings", - "homeassistant.components.withings.binary_sensor", - "homeassistant.components.withings.common", - "homeassistant.components.withings.config_flow", ] # Component modules which should set no_implicit_reexport = true.