Update zwave_js WS API names (#75797)

pull/75850/head
Raman Gupta 2022-07-27 17:42:17 -04:00 committed by GitHub
parent 44f1d92890
commit 4aa6300b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View File

@ -414,7 +414,9 @@ def async_register_api(hass: HomeAssistant) -> None:
)
websocket_api.async_register_command(hass, websocket_data_collection_status)
websocket_api.async_register_command(hass, websocket_abort_firmware_update)
websocket_api.async_register_command(hass, websocket_get_firmware_update_progress)
websocket_api.async_register_command(
hass, websocket_is_node_firmware_update_in_progress
)
websocket_api.async_register_command(
hass, websocket_subscribe_firmware_update_status
)
@ -422,7 +424,7 @@ def async_register_api(hass: HomeAssistant) -> None:
hass, websocket_get_firmware_update_capabilities
)
websocket_api.async_register_command(
hass, websocket_get_any_firmware_update_progress
hass, websocket_is_any_ota_firmware_update_in_progress
)
websocket_api.async_register_command(hass, websocket_check_for_config_updates)
websocket_api.async_register_command(hass, websocket_install_config_update)
@ -1874,20 +1876,20 @@ async def websocket_abort_firmware_update(
@websocket_api.require_admin
@websocket_api.websocket_command(
{
vol.Required(TYPE): "zwave_js/get_firmware_update_progress",
vol.Required(TYPE): "zwave_js/is_node_firmware_update_in_progress",
vol.Required(DEVICE_ID): str,
}
)
@websocket_api.async_response
@async_handle_failed_command
@async_get_node
async def websocket_get_firmware_update_progress(
async def websocket_is_node_firmware_update_in_progress(
hass: HomeAssistant,
connection: ActiveConnection,
msg: dict,
node: Node,
) -> None:
"""Get whether firmware update is in progress."""
"""Get whether firmware update is in progress for given node."""
connection.send_result(msg[ID], await node.async_is_firmware_update_in_progress())
@ -1995,14 +1997,14 @@ async def websocket_get_firmware_update_capabilities(
@websocket_api.require_admin
@websocket_api.websocket_command(
{
vol.Required(TYPE): "zwave_js/get_any_firmware_update_progress",
vol.Required(TYPE): "zwave_js/is_any_ota_firmware_update_in_progress",
vol.Required(ENTRY_ID): str,
}
)
@websocket_api.async_response
@async_handle_failed_command
@async_get_entry
async def websocket_get_any_firmware_update_progress(
async def websocket_is_any_ota_firmware_update_in_progress(
hass: HomeAssistant,
connection: ActiveConnection,
msg: dict,

View File

@ -3437,10 +3437,10 @@ async def test_abort_firmware_update(
assert msg["error"]["code"] == ERR_NOT_FOUND
async def test_get_firmware_update_progress(
async def test_is_node_firmware_update_in_progress(
hass, client, multisensor_6, integration, hass_ws_client
):
"""Test that the get_firmware_update_progress WS API call works."""
"""Test that the is_firmware_update_in_progress WS API call works."""
entry = integration
ws_client = await hass_ws_client(hass)
device = get_device(hass, multisensor_6)
@ -3449,7 +3449,7 @@ async def test_get_firmware_update_progress(
await ws_client.send_json(
{
ID: 1,
TYPE: "zwave_js/get_firmware_update_progress",
TYPE: "zwave_js/is_node_firmware_update_in_progress",
DEVICE_ID: device.id,
}
)
@ -3470,7 +3470,7 @@ async def test_get_firmware_update_progress(
await ws_client.send_json(
{
ID: 2,
TYPE: "zwave_js/get_firmware_update_progress",
TYPE: "zwave_js/is_node_firmware_update_in_progress",
DEVICE_ID: device.id,
}
)
@ -3487,7 +3487,7 @@ async def test_get_firmware_update_progress(
await ws_client.send_json(
{
ID: 3,
TYPE: "zwave_js/get_firmware_update_progress",
TYPE: "zwave_js/is_node_firmware_update_in_progress",
DEVICE_ID: device.id,
}
)
@ -3723,10 +3723,10 @@ async def test_get_firmware_update_capabilities(
assert msg["error"]["code"] == ERR_NOT_FOUND
async def test_get_any_firmware_update_progress(
async def test_is_any_ota_firmware_update_in_progress(
hass, client, integration, hass_ws_client
):
"""Test that the get_any_firmware_update_progress WS API call works."""
"""Test that the is_any_ota_firmware_update_in_progress WS API call works."""
entry = integration
ws_client = await hass_ws_client(hass)
@ -3734,7 +3734,7 @@ async def test_get_any_firmware_update_progress(
await ws_client.send_json(
{
ID: 1,
TYPE: "zwave_js/get_any_firmware_update_progress",
TYPE: "zwave_js/is_any_ota_firmware_update_in_progress",
ENTRY_ID: entry.entry_id,
}
)
@ -3754,7 +3754,7 @@ async def test_get_any_firmware_update_progress(
await ws_client.send_json(
{
ID: 2,
TYPE: "zwave_js/get_any_firmware_update_progress",
TYPE: "zwave_js/is_any_ota_firmware_update_in_progress",
ENTRY_ID: entry.entry_id,
}
)
@ -3771,7 +3771,7 @@ async def test_get_any_firmware_update_progress(
await ws_client.send_json(
{
ID: 3,
TYPE: "zwave_js/get_any_firmware_update_progress",
TYPE: "zwave_js/is_any_ota_firmware_update_in_progress",
ENTRY_ID: entry.entry_id,
}
)
@ -3784,7 +3784,7 @@ async def test_get_any_firmware_update_progress(
await ws_client.send_json(
{
ID: 4,
TYPE: "zwave_js/get_any_firmware_update_progress",
TYPE: "zwave_js/is_any_ota_firmware_update_in_progress",
ENTRY_ID: "invalid_entry",
}
)