Remove matter services available in websocket api (#83151)

This commit is contained in:
Martin Hjelmare 2022-12-02 19:59:18 +01:00 committed by GitHub
parent 8b867d612f
commit aab0c4eb71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 126 deletions

View File

@ -189,78 +189,6 @@ def get_matter(hass: HomeAssistant) -> MatterAdapter:
def _async_init_services(hass: HomeAssistant) -> None: def _async_init_services(hass: HomeAssistant) -> None:
"""Init services.""" """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: async def _node_id_from_ha_device_id(ha_device_id: str) -> int | None:
"""Get node id from ha device id.""" """Get node id from ha device id."""
dev_reg = dr.async_get(hass) dev_reg = dr.async_get(hass)

View File

@ -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: open_commissioning_window:
name: Open Commissioning Window name: Open Commissioning Window
description: > description: >