mirror of
https://github.com/home-assistant/core
synced 2024-07-27 18:58:57 +02:00
Enable basic type checking for adguard (#54924)
This commit is contained in:
parent
4bdeba8631
commit
7e5ff825dd
@ -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",
|
||||
|
@ -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],
|
||||
|
@ -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
|
||||
|
||||
|
3
mypy.ini
3
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
|
||||
|
||||
|
@ -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.*",
|
||||
|
Loading…
Reference in New Issue
Block a user