diff --git a/homeassistant/components/alert/__init__.py b/homeassistant/components/alert/__init__.py index e5ee7ee6911..871778a9c11 100644 --- a/homeassistant/components/alert/__init__.py +++ b/homeassistant/components/alert/__init__.py @@ -23,6 +23,7 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) +from homeassistant.core import ServiceCall from homeassistant.helpers import event, service import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import ToggleEntity @@ -117,7 +118,7 @@ async def async_setup(hass, config): if not entities: return False - async def async_handle_alert_service(service_call): + async def async_handle_alert_service(service_call: ServiceCall) -> None: """Handle calls to alert services.""" alert_ids = await service.async_extract_entity_ids(hass, service_call) diff --git a/homeassistant/components/ambiclimate/climate.py b/homeassistant/components/ambiclimate/climate.py index 67fd3adeec7..b7890257ca3 100644 --- a/homeassistant/components/ambiclimate/climate.py +++ b/homeassistant/components/ambiclimate/climate.py @@ -19,6 +19,7 @@ from homeassistant.const import ( CONF_CLIENT_SECRET, TEMP_CELSIUS, ) +from homeassistant.core import ServiceCall from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.entity import DeviceInfo @@ -96,7 +97,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(devs, True) - async def send_comfort_feedback(service): + async def send_comfort_feedback(service: ServiceCall) -> None: """Send comfort feedback.""" device_name = service.data[ATTR_NAME] device = data_connection.find_device_by_room_name(device_name) @@ -110,7 +111,7 @@ async def async_setup_entry(hass, entry, async_add_entities): schema=SEND_COMFORT_FEEDBACK_SCHEMA, ) - async def set_comfort_mode(service): + async def set_comfort_mode(service: ServiceCall) -> None: """Set comfort mode.""" device_name = service.data[ATTR_NAME] device = data_connection.find_device_by_room_name(device_name) @@ -121,7 +122,7 @@ async def async_setup_entry(hass, entry, async_add_entities): DOMAIN, SERVICE_COMFORT_MODE, set_comfort_mode, schema=SET_COMFORT_MODE_SCHEMA ) - async def set_temperature_mode(service): + async def set_temperature_mode(service: ServiceCall) -> None: """Set temperature mode.""" device_name = service.data[ATTR_NAME] device = data_connection.find_device_by_room_name(device_name) diff --git a/homeassistant/components/bluesound/media_player.py b/homeassistant/components/bluesound/media_player.py index c91a2dedca3..9884461e0a9 100644 --- a/homeassistant/components/bluesound/media_player.py +++ b/homeassistant/components/bluesound/media_player.py @@ -44,7 +44,7 @@ from homeassistant.const import ( STATE_PAUSED, STATE_PLAYING, ) -from homeassistant.core import callback +from homeassistant.core import ServiceCall, callback from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_time_interval @@ -172,7 +172,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= host.get(CONF_NAME), ) - async def async_service_handler(service): + async def async_service_handler(service: ServiceCall) -> None: """Map services to method of Bluesound devices.""" if not (method := SERVICE_TO_METHOD.get(service.service)): return diff --git a/homeassistant/components/cloudflare/__init__.py b/homeassistant/components/cloudflare/__init__.py index dc0782aa9c0..df5b08e9395 100644 --- a/homeassistant/components/cloudflare/__init__.py +++ b/homeassistant/components/cloudflare/__init__.py @@ -13,7 +13,7 @@ from pycfdns.exceptions import ( from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_TOKEN, CONF_ZONE -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv @@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: except CloudflareException as error: _LOGGER.error("Error updating zone %s: %s", entry.data[CONF_ZONE], error) - async def update_records_service(call): + async def update_records_service(call: ServiceCall) -> None: """Set up service for manual trigger.""" try: await _async_update_cloudflare(cfupdate, zone_id) diff --git a/homeassistant/components/color_extractor/__init__.py b/homeassistant/components/color_extractor/__init__.py index 4d8118483b6..73e8e09101c 100644 --- a/homeassistant/components/color_extractor/__init__.py +++ b/homeassistant/components/color_extractor/__init__.py @@ -15,6 +15,7 @@ from homeassistant.components.light import ( LIGHT_TURN_ON_SCHEMA, SERVICE_TURN_ON as LIGHT_SERVICE_TURN_ON, ) +from homeassistant.core import ServiceCall from homeassistant.helpers import aiohttp_client import homeassistant.helpers.config_validation as cv @@ -58,7 +59,7 @@ def _get_color(file_handler) -> tuple: async def async_setup(hass, hass_config): """Set up services for color_extractor integration.""" - async def async_handle_service(service_call): + async def async_handle_service(service_call: ServiceCall) -> None: """Decide which color_extractor method to call based on service.""" service_data = dict(service_call.data) diff --git a/homeassistant/components/configurator/__init__.py b/homeassistant/components/configurator/__init__.py index b94483122d0..edd00fec486 100644 --- a/homeassistant/components/configurator/__init__.py +++ b/homeassistant/components/configurator/__init__.py @@ -14,7 +14,7 @@ from homeassistant.const import ( ATTR_FRIENDLY_NAME, EVENT_TIME_CHANGED, ) -from homeassistant.core import Event, callback as async_callback +from homeassistant.core import Event, ServiceCall, callback as async_callback from homeassistant.helpers.entity import async_generate_entity_id from homeassistant.loader import bind_hass from homeassistant.util.async_ import run_callback_threadsafe @@ -212,7 +212,7 @@ class Configurator: self.hass.bus.async_listen_once(EVENT_TIME_CHANGED, deferred_remove) - async def async_handle_service_call(self, call): + async def async_handle_service_call(self, call: ServiceCall) -> None: """Handle a configure service call.""" request_id = call.data.get(ATTR_CONFIGURE_ID) diff --git a/homeassistant/components/conversation/__init__.py b/homeassistant/components/conversation/__init__.py index 401d240957e..75bbd4d93aa 100644 --- a/homeassistant/components/conversation/__init__.py +++ b/homeassistant/components/conversation/__init__.py @@ -55,7 +55,7 @@ async def async_setup(hass, config): """Register the process service.""" hass.data[DATA_CONFIG] = config - async def handle_service(service): + async def handle_service(service: core.ServiceCall) -> None: """Parse text into commands.""" text = service.data[ATTR_TEXT] _LOGGER.debug("Processing: <%s>", text) diff --git a/homeassistant/components/duckdns/__init__.py b/homeassistant/components/duckdns/__init__.py index 2271b107b36..42f36c5435f 100644 --- a/homeassistant/components/duckdns/__init__.py +++ b/homeassistant/components/duckdns/__init__.py @@ -5,7 +5,7 @@ import logging import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN, CONF_DOMAIN -from homeassistant.core import CALLBACK_TYPE, callback +from homeassistant.core import CALLBACK_TYPE, ServiceCall, callback from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_call_later @@ -58,7 +58,7 @@ async def async_setup(hass, config): ) async_track_time_interval_backoff(hass, update_domain_interval, intervals) - async def update_domain_service(call): + async def update_domain_service(call: ServiceCall) -> None: """Update the DuckDNS entry.""" await _update_duckdns(session, domain, token, txt=call.data[ATTR_TXT]) diff --git a/homeassistant/components/dynalite/__init__.py b/homeassistant/components/dynalite/__init__.py index 49e742519fd..35f76354eab 100644 --- a/homeassistant/components/dynalite/__init__.py +++ b/homeassistant/components/dynalite/__init__.py @@ -208,7 +208,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: ) ) - async def dynalite_service(service_call: ServiceCall): + async def dynalite_service(service_call: ServiceCall) -> None: data = service_call.data host = data.get(ATTR_HOST, "") bridges = []