Bump zwave-js-server-python to 0.52.0 (#100833)
* Bump zwave-js-server-python to 0.52.0 * remove old function * fix tests
This commit is contained in:
parent
59a26010ba
commit
176f5dc2d6
10 changed files with 169 additions and 100 deletions
|
@ -411,15 +411,15 @@ def async_register_api(hass: HomeAssistant) -> None:
|
|||
websocket_api.async_register_command(hass, websocket_remove_node)
|
||||
websocket_api.async_register_command(hass, websocket_remove_failed_node)
|
||||
websocket_api.async_register_command(hass, websocket_replace_failed_node)
|
||||
websocket_api.async_register_command(hass, websocket_begin_healing_network)
|
||||
websocket_api.async_register_command(hass, websocket_begin_rebuilding_routes)
|
||||
websocket_api.async_register_command(
|
||||
hass, websocket_subscribe_heal_network_progress
|
||||
hass, websocket_subscribe_rebuild_routes_progress
|
||||
)
|
||||
websocket_api.async_register_command(hass, websocket_stop_healing_network)
|
||||
websocket_api.async_register_command(hass, websocket_stop_rebuilding_routes)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_info)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_values)
|
||||
websocket_api.async_register_command(hass, websocket_refresh_node_cc_values)
|
||||
websocket_api.async_register_command(hass, websocket_heal_node)
|
||||
websocket_api.async_register_command(hass, websocket_rebuild_node_routes)
|
||||
websocket_api.async_register_command(hass, websocket_set_config_parameter)
|
||||
websocket_api.async_register_command(hass, websocket_get_config_parameters)
|
||||
websocket_api.async_register_command(hass, websocket_subscribe_log_updates)
|
||||
|
@ -511,7 +511,7 @@ async def websocket_network_status(
|
|||
"supported_function_types": controller.supported_function_types,
|
||||
"suc_node_id": controller.suc_node_id,
|
||||
"supports_timers": controller.supports_timers,
|
||||
"is_heal_network_active": controller.is_heal_network_active,
|
||||
"is_rebuilding_routes": controller.is_rebuilding_routes,
|
||||
"inclusion_state": controller.inclusion_state,
|
||||
"rf_region": controller.rf_region,
|
||||
"status": controller.status,
|
||||
|
@ -1379,14 +1379,14 @@ async def websocket_remove_failed_node(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/begin_healing_network",
|
||||
vol.Required(TYPE): "zwave_js/begin_rebuilding_routes",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_entry
|
||||
async def websocket_begin_healing_network(
|
||||
async def websocket_begin_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1394,10 +1394,10 @@ async def websocket_begin_healing_network(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Begin healing the Z-Wave network."""
|
||||
"""Begin rebuilding Z-Wave routes."""
|
||||
controller = driver.controller
|
||||
|
||||
result = await controller.async_begin_healing_network()
|
||||
result = await controller.async_begin_rebuilding_routes()
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
@ -1407,13 +1407,13 @@ async def websocket_begin_healing_network(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/subscribe_heal_network_progress",
|
||||
vol.Required(TYPE): "zwave_js/subscribe_rebuild_routes_progress",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_get_entry
|
||||
async def websocket_subscribe_heal_network_progress(
|
||||
async def websocket_subscribe_rebuild_routes_progress(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1421,7 +1421,7 @@ async def websocket_subscribe_heal_network_progress(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Subscribe to heal Z-Wave network status updates."""
|
||||
"""Subscribe to rebuild Z-Wave routes status updates."""
|
||||
controller = driver.controller
|
||||
|
||||
@callback
|
||||
|
@ -1434,30 +1434,39 @@ async def websocket_subscribe_heal_network_progress(
|
|||
def forward_event(key: str, event: dict) -> None:
|
||||
connection.send_message(
|
||||
websocket_api.event_message(
|
||||
msg[ID], {"event": event["event"], "heal_node_status": event[key]}
|
||||
msg[ID], {"event": event["event"], "rebuild_routes_status": event[key]}
|
||||
)
|
||||
)
|
||||
|
||||
connection.subscriptions[msg["id"]] = async_cleanup
|
||||
msg[DATA_UNSUBSCRIBE] = unsubs = [
|
||||
controller.on("heal network progress", partial(forward_event, "progress")),
|
||||
controller.on("heal network done", partial(forward_event, "result")),
|
||||
controller.on("rebuild routes progress", partial(forward_event, "progress")),
|
||||
controller.on("rebuild routes done", partial(forward_event, "result")),
|
||||
]
|
||||
|
||||
connection.send_result(msg[ID], controller.heal_network_progress)
|
||||
if controller.rebuild_routes_progress:
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
{
|
||||
node.node_id: status
|
||||
for node, status in controller.rebuild_routes_progress.items()
|
||||
},
|
||||
)
|
||||
else:
|
||||
connection.send_result(msg[ID], None)
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/stop_healing_network",
|
||||
vol.Required(TYPE): "zwave_js/stop_rebuilding_routes",
|
||||
vol.Required(ENTRY_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_entry
|
||||
async def websocket_stop_healing_network(
|
||||
async def websocket_stop_rebuilding_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1465,9 +1474,9 @@ async def websocket_stop_healing_network(
|
|||
client: Client,
|
||||
driver: Driver,
|
||||
) -> None:
|
||||
"""Stop healing the Z-Wave network."""
|
||||
"""Stop rebuilding Z-Wave routes."""
|
||||
controller = driver.controller
|
||||
result = await controller.async_stop_healing_network()
|
||||
result = await controller.async_stop_rebuilding_routes()
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
@ -1477,14 +1486,14 @@ async def websocket_stop_healing_network(
|
|||
@websocket_api.require_admin
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/heal_node",
|
||||
vol.Required(TYPE): "zwave_js/rebuild_node_routes",
|
||||
vol.Required(DEVICE_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_handle_failed_command
|
||||
@async_get_node
|
||||
async def websocket_heal_node(
|
||||
async def websocket_rebuild_node_routes(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
|
@ -1495,7 +1504,7 @@ async def websocket_heal_node(
|
|||
assert driver is not None # The node comes from the driver instance.
|
||||
controller = driver.controller
|
||||
|
||||
result = await controller.async_heal_node(node)
|
||||
result = await controller.async_rebuild_node_routes(node)
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
result,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue