diff --git a/homeassistant/components/adguard/__init__.py b/homeassistant/components/adguard/__init__.py index 9b419c444ce..8c90efcd44c 100644 --- a/homeassistant/components/adguard/__init__.py +++ b/homeassistant/components/adguard/__init__.py @@ -18,7 +18,7 @@ from homeassistant.const import ( CONF_VERIFY_SSL, Platform, ) -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_get_clientsession @@ -72,31 +72,27 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.config_entries.async_setup_platforms(entry, PLATFORMS) - async def add_url(call) -> None: + async def add_url(call: ServiceCall) -> None: """Service call to add a new filter subscription to AdGuard Home.""" await adguard.filtering.add_url( - allowlist=False, name=call.data.get(CONF_NAME), url=call.data.get(CONF_URL) + allowlist=False, name=call.data[CONF_NAME], url=call.data[CONF_URL] ) - async def remove_url(call) -> None: + async def remove_url(call: ServiceCall) -> None: """Service call to remove a filter subscription from AdGuard Home.""" - await adguard.filtering.remove_url(allowlist=False, url=call.data.get(CONF_URL)) + await adguard.filtering.remove_url(allowlist=False, url=call.data[CONF_URL]) - async def enable_url(call) -> None: + async def enable_url(call: ServiceCall) -> None: """Service call to enable a filter subscription in AdGuard Home.""" - await adguard.filtering.enable_url(allowlist=False, url=call.data.get(CONF_URL)) + await adguard.filtering.enable_url(allowlist=False, url=call.data[CONF_URL]) - async def disable_url(call) -> None: + async def disable_url(call: ServiceCall) -> None: """Service call to disable a filter subscription in AdGuard Home.""" - await adguard.filtering.disable_url( - allowlist=False, url=call.data.get(CONF_URL) - ) + await adguard.filtering.disable_url(allowlist=False, url=call.data[CONF_URL]) - async def refresh(call) -> None: + async def refresh(call: ServiceCall) -> None: """Service call to refresh the filter subscriptions in AdGuard Home.""" - await adguard.filtering.refresh( - allowlist=False, force=call.data.get(CONF_FORCE) - ) + await adguard.filtering.refresh(allowlist=False, force=call.data[CONF_FORCE]) hass.services.async_register( DOMAIN, SERVICE_ADD_URL, add_url, schema=SERVICE_ADD_URL_SCHEMA