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:
|
) -> None:
|
||||||
"""Get the status of the Z-Wave JS network."""
|
"""Get the status of the Z-Wave JS network."""
|
||||||
controller = client.driver.controller
|
controller = client.driver.controller
|
||||||
|
await controller.async_get_state()
|
||||||
data = {
|
data = {
|
||||||
"client": {
|
"client": {
|
||||||
"ws_server_url": client.ws_server_url,
|
"ws_server_url": client.ws_server_url,
|
||||||
|
@ -393,6 +394,7 @@ async def websocket_network_status(
|
||||||
"suc_node_id": controller.suc_node_id,
|
"suc_node_id": controller.suc_node_id,
|
||||||
"supports_timers": controller.supports_timers,
|
"supports_timers": controller.supports_timers,
|
||||||
"is_heal_network_active": controller.is_heal_network_active,
|
"is_heal_network_active": controller.is_heal_network_active,
|
||||||
|
"inclusion_state": controller.inclusion_state,
|
||||||
"nodes": list(client.driver.controller.nodes),
|
"nodes": list(client.driver.controller.nodes),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,8 @@
|
||||||
],
|
],
|
||||||
"sucNodeId": 1,
|
"sucNodeId": 1,
|
||||||
"supportsTimers": false,
|
"supportsTimers": false,
|
||||||
"isHealNetworkActive": false
|
"isHealNetworkActive": false,
|
||||||
|
"inclusionState": 0
|
||||||
},
|
},
|
||||||
"nodes": [
|
"nodes": [
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,6 +6,7 @@ from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from zwave_js_server.const import (
|
from zwave_js_server.const import (
|
||||||
|
InclusionState,
|
||||||
InclusionStrategy,
|
InclusionStrategy,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
Protocols,
|
Protocols,
|
||||||
|
@ -77,6 +78,7 @@ async def test_network_status(hass, integration, hass_ws_client):
|
||||||
entry = integration
|
entry = integration
|
||||||
ws_client = await hass_ws_client(hass)
|
ws_client = await hass_ws_client(hass)
|
||||||
|
|
||||||
|
with patch("zwave_js_server.model.controller.Controller.async_get_state"):
|
||||||
await ws_client.send_json(
|
await ws_client.send_json(
|
||||||
{ID: 2, TYPE: "zwave_js/network_status", ENTRY_ID: entry.entry_id}
|
{ID: 2, TYPE: "zwave_js/network_status", ENTRY_ID: entry.entry_id}
|
||||||
)
|
)
|
||||||
|
@ -85,6 +87,7 @@ async def test_network_status(hass, integration, hass_ws_client):
|
||||||
|
|
||||||
assert result["client"]["ws_server_url"] == "ws://test:3000/zjs"
|
assert result["client"]["ws_server_url"] == "ws://test:3000/zjs"
|
||||||
assert result["client"]["server_version"] == "1.0.0"
|
assert result["client"]["server_version"] == "1.0.0"
|
||||||
|
assert result["controller"]["inclusion_state"] == InclusionState.IDLE
|
||||||
|
|
||||||
# Test sending command with not loaded entry fails
|
# Test sending command with not loaded entry fails
|
||||||
await hass.config_entries.async_unload(entry.entry_id)
|
await hass.config_entries.async_unload(entry.entry_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue