diff --git a/homeassistant/components/adguard/__init__.py b/homeassistant/components/adguard/__init__.py index 8f0c73a8a64..eedc1fe4b03 100644 --- a/homeassistant/components/adguard/__init__.py +++ b/homeassistant/components/adguard/__init__.py @@ -198,7 +198,7 @@ class AdGuardHomeDeviceEntity(AdGuardHomeEntity): """Return device information about this AdGuard Home instance.""" return { "identifiers": { - (DOMAIN, self.adguard.host, self.adguard.port, self.adguard.base_path) + (DOMAIN, self.adguard.host, self.adguard.port, self.adguard.base_path) # type: ignore }, "name": "AdGuard Home", "manufacturer": "AdGuard Team", diff --git a/homeassistant/components/adguard/config_flow.py b/homeassistant/components/adguard/config_flow.py index bbb6d34954b..aa85345179e 100644 --- a/homeassistant/components/adguard/config_flow.py +++ b/homeassistant/components/adguard/config_flow.py @@ -51,6 +51,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN): self, errors: dict[str, str] | None = None ) -> FlowResult: """Show the Hass.io confirmation form to the user.""" + assert self._hassio_discovery return self.async_show_form( step_id="hassio_confirm", description_placeholders={"addon": self._hassio_discovery["addon"]}, @@ -73,11 +74,13 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN): session = async_get_clientsession(self.hass, user_input[CONF_VERIFY_SSL]) + username: str | None = user_input.get(CONF_USERNAME) + password: str | None = user_input.get(CONF_PASSWORD) adguard = AdGuardHome( user_input[CONF_HOST], port=user_input[CONF_PORT], - username=user_input.get(CONF_USERNAME), - password=user_input.get(CONF_PASSWORD), + username=username, # type:ignore[arg-type] + password=password, # type:ignore[arg-type] tls=user_input[CONF_SSL], verify_ssl=user_input[CONF_VERIFY_SSL], session=session, @@ -122,6 +125,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN): session = async_get_clientsession(self.hass, False) + assert self._hassio_discovery adguard = AdGuardHome( self._hassio_discovery[CONF_HOST], port=self._hassio_discovery[CONF_PORT], diff --git a/homeassistant/components/adguard/sensor.py b/homeassistant/components/adguard/sensor.py index a7f4dabde9f..8134d2c4d43 100644 --- a/homeassistant/components/adguard/sensor.py +++ b/homeassistant/components/adguard/sensor.py @@ -62,7 +62,7 @@ class AdGuardHomeSensor(AdGuardHomeDeviceEntity, SensorEntity): enabled_default: bool = True, ) -> None: """Initialize AdGuard Home sensor.""" - self._state = None + self._state: int | str | None = None self._unit_of_measurement = unit_of_measurement self.measurement = measurement @@ -82,7 +82,7 @@ class AdGuardHomeSensor(AdGuardHomeDeviceEntity, SensorEntity): ) @property - def native_value(self) -> str | None: + def native_value(self) -> int | str | None: """Return the state of the sensor.""" return self._state diff --git a/mypy.ini b/mypy.ini index 954c15725b3..94c13689f6b 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1265,9 +1265,6 @@ no_implicit_optional = false warn_return_any = false warn_unreachable = false -[mypy-homeassistant.components.adguard.*] -ignore_errors = true - [mypy-homeassistant.components.almond.*] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index cb8be180af2..aec5843be38 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -14,7 +14,6 @@ from .model import Config, Integration # remove your component from this list to enable type checks. # Do your best to not add anything new here. IGNORED_MODULES: Final[list[str]] = [ - "homeassistant.components.adguard.*", "homeassistant.components.almond.*", "homeassistant.components.analytics.*", "homeassistant.components.atag.*",