Show warning message for Z-Wave devices in interview stage (#144483)

* Show warning message for devices in interview stage

* remove debug code
This commit is contained in:
Petar Petrov 2025-05-08 23:21:43 +03:00 committed by GitHub
parent d13f9be9d8
commit e0fb612e82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -674,10 +674,18 @@ async def websocket_node_alerts(
connection.send_error(msg[ID], ERR_NOT_LOADED, str(err))
return
comments = node.device_config.metadata.comments
if node.in_interview:
comments.append(
{
"level": "warning",
"text": "This device is currently being interviewed and may not be fully operational.",
}
)
connection.send_result(
msg[ID],
{
"comments": node.device_config.metadata.comments,
"comments": comments,
"is_embedded": node.device_config.is_embedded,
},
)

View File

@ -505,6 +505,22 @@ async def test_node_alerts(
assert result["comments"] == [{"level": "info", "text": "test"}]
assert result["is_embedded"]
# Test with node in interview
with patch("zwave_js_server.model.node.Node.in_interview", return_value=True):
await ws_client.send_json_auto_id(
{
TYPE: "zwave_js/node_alerts",
DEVICE_ID: device.id,
}
)
msg = await ws_client.receive_json()
assert msg["success"]
assert len(msg["result"]["comments"]) == 2
assert msg["result"]["comments"][1] == {
"level": "warning",
"text": "This device is currently being interviewed and may not be fully operational.",
}
# Test with provisioned device
valid_qr_info = {
VERSION: 1,