diff --git a/homeassistant/components/assist_satellite/websocket_api.py b/homeassistant/components/assist_satellite/websocket_api.py index 6cd7af2bbdb..4fc1708b866 100644 --- a/homeassistant/components/assist_satellite/websocket_api.py +++ b/homeassistant/components/assist_satellite/websocket_api.py @@ -19,6 +19,7 @@ from .const import ( DOMAIN, AssistSatelliteEntityFeature, ) +from .entity import AssistSatelliteConfiguration CONNECTION_TEST_TIMEOUT = 30 @@ -91,7 +92,16 @@ def websocket_get_configuration( ) return - config_dict = asdict(satellite.async_get_configuration()) + try: + config_dict = asdict(satellite.async_get_configuration()) + except NotImplementedError: + # Stub configuration + config_dict = asdict( + AssistSatelliteConfiguration( + available_wake_words=[], active_wake_words=[], max_active_wake_words=1 + ) + ) + config_dict["pipeline_entity_id"] = satellite.pipeline_entity_id config_dict["vad_entity_id"] = satellite.vad_sensitivity_entity_id diff --git a/tests/components/assist_satellite/test_websocket_api.py b/tests/components/assist_satellite/test_websocket_api.py index 257961a5b32..f0a8f02fc50 100644 --- a/tests/components/assist_satellite/test_websocket_api.py +++ b/tests/components/assist_satellite/test_websocket_api.py @@ -313,6 +313,37 @@ async def test_get_configuration( } +async def test_get_configuration_not_implemented( + hass: HomeAssistant, + init_components: ConfigEntry, + entity: MockAssistSatellite, + hass_ws_client: WebSocketGenerator, +) -> None: + """Test getting stub satellite configuration when the entity doesn't implement the method.""" + ws_client = await hass_ws_client(hass) + + with patch.object( + entity, "async_get_configuration", side_effect=NotImplementedError() + ): + await ws_client.send_json_auto_id( + { + "type": "assist_satellite/get_configuration", + "entity_id": ENTITY_ID, + } + ) + msg = await ws_client.receive_json() + assert msg["success"] + + # Stub configuration + assert msg["result"] == { + "active_wake_words": [], + "available_wake_words": [], + "max_active_wake_words": 1, + "pipeline_entity_id": None, + "vad_entity_id": None, + } + + async def test_set_wake_words( hass: HomeAssistant, init_components: ConfigEntry,