add api to refresh topology (#44840)

pull/45928/head
David F. Mulcahey 2021-02-03 15:35:05 -05:00 committed by GitHub
parent a775b79d4b
commit 51e695fd45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -469,6 +469,19 @@ async def websocket_reconfigure_node(hass, connection, msg):
hass.async_create_task(device.async_configure())
@websocket_api.require_admin
@websocket_api.async_response
@websocket_api.websocket_command(
{
vol.Required(TYPE): "zha/topology/update",
}
)
async def websocket_update_topology(hass, connection, msg):
"""Update the ZHA network topology."""
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
hass.async_create_task(zha_gateway.application_controller.topology.scan())
@websocket_api.require_admin
@websocket_api.async_response
@websocket_api.websocket_command(
@ -1143,6 +1156,7 @@ def async_load_api(hass):
websocket_api.async_register_command(hass, websocket_get_bindable_devices)
websocket_api.async_register_command(hass, websocket_bind_devices)
websocket_api.async_register_command(hass, websocket_unbind_devices)
websocket_api.async_register_command(hass, websocket_update_topology)
@callback