Import websocket_api (part 1) (#63905)
parent
4460aef040
commit
9c9dc4cb8c
homeassistant/components
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue