mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00: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 device information about this AdGuard Home instance."""
|
||||||
return {
|
return {
|
||||||
"identifiers": {
|
"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",
|
"name": "AdGuard Home",
|
||||||
"manufacturer": "AdGuard Team",
|
"manufacturer": "AdGuard Team",
|
||||||
|
@ -51,6 +51,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
self, errors: dict[str, str] | None = None
|
self, errors: dict[str, str] | None = None
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Show the Hass.io confirmation form to the user."""
|
"""Show the Hass.io confirmation form to the user."""
|
||||||
|
assert self._hassio_discovery
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="hassio_confirm",
|
step_id="hassio_confirm",
|
||||||
description_placeholders={"addon": self._hassio_discovery["addon"]},
|
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])
|
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(
|
adguard = AdGuardHome(
|
||||||
user_input[CONF_HOST],
|
user_input[CONF_HOST],
|
||||||
port=user_input[CONF_PORT],
|
port=user_input[CONF_PORT],
|
||||||
username=user_input.get(CONF_USERNAME),
|
username=username, # type:ignore[arg-type]
|
||||||
password=user_input.get(CONF_PASSWORD),
|
password=password, # type:ignore[arg-type]
|
||||||
tls=user_input[CONF_SSL],
|
tls=user_input[CONF_SSL],
|
||||||
verify_ssl=user_input[CONF_VERIFY_SSL],
|
verify_ssl=user_input[CONF_VERIFY_SSL],
|
||||||
session=session,
|
session=session,
|
||||||
@ -122,6 +125,7 @@ class AdGuardHomeFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
session = async_get_clientsession(self.hass, False)
|
session = async_get_clientsession(self.hass, False)
|
||||||
|
|
||||||
|
assert self._hassio_discovery
|
||||||
adguard = AdGuardHome(
|
adguard = AdGuardHome(
|
||||||
self._hassio_discovery[CONF_HOST],
|
self._hassio_discovery[CONF_HOST],
|
||||||
port=self._hassio_discovery[CONF_PORT],
|
port=self._hassio_discovery[CONF_PORT],
|
||||||
|
@ -62,7 +62,7 @@ class AdGuardHomeSensor(AdGuardHomeDeviceEntity, SensorEntity):
|
|||||||
enabled_default: bool = True,
|
enabled_default: bool = True,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize AdGuard Home sensor."""
|
"""Initialize AdGuard Home sensor."""
|
||||||
self._state = None
|
self._state: int | str | None = None
|
||||||
self._unit_of_measurement = unit_of_measurement
|
self._unit_of_measurement = unit_of_measurement
|
||||||
self.measurement = measurement
|
self.measurement = measurement
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class AdGuardHomeSensor(AdGuardHomeDeviceEntity, SensorEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> str | None:
|
def native_value(self) -> int | str | None:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
3
mypy.ini
3
mypy.ini
@ -1265,9 +1265,6 @@ no_implicit_optional = false
|
|||||||
warn_return_any = false
|
warn_return_any = false
|
||||||
warn_unreachable = false
|
warn_unreachable = false
|
||||||
|
|
||||||
[mypy-homeassistant.components.adguard.*]
|
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[mypy-homeassistant.components.almond.*]
|
[mypy-homeassistant.components.almond.*]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ from .model import Config, Integration
|
|||||||
# remove your component from this list to enable type checks.
|
# remove your component from this list to enable type checks.
|
||||||
# Do your best to not add anything new here.
|
# Do your best to not add anything new here.
|
||||||
IGNORED_MODULES: Final[list[str]] = [
|
IGNORED_MODULES: Final[list[str]] = [
|
||||||
"homeassistant.components.adguard.*",
|
|
||||||
"homeassistant.components.almond.*",
|
"homeassistant.components.almond.*",
|
||||||
"homeassistant.components.analytics.*",
|
"homeassistant.components.analytics.*",
|
||||||
"homeassistant.components.atag.*",
|
"homeassistant.components.atag.*",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user