Add Z-Wave WS command to hard reset controller (#101449)

This commit is contained in:
Raman Gupta 2023-10-09 13:33:31 -04:00 committed by GitHub
parent d46dca8950
commit 70a0cd579d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 93 additions and 0 deletions

View file

@ -447,6 +447,7 @@ def async_register_api(hass: HomeAssistant) -> None:
hass, websocket_subscribe_controller_statistics
)
websocket_api.async_register_command(hass, websocket_subscribe_node_statistics)
websocket_api.async_register_command(hass, websocket_hard_reset_controller)
hass.http.register_view(FirmwareUploadView(dr.async_get(hass)))
@ -2441,3 +2442,26 @@ async def websocket_subscribe_node_statistics(
},
)
)
@websocket_api.require_admin
@websocket_api.websocket_command(
{
vol.Required(TYPE): "zwave_js/hard_reset_controller",
vol.Required(ENTRY_ID): str,
}
)
@websocket_api.async_response
@async_handle_failed_command
@async_get_entry
async def websocket_hard_reset_controller(
hass: HomeAssistant,
connection: ActiveConnection,
msg: dict[str, Any],
entry: ConfigEntry,
client: Client,
driver: Driver,
) -> None:
"""Hard reset controller."""
await driver.async_hard_reset()
connection.send_result(msg[ID])