diff --git a/homeassistant/components/wake_word/__init__.py b/homeassistant/components/wake_word/__init__.py index 9ce9cca75ff..6c55bd8e7e7 100644 --- a/homeassistant/components/wake_word/__init__.py +++ b/homeassistant/components/wake_word/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from abc import abstractmethod from collections.abc import AsyncIterable -import dataclasses import logging from typing import final @@ -150,5 +149,5 @@ def websocket_entity_info( connection.send_result( msg["id"], - {"wake_words": [dataclasses.asdict(ww) for ww in entity.supported_wake_words]}, + {"wake_words": entity.supported_wake_words}, ) diff --git a/tests/components/wake_word/test_init.py b/tests/components/wake_word/test_init.py index 2fb7cbd0c97..5d1cc5a4b3f 100644 --- a/tests/components/wake_word/test_init.py +++ b/tests/components/wake_word/test_init.py @@ -287,3 +287,24 @@ async def test_list_wake_words( {"id": "test_ww_2", "name": "Test Wake Word 2"}, ] } + + +async def test_list_wake_words_unknown_entity( + hass: HomeAssistant, + setup: MockProviderEntity, + hass_ws_client: WebSocketGenerator, +) -> None: + """Test that the list_wake_words websocket command works.""" + client = await hass_ws_client(hass) + await client.send_json( + { + "id": 5, + "type": "wake_word/info", + "entity_id": "wake_word.blah", + } + ) + + msg = await client.receive_json() + + assert not msg["success"] + assert msg["error"] == {"code": "not_found", "message": "Entity not found"}