Send initial status in zwave_js WS API cmds to subscribe to updates (#53386)
This commit is contained in:
parent
0d38ee7378
commit
9ee7e55f10
2 changed files with 83 additions and 2 deletions
|
@ -796,7 +796,7 @@ async def websocket_subscribe_heal_network_progress(
|
|||
controller.on("heal network done", partial(forward_event, "result")),
|
||||
]
|
||||
|
||||
connection.send_result(msg[ID])
|
||||
connection.send_result(msg[ID], controller.heal_network_progress)
|
||||
|
||||
|
||||
@websocket_api.require_admin
|
||||
|
@ -1390,7 +1390,15 @@ async def websocket_subscribe_firmware_update_status(
|
|||
]
|
||||
connection.subscriptions[msg["id"]] = async_cleanup
|
||||
|
||||
connection.send_result(msg[ID])
|
||||
result = (
|
||||
{
|
||||
"sent_fragments": node.firmware_update_progress.sent_fragments,
|
||||
"total_fragments": node.firmware_update_progress.total_fragments,
|
||||
}
|
||||
if node.firmware_update_progress
|
||||
else None
|
||||
)
|
||||
connection.send_result(msg[ID], result)
|
||||
|
||||
|
||||
class FirmwareUploadView(HomeAssistantView):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue