From aab0c4eb7116aeca1a2d3ffcbb6588da91111c37 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Fri, 2 Dec 2022 19:59:18 +0100 Subject: [PATCH] Remove matter services available in websocket api (#83151) --- homeassistant/components/matter/__init__.py | 72 ------------------- homeassistant/components/matter/services.yaml | 54 -------------- 2 files changed, 126 deletions(-) diff --git a/homeassistant/components/matter/__init__.py b/homeassistant/components/matter/__init__.py index 845d48ea883..8c60987f487 100644 --- a/homeassistant/components/matter/__init__.py +++ b/homeassistant/components/matter/__init__.py @@ -189,78 +189,6 @@ def get_matter(hass: HomeAssistant) -> MatterAdapter: def _async_init_services(hass: HomeAssistant) -> None: """Init services.""" - async def commission(call: ServiceCall) -> None: - """Handle commissioning.""" - matter_client = get_matter(hass).matter_client - try: - await matter_client.commission_with_code(call.data["code"]) - except FailedCommand as err: - raise HomeAssistantError(str(err)) from err - - async_register_admin_service( - hass, - DOMAIN, - "commission", - commission, - vol.Schema({"code": str}), - ) - - async def accept_shared_device(call: ServiceCall) -> None: - """Accept a shared device.""" - matter_client = get_matter(hass).matter_client - try: - await matter_client.commission_on_network(call.data["pin"]) - except FailedCommand as err: - raise HomeAssistantError(str(err)) from err - - async_register_admin_service( - hass, - DOMAIN, - "accept_shared_device", - accept_shared_device, - vol.Schema({"pin": vol.Coerce(int)}), - ) - - async def set_wifi(call: ServiceCall) -> None: - """Handle set wifi creds.""" - matter_client = get_matter(hass).matter_client - try: - await matter_client.set_wifi_credentials( - call.data["ssid"], call.data["password"] - ) - except FailedCommand as err: - raise HomeAssistantError(str(err)) from err - - async_register_admin_service( - hass, - DOMAIN, - "set_wifi", - set_wifi, - vol.Schema( - { - "ssid": str, - "password": str, - } - ), - ) - - async def set_thread_dataset(call: ServiceCall) -> None: - """Handle set Thread creds.""" - matter_client = get_matter(hass).matter_client - thread_dataset = bytes.fromhex(call.data["dataset"]) - try: - await matter_client.set_thread_operational_dataset(thread_dataset) - except FailedCommand as err: - raise HomeAssistantError(str(err)) from err - - async_register_admin_service( - hass, - DOMAIN, - "set_thread", - set_thread_dataset, - vol.Schema({"dataset": str}), - ) - async def _node_id_from_ha_device_id(ha_device_id: str) -> int | None: """Get node id from ha device id.""" dev_reg = dr.async_get(hass) diff --git a/homeassistant/components/matter/services.yaml b/homeassistant/components/matter/services.yaml index 18bb4be6452..ff59a7efe63 100644 --- a/homeassistant/components/matter/services.yaml +++ b/homeassistant/components/matter/services.yaml @@ -1,57 +1,3 @@ -commission: - name: Commission device - description: > - Add a new device to your Matter network. - fields: - code: - name: Pairing code - description: The pairing code for the device. - required: true - selector: - text: -accept_shared_device: - name: Accept shared device - description: > - Add a shared device to your Matter network. - fields: - pin: - name: Pin code - description: The pin code for the device. - required: true - selector: - text: - -set_wifi: - name: Set Wi-Fi credentials - description: > - The Wi-Fi credentials will be sent as part of commissioning to a Matter device so it can connect to the Wi-Fi network. - fields: - ssid: - name: Network name - description: The SSID network name. - required: true - selector: - text: - password: - name: Password - description: The Wi-Fi network password. - required: true - selector: - text: - type: password -set_thread: - name: Set Thread network operational dataset - description: > - The Thread keys will be used as part of commissioning to let a Matter device join the Thread network. - - Get keys by running `ot-ctl dataset active -x` on the Open Thread Border Router. - fields: - thread_operation_dataset: - name: Thread Operational Dataset - description: The Thread Operational Dataset to set. - required: true - selector: - text: open_commissioning_window: name: Open Commissioning Window description: >