Add alert to zwave_js device info page for custom device config (#104115)
parent
b42629ecf3
commit
a074c06f92
|
@ -393,7 +393,7 @@ def async_register_api(hass: HomeAssistant) -> None:
|
|||
websocket_api.async_register_command(hass, websocket_subscribe_node_status)
|
||||
websocket_api.async_register_command(hass, websocket_node_status)
|
||||
websocket_api.async_register_command(hass, websocket_node_metadata)
|
||||
websocket_api.async_register_command(hass, websocket_node_comments)
|
||||
websocket_api.async_register_command(hass, websocket_node_alerts)
|
||||
websocket_api.async_register_command(hass, websocket_add_node)
|
||||
websocket_api.async_register_command(hass, websocket_grant_security_classes)
|
||||
websocket_api.async_register_command(hass, websocket_validate_dsk_and_enter_pin)
|
||||
|
@ -616,22 +616,25 @@ async def websocket_node_metadata(
|
|||
|
||||
@websocket_api.websocket_command(
|
||||
{
|
||||
vol.Required(TYPE): "zwave_js/node_comments",
|
||||
vol.Required(TYPE): "zwave_js/node_alerts",
|
||||
vol.Required(DEVICE_ID): str,
|
||||
}
|
||||
)
|
||||
@websocket_api.async_response
|
||||
@async_get_node
|
||||
async def websocket_node_comments(
|
||||
async def websocket_node_alerts(
|
||||
hass: HomeAssistant,
|
||||
connection: ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
node: Node,
|
||||
) -> None:
|
||||
"""Get the comments of a Z-Wave JS node."""
|
||||
"""Get the alerts for a Z-Wave JS node."""
|
||||
connection.send_result(
|
||||
msg[ID],
|
||||
{"comments": node.device_config.metadata.comments},
|
||||
{
|
||||
"comments": node.device_config.metadata.comments,
|
||||
"is_embedded": node.device_config.is_embedded,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ async def test_node_metadata(
|
|||
assert msg["error"]["code"] == ERR_NOT_LOADED
|
||||
|
||||
|
||||
async def test_node_comments(
|
||||
async def test_node_alerts(
|
||||
hass: HomeAssistant,
|
||||
wallmote_central_scene,
|
||||
integration,
|
||||
|
@ -473,13 +473,14 @@ async def test_node_comments(
|
|||
await ws_client.send_json(
|
||||
{
|
||||
ID: 3,
|
||||
TYPE: "zwave_js/node_comments",
|
||||
TYPE: "zwave_js/node_alerts",
|
||||
DEVICE_ID: device.id,
|
||||
}
|
||||
)
|
||||
msg = await ws_client.receive_json()
|
||||
result = msg["result"]
|
||||
assert result["comments"] == [{"level": "info", "text": "test"}]
|
||||
assert result["is_embedded"]
|
||||
|
||||
|
||||
async def test_add_node(
|
||||
|
|
Loading…
Reference in New Issue