diff --git a/homeassistant/components/auth/__init__.py b/homeassistant/components/auth/__init__.py index 1ca74231298..7c5fedf888f 100644 --- a/homeassistant/components/auth/__init__.py +++ b/homeassistant/components/auth/__init__.py @@ -196,24 +196,26 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: hass.http.register_view(TokenView(retrieve_result)) hass.http.register_view(LinkUserView(retrieve_result)) - hass.components.websocket_api.async_register_command( - WS_TYPE_CURRENT_USER, websocket_current_user, SCHEMA_WS_CURRENT_USER + websocket_api.async_register_command( + hass, WS_TYPE_CURRENT_USER, websocket_current_user, SCHEMA_WS_CURRENT_USER ) - hass.components.websocket_api.async_register_command( + websocket_api.async_register_command( + hass, WS_TYPE_LONG_LIVED_ACCESS_TOKEN, websocket_create_long_lived_access_token, SCHEMA_WS_LONG_LIVED_ACCESS_TOKEN, ) - hass.components.websocket_api.async_register_command( - WS_TYPE_REFRESH_TOKENS, websocket_refresh_tokens, SCHEMA_WS_REFRESH_TOKENS + websocket_api.async_register_command( + hass, WS_TYPE_REFRESH_TOKENS, websocket_refresh_tokens, SCHEMA_WS_REFRESH_TOKENS ) - hass.components.websocket_api.async_register_command( + websocket_api.async_register_command( + hass, WS_TYPE_DELETE_REFRESH_TOKEN, websocket_delete_refresh_token, SCHEMA_WS_DELETE_REFRESH_TOKEN, ) - hass.components.websocket_api.async_register_command( - WS_TYPE_SIGN_PATH, websocket_sign_path, SCHEMA_WS_SIGN_PATH + websocket_api.async_register_command( + hass, WS_TYPE_SIGN_PATH, websocket_sign_path, SCHEMA_WS_SIGN_PATH ) await login_flow.async_setup(hass, store_result) diff --git a/homeassistant/components/auth/mfa_setup_flow.py b/homeassistant/components/auth/mfa_setup_flow.py index 61c06a3c16e..aa45cc1b028 100644 --- a/homeassistant/components/auth/mfa_setup_flow.py +++ b/homeassistant/components/auth/mfa_setup_flow.py @@ -50,12 +50,12 @@ async def async_setup(hass): """Init mfa setup flow manager.""" hass.data[DATA_SETUP_FLOW_MGR] = MfaFlowManager(hass) - hass.components.websocket_api.async_register_command( - WS_TYPE_SETUP_MFA, websocket_setup_mfa, SCHEMA_WS_SETUP_MFA + websocket_api.async_register_command( + hass, WS_TYPE_SETUP_MFA, websocket_setup_mfa, SCHEMA_WS_SETUP_MFA ) - hass.components.websocket_api.async_register_command( - WS_TYPE_DEPOSE_MFA, websocket_depose_mfa, SCHEMA_WS_DEPOSE_MFA + websocket_api.async_register_command( + hass, WS_TYPE_DEPOSE_MFA, websocket_depose_mfa, SCHEMA_WS_DEPOSE_MFA ) diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index a429abcf84e..62389861ec3 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -353,13 +353,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: hass.http.register_view(CameraImageView(component)) hass.http.register_view(CameraMjpegStream(component)) - hass.components.websocket_api.async_register_command( - WS_TYPE_CAMERA_THUMBNAIL, websocket_camera_thumbnail, SCHEMA_WS_CAMERA_THUMBNAIL + websocket_api.async_register_command( + hass, + WS_TYPE_CAMERA_THUMBNAIL, + websocket_camera_thumbnail, + SCHEMA_WS_CAMERA_THUMBNAIL, ) - hass.components.websocket_api.async_register_command(ws_camera_stream) - hass.components.websocket_api.async_register_command(ws_camera_web_rtc_offer) - hass.components.websocket_api.async_register_command(websocket_get_prefs) - hass.components.websocket_api.async_register_command(websocket_update_prefs) + websocket_api.async_register_command(hass, ws_camera_stream) + websocket_api.async_register_command(hass, ws_camera_web_rtc_offer) + websocket_api.async_register_command(hass, websocket_get_prefs) + websocket_api.async_register_command(hass, websocket_update_prefs) await component.async_setup(config) diff --git a/homeassistant/components/cloud/http_api.py b/homeassistant/components/cloud/http_api.py index 9ec6acfc23e..5f0a2ddcbca 100644 --- a/homeassistant/components/cloud/http_api.py +++ b/homeassistant/components/cloud/http_api.py @@ -55,24 +55,23 @@ _CLOUD_ERRORS = { async def async_setup(hass): """Initialize the HTTP API.""" - async_register_command = hass.components.websocket_api.async_register_command - async_register_command(websocket_cloud_status) - async_register_command(websocket_subscription) - async_register_command(websocket_update_prefs) - async_register_command(websocket_hook_create) - async_register_command(websocket_hook_delete) - async_register_command(websocket_remote_connect) - async_register_command(websocket_remote_disconnect) + websocket_api.async_register_command(hass, websocket_cloud_status) + websocket_api.async_register_command(hass, websocket_subscription) + websocket_api.async_register_command(hass, websocket_update_prefs) + websocket_api.async_register_command(hass, websocket_hook_create) + websocket_api.async_register_command(hass, websocket_hook_delete) + websocket_api.async_register_command(hass, websocket_remote_connect) + websocket_api.async_register_command(hass, websocket_remote_disconnect) - async_register_command(google_assistant_list) - async_register_command(google_assistant_update) + websocket_api.async_register_command(hass, google_assistant_list) + websocket_api.async_register_command(hass, google_assistant_update) - async_register_command(alexa_list) - async_register_command(alexa_update) - async_register_command(alexa_sync) + websocket_api.async_register_command(hass, alexa_list) + websocket_api.async_register_command(hass, alexa_update) + websocket_api.async_register_command(hass, alexa_sync) - async_register_command(thingtalk_convert) - async_register_command(tts_info) + websocket_api.async_register_command(hass, thingtalk_convert) + websocket_api.async_register_command(hass, tts_info) hass.http.register_view(GoogleActionsSyncView) hass.http.register_view(CloudLoginView) diff --git a/homeassistant/components/config/area_registry.py b/homeassistant/components/config/area_registry.py index 09cd1c1c8ce..3a2c55b3f5d 100644 --- a/homeassistant/components/config/area_registry.py +++ b/homeassistant/components/config/area_registry.py @@ -8,10 +8,10 @@ from homeassistant.helpers.area_registry import async_get async def async_setup(hass): """Enable the Area Registry views.""" - hass.components.websocket_api.async_register_command(websocket_list_areas) - hass.components.websocket_api.async_register_command(websocket_create_area) - hass.components.websocket_api.async_register_command(websocket_delete_area) - hass.components.websocket_api.async_register_command(websocket_update_area) + websocket_api.async_register_command(hass, websocket_list_areas) + websocket_api.async_register_command(hass, websocket_create_area) + websocket_api.async_register_command(hass, websocket_delete_area) + websocket_api.async_register_command(hass, websocket_update_area) return True diff --git a/homeassistant/components/config/auth.py b/homeassistant/components/config/auth.py index c46ef78b0b2..d2f630a8b6d 100644 --- a/homeassistant/components/config/auth.py +++ b/homeassistant/components/config/auth.py @@ -16,14 +16,14 @@ SCHEMA_WS_DELETE = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend( async def async_setup(hass): """Enable the Home Assistant views.""" - hass.components.websocket_api.async_register_command( - WS_TYPE_LIST, websocket_list, SCHEMA_WS_LIST + websocket_api.async_register_command( + hass, WS_TYPE_LIST, websocket_list, SCHEMA_WS_LIST ) - hass.components.websocket_api.async_register_command( - WS_TYPE_DELETE, websocket_delete, SCHEMA_WS_DELETE + websocket_api.async_register_command( + hass, WS_TYPE_DELETE, websocket_delete, SCHEMA_WS_DELETE ) - hass.components.websocket_api.async_register_command(websocket_create) - hass.components.websocket_api.async_register_command(websocket_update) + websocket_api.async_register_command(hass, websocket_create) + websocket_api.async_register_command(hass, websocket_update) return True diff --git a/homeassistant/components/config/auth_provider_homeassistant.py b/homeassistant/components/config/auth_provider_homeassistant.py index 590ab4bff1a..b6874720c47 100644 --- a/homeassistant/components/config/auth_provider_homeassistant.py +++ b/homeassistant/components/config/auth_provider_homeassistant.py @@ -9,12 +9,10 @@ from homeassistant.exceptions import Unauthorized async def async_setup(hass): """Enable the Home Assistant views.""" - hass.components.websocket_api.async_register_command(websocket_create) - hass.components.websocket_api.async_register_command(websocket_delete) - hass.components.websocket_api.async_register_command(websocket_change_password) - hass.components.websocket_api.async_register_command( - websocket_admin_change_password - ) + websocket_api.async_register_command(hass, websocket_create) + websocket_api.async_register_command(hass, websocket_delete) + websocket_api.async_register_command(hass, websocket_change_password) + websocket_api.async_register_command(hass, websocket_admin_change_password) return True diff --git a/homeassistant/components/config/config_entries.py b/homeassistant/components/config/config_entries.py index f42a635f192..1e26a9c46d4 100644 --- a/homeassistant/components/config/config_entries.py +++ b/homeassistant/components/config/config_entries.py @@ -31,10 +31,10 @@ async def async_setup(hass): hass.http.register_view(OptionManagerFlowIndexView(hass.config_entries.options)) hass.http.register_view(OptionManagerFlowResourceView(hass.config_entries.options)) - hass.components.websocket_api.async_register_command(config_entry_disable) - hass.components.websocket_api.async_register_command(config_entry_update) - hass.components.websocket_api.async_register_command(config_entries_progress) - hass.components.websocket_api.async_register_command(ignore_config_flow) + websocket_api.async_register_command(hass, config_entry_disable) + websocket_api.async_register_command(hass, config_entry_update) + websocket_api.async_register_command(hass, config_entries_progress) + websocket_api.async_register_command(hass, ignore_config_flow) return True diff --git a/homeassistant/components/config/device_registry.py b/homeassistant/components/config/device_registry.py index f553e5d5401..50d56915dd4 100644 --- a/homeassistant/components/config/device_registry.py +++ b/homeassistant/components/config/device_registry.py @@ -33,11 +33,11 @@ SCHEMA_WS_UPDATE = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend( async def async_setup(hass): """Enable the Device Registry views.""" - hass.components.websocket_api.async_register_command( - WS_TYPE_LIST, websocket_list_devices, SCHEMA_WS_LIST + websocket_api.async_register_command( + hass, WS_TYPE_LIST, websocket_list_devices, SCHEMA_WS_LIST ) - hass.components.websocket_api.async_register_command( - WS_TYPE_UPDATE, websocket_update_device, SCHEMA_WS_UPDATE + websocket_api.async_register_command( + hass, WS_TYPE_UPDATE, websocket_update_device, SCHEMA_WS_UPDATE ) return True