Add inclusion state to zwave_js/network_status WS API cmd (#65398)
This commit is contained in:
parent
42b5ce184c
commit
a1b81b2de4
3 changed files with 12 additions and 6 deletions
|
@ -367,6 +367,7 @@ async def websocket_network_status(
|
|||
) -> None:
|
||||
"""Get the status of the Z-Wave JS network."""
|
||||
controller = client.driver.controller
|
||||
await controller.async_get_state()
|
||||
data = {
|
||||
"client": {
|
||||
"ws_server_url": client.ws_server_url,
|
||||
|
@ -393,6 +394,7 @@ async def websocket_network_status(
|
|||
"suc_node_id": controller.suc_node_id,
|
||||
"supports_timers": controller.supports_timers,
|
||||
"is_heal_network_active": controller.is_heal_network_active,
|
||||
"inclusion_state": controller.inclusion_state,
|
||||
"nodes": list(client.driver.controller.nodes),
|
||||
},
|
||||
}
|
||||
|
|
|
@ -92,7 +92,8 @@
|
|||
],
|
||||
"sucNodeId": 1,
|
||||
"supportsTimers": false,
|
||||
"isHealNetworkActive": false
|
||||
"isHealNetworkActive": false,
|
||||
"inclusionState": 0
|
||||
},
|
||||
"nodes": [
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
from zwave_js_server.const import (
|
||||
InclusionState,
|
||||
InclusionStrategy,
|
||||
LogLevel,
|
||||
Protocols,
|
||||
|
@ -77,14 +78,16 @@ async def test_network_status(hass, integration, hass_ws_client):
|
|||
entry = integration
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
await ws_client.send_json(
|
||||
{ID: 2, TYPE: "zwave_js/network_status", ENTRY_ID: entry.entry_id}
|
||||
)
|
||||
msg = await ws_client.receive_json()
|
||||
result = msg["result"]
|
||||
with patch("zwave_js_server.model.controller.Controller.async_get_state"):
|
||||
await ws_client.send_json(
|
||||
{ID: 2, TYPE: "zwave_js/network_status", ENTRY_ID: entry.entry_id}
|
||||
)
|
||||
msg = await ws_client.receive_json()
|
||||
result = msg["result"]
|
||||
|
||||
assert result["client"]["ws_server_url"] == "ws://test:3000/zjs"
|
||||
assert result["client"]["server_version"] == "1.0.0"
|
||||
assert result["controller"]["inclusion_state"] == InclusionState.IDLE
|
||||
|
||||
# Test sending command with not loaded entry fails
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
|
|
Loading…
Add table
Reference in a new issue