Skip to content

Commit 355ee11

Browse files
authored
Add callback decorator to async_setup_services (home-assistant#146729)
1 parent 30c5df3 commit 355ee11

File tree

25 files changed

+47
-14
lines changed

25 files changed

+47
-14
lines changed

homeassistant/components/abode/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import voluptuous as vol
77

88
from homeassistant.const import ATTR_ENTITY_ID
9-
from homeassistant.core import HomeAssistant, ServiceCall
9+
from homeassistant.core import HomeAssistant, ServiceCall, callback
1010
from homeassistant.helpers import config_validation as cv
1111
from homeassistant.helpers.dispatcher import dispatcher_send
1212

@@ -70,6 +70,7 @@ def _trigger_automation(call: ServiceCall) -> None:
7070
dispatcher_send(call.hass, signal)
7171

7272

73+
@callback
7374
def async_setup_services(hass: HomeAssistant) -> None:
7475
"""Home Assistant services."""
7576

homeassistant/components/amcrest/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from homeassistant.auth.models import User
66
from homeassistant.auth.permissions.const import POLICY_CONTROL
77
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, ENTITY_MATCH_NONE
8-
from homeassistant.core import HomeAssistant, ServiceCall
8+
from homeassistant.core import HomeAssistant, ServiceCall, callback
99
from homeassistant.exceptions import Unauthorized, UnknownUser
1010
from homeassistant.helpers.dispatcher import async_dispatcher_send
1111
from homeassistant.helpers.service import async_extract_entity_ids
@@ -15,6 +15,7 @@
1515
from .helpers import service_signal
1616

1717

18+
@callback
1819
def async_setup_services(hass: HomeAssistant) -> None:
1920
"""Set up the Amcrest IP Camera services."""
2021

homeassistant/components/downloader/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import requests
1111
import voluptuous as vol
1212

13-
from homeassistant.core import HomeAssistant, ServiceCall
13+
from homeassistant.core import HomeAssistant, ServiceCall, callback
1414
from homeassistant.helpers import config_validation as cv
1515
from homeassistant.helpers.service import async_register_admin_service
1616
from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path
@@ -141,6 +141,7 @@ def do_download() -> None:
141141
threading.Thread(target=do_download).start()
142142

143143

144+
@callback
144145
def async_setup_services(hass: HomeAssistant) -> None:
145146
"""Register the services for the downloader component."""
146147
async_register_admin_service(

homeassistant/components/elkm1/services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def _set_time_service(service: ServiceCall) -> None:
6363
_async_get_elk_panel(service).set_time(dt_util.now())
6464

6565

66+
@callback
6667
def async_setup_services(hass: HomeAssistant) -> None:
6768
"""Create ElkM1 services."""
6869

homeassistant/components/ffmpeg/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import voluptuous as vol
66

77
from homeassistant.const import ATTR_ENTITY_ID
8-
from homeassistant.core import HomeAssistant, ServiceCall
8+
from homeassistant.core import HomeAssistant, ServiceCall, callback
99
from homeassistant.helpers import config_validation as cv
1010
from homeassistant.helpers.dispatcher import async_dispatcher_send
1111

@@ -35,6 +35,7 @@ async def _async_service_handle(service: ServiceCall) -> None:
3535
async_dispatcher_send(service.hass, SIGNAL_FFMPEG_RESTART, entity_ids)
3636

3737

38+
@callback
3839
def async_setup_services(hass: HomeAssistant) -> None:
3940
"""Register FFmpeg services."""
4041

homeassistant/components/google_assistant_sdk/services.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ServiceCall,
1212
ServiceResponse,
1313
SupportsResponse,
14+
callback,
1415
)
1516
from homeassistant.helpers import config_validation as cv
1617

@@ -49,6 +50,7 @@ async def _send_text_command(call: ServiceCall) -> ServiceResponse:
4950
return None
5051

5152

53+
@callback
5254
def async_setup_services(hass: HomeAssistant) -> None:
5355
"""Add the services for Google Assistant SDK."""
5456

homeassistant/components/google_photos/services.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ServiceCall,
1717
ServiceResponse,
1818
SupportsResponse,
19+
callback,
1920
)
2021
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
2122
from homeassistant.helpers import config_validation as cv
@@ -77,6 +78,7 @@ def _read_file_contents(
7778
return results
7879

7980

81+
@callback
8082
def async_setup_services(hass: HomeAssistant) -> None:
8183
"""Register Google Photos services."""
8284

homeassistant/components/google_sheets/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import voluptuous as vol
1414

1515
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN
16-
from homeassistant.core import HomeAssistant, ServiceCall
16+
from homeassistant.core import HomeAssistant, ServiceCall, callback
1717
from homeassistant.exceptions import HomeAssistantError
1818
from homeassistant.helpers import config_validation as cv
1919
from homeassistant.helpers.selector import ConfigEntrySelector
@@ -76,6 +76,7 @@ async def _async_append_to_sheet(call: ServiceCall) -> None:
7676
await call.hass.async_add_executor_job(_append_to_sheet, call, entry)
7777

7878

79+
@callback
7980
def async_setup_services(hass: HomeAssistant) -> None:
8081
"""Add the services for Google Sheets."""
8182

homeassistant/components/habitica/services.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
ServiceCall,
3636
ServiceResponse,
3737
SupportsResponse,
38+
callback,
3839
)
3940
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
4041
from homeassistant.helpers import config_validation as cv
@@ -249,6 +250,7 @@ def get_config_entry(hass: HomeAssistant, entry_id: str) -> HabiticaConfigEntry:
249250
return entry
250251

251252

253+
@callback
252254
def async_setup_services(hass: HomeAssistant) -> None: # noqa: C901
253255
"""Set up services for Habitica integration."""
254256

homeassistant/components/hue/services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from aiohue import HueBridgeV1, HueBridgeV2
99
import voluptuous as vol
1010

11-
from homeassistant.core import HomeAssistant, ServiceCall
11+
from homeassistant.core import HomeAssistant, ServiceCall, callback
1212
from homeassistant.helpers import config_validation as cv
1313
from homeassistant.helpers.service import verify_domain_control
1414

@@ -25,6 +25,7 @@
2525
LOGGER = logging.getLogger(__name__)
2626

2727

28+
@callback
2829
def async_setup_services(hass: HomeAssistant) -> None:
2930
"""Register services for Hue integration."""
3031

0 commit comments

Comments
 (0)