diff --git a/homeassistant/components/zwave_js/api.py b/homeassistant/components/zwave_js/api.py index ee0d4eb43a344..6f5ad6ba83bfc 100644 --- a/homeassistant/components/zwave_js/api.py +++ b/homeassistant/components/zwave_js/api.py @@ -364,6 +364,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, @@ -390,6 +391,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), }, } diff --git a/tests/components/zwave_js/fixtures/controller_state.json b/tests/components/zwave_js/fixtures/controller_state.json index d4bf58a53ceb7..ac0cedcffef9b 100644 --- a/tests/components/zwave_js/fixtures/controller_state.json +++ b/tests/components/zwave_js/fixtures/controller_state.json @@ -92,7 +92,8 @@ ], "sucNodeId": 1, "supportsTimers": false, - "isHealNetworkActive": false + "isHealNetworkActive": false, + "inclusionState": 0 }, "nodes": [ ] diff --git a/tests/components/zwave_js/test_api.py b/tests/components/zwave_js/test_api.py index 40f60b9018a48..642cf398a6f7f 100644 --- a/tests/components/zwave_js/test_api.py +++ b/tests/components/zwave_js/test_api.py @@ -6,6 +6,7 @@ import pytest from zwave_js_server.const import ( + InclusionState, InclusionStrategy, LogLevel, Protocols, @@ -76,14 +77,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)