mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 02:37:50 +00:00
Remove ServiceCallType alias from codebase (#49844)
This commit is contained in:
parent
7ac05110ca
commit
1b5596b4c2
@ -11,14 +11,13 @@ from homematicip.base.helpers import handle_config
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import comp_entity_ids
|
||||
from homeassistant.helpers.service import (
|
||||
async_register_admin_service,
|
||||
verify_domain_control,
|
||||
)
|
||||
from homeassistant.helpers.typing import ServiceCallType
|
||||
|
||||
from .const import DOMAIN as HMIPC_DOMAIN
|
||||
|
||||
@ -115,7 +114,7 @@ async def async_setup_services(hass: HomeAssistant) -> None:
|
||||
return
|
||||
|
||||
@verify_domain_control(hass, HMIPC_DOMAIN)
|
||||
async def async_call_hmipc_service(service: ServiceCallType):
|
||||
async def async_call_hmipc_service(service: ServiceCall):
|
||||
"""Call correct HomematicIP Cloud service."""
|
||||
service_name = service.service
|
||||
|
||||
@ -205,7 +204,7 @@ async def async_unload_services(hass: HomeAssistant):
|
||||
|
||||
|
||||
async def _async_activate_eco_mode_with_duration(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCall
|
||||
) -> None:
|
||||
"""Service to activate eco mode with duration."""
|
||||
duration = service.data[ATTR_DURATION]
|
||||
@ -221,7 +220,7 @@ async def _async_activate_eco_mode_with_duration(
|
||||
|
||||
|
||||
async def _async_activate_eco_mode_with_period(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCall
|
||||
) -> None:
|
||||
"""Service to activate eco mode with period."""
|
||||
endtime = service.data[ATTR_ENDTIME]
|
||||
@ -236,9 +235,7 @@ async def _async_activate_eco_mode_with_period(
|
||||
await hap.home.activate_absence_with_period(endtime)
|
||||
|
||||
|
||||
async def _async_activate_vacation(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
async def _async_activate_vacation(hass: HomeAssistant, service: ServiceCall) -> None:
|
||||
"""Service to activate vacation."""
|
||||
endtime = service.data[ATTR_ENDTIME]
|
||||
temperature = service.data[ATTR_TEMPERATURE]
|
||||
@ -253,9 +250,7 @@ async def _async_activate_vacation(
|
||||
await hap.home.activate_vacation(endtime, temperature)
|
||||
|
||||
|
||||
async def _async_deactivate_eco_mode(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
async def _async_deactivate_eco_mode(hass: HomeAssistant, service: ServiceCall) -> None:
|
||||
"""Service to deactivate eco mode."""
|
||||
hapid = service.data.get(ATTR_ACCESSPOINT_ID)
|
||||
|
||||
@ -268,9 +263,7 @@ async def _async_deactivate_eco_mode(
|
||||
await hap.home.deactivate_absence()
|
||||
|
||||
|
||||
async def _async_deactivate_vacation(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
async def _async_deactivate_vacation(hass: HomeAssistant, service: ServiceCall) -> None:
|
||||
"""Service to deactivate vacation."""
|
||||
hapid = service.data.get(ATTR_ACCESSPOINT_ID)
|
||||
|
||||
@ -284,7 +277,7 @@ async def _async_deactivate_vacation(
|
||||
|
||||
|
||||
async def _set_active_climate_profile(
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCall
|
||||
) -> None:
|
||||
"""Service to set the active climate profile."""
|
||||
entity_id_list = service.data[ATTR_ENTITY_ID]
|
||||
@ -302,7 +295,7 @@ async def _set_active_climate_profile(
|
||||
await group.set_active_profile(climate_profile_index)
|
||||
|
||||
|
||||
async def _async_dump_hap_config(hass: HomeAssistant, service: ServiceCallType) -> None:
|
||||
async def _async_dump_hap_config(hass: HomeAssistant, service: ServiceCall) -> None:
|
||||
"""Service to dump the configuration of a Homematic IP Access Point."""
|
||||
config_path = service.data.get(ATTR_CONFIG_OUTPUT_PATH) or hass.config.config_dir
|
||||
config_file_prefix = service.data[ATTR_CONFIG_OUTPUT_FILE_PREFIX]
|
||||
@ -324,7 +317,7 @@ async def _async_dump_hap_config(hass: HomeAssistant, service: ServiceCallType)
|
||||
config_file.write_text(json_state, encoding="utf8")
|
||||
|
||||
|
||||
async def _async_reset_energy_counter(hass: HomeAssistant, service: ServiceCallType):
|
||||
async def _async_reset_energy_counter(hass: HomeAssistant, service: ServiceCall):
|
||||
"""Service to reset the energy counter."""
|
||||
entity_id_list = service.data[ATTR_ENTITY_ID]
|
||||
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
||||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
@ -24,7 +24,7 @@ from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
DOMAIN = "input_boolean"
|
||||
@ -112,7 +112,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Remove all input booleans and load new ones from config."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -131,7 +131,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml entities."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -142,7 +142,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml entities."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -13,14 +13,14 @@ from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -117,7 +117,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml entities."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -142,7 +142,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml entities."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -6,11 +6,11 @@ import voluptuous as vol
|
||||
from homeassistant.components import frontend
|
||||
from homeassistant.config import async_hass_config_yaml, async_process_component_config
|
||||
from homeassistant.const import CONF_FILENAME, CONF_MODE, CONF_RESOURCES
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import collection, config_validation as cv
|
||||
from homeassistant.helpers.service import async_register_admin_service
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import async_get_integration
|
||||
|
||||
from . import dashboard, resources, websocket
|
||||
@ -74,7 +74,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType):
|
||||
|
||||
frontend.async_register_built_in_panel(hass, DOMAIN, config={"mode": mode})
|
||||
|
||||
async def reload_resources_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_resources_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml resources."""
|
||||
try:
|
||||
conf = await async_hass_config_yaml(hass)
|
||||
|
@ -16,10 +16,9 @@ from aioswitcher.devices import SwitcherV2Device
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.typing import ServiceCallType
|
||||
|
||||
from . import (
|
||||
ATTR_AUTO_OFF_SET,
|
||||
@ -63,7 +62,7 @@ async def async_setup_platform(
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
async def async_set_auto_off_service(entity, service_call: ServiceCallType) -> None:
|
||||
async def async_set_auto_off_service(entity, service_call: ServiceCall) -> None:
|
||||
"""Use for handling setting device auto-off service calls."""
|
||||
async with SwitcherV2Api(
|
||||
hass.loop,
|
||||
@ -75,7 +74,7 @@ async def async_setup_platform(
|
||||
await swapi.set_auto_shutdown(service_call.data[CONF_AUTO_OFF])
|
||||
|
||||
async def async_turn_on_with_timer_service(
|
||||
entity, service_call: ServiceCallType
|
||||
entity, service_call: ServiceCall
|
||||
) -> None:
|
||||
"""Use for handling turning device on with a timer service calls."""
|
||||
async with SwitcherV2Api(
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
@ -21,7 +21,7 @@ from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -130,7 +130,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
storage_collection, DOMAIN, DOMAIN, CREATE_FIELDS, UPDATE_FIELDS
|
||||
).async_setup(hass)
|
||||
|
||||
async def reload_service_handler(service_call: ServiceCallType) -> None:
|
||||
async def reload_service_handler(service_call: ServiceCall) -> None:
|
||||
"""Reload yaml entities."""
|
||||
conf = await component.async_prepare_reload(skip_reset=True)
|
||||
if conf is None:
|
||||
|
@ -9,17 +9,10 @@ ConfigType = Dict[str, Any]
|
||||
ContextType = homeassistant.core.Context
|
||||
DiscoveryInfoType = Dict[str, Any]
|
||||
EventType = homeassistant.core.Event
|
||||
ServiceCallType = homeassistant.core.ServiceCall
|
||||
ServiceDataType = Dict[str, Any]
|
||||
StateType = Union[None, str, int, float]
|
||||
TemplateVarsType = Optional[Mapping[str, Any]]
|
||||
|
||||
# HomeAssistantType is not to be used,
|
||||
# It is not present in the core code base.
|
||||
# It is kept in order not to break custom components
|
||||
# In due time it will be removed.
|
||||
HomeAssistantType = homeassistant.core.HomeAssistant
|
||||
|
||||
# Custom type for recorder Queries
|
||||
QueryType = Any
|
||||
|
||||
@ -31,3 +24,11 @@ class UndefinedType(Enum):
|
||||
|
||||
|
||||
UNDEFINED = UndefinedType._singleton # pylint: disable=protected-access
|
||||
|
||||
# The following types should not used and
|
||||
# are not present in the core code base.
|
||||
# They are kept in order not to break custom integrations
|
||||
# that may rely on them.
|
||||
# In due time they will be removed.
|
||||
HomeAssistantType = homeassistant.core.HomeAssistant
|
||||
ServiceCallType = homeassistant.core.ServiceCall
|
||||
|
Loading…
x
Reference in New Issue
Block a user