From 139b95f52a6a4bcb395e03133bec5559fb654937 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 17 Sep 2025 15:02:11 +0200 Subject: [PATCH] Adjust WS API --- .../components/recorder/recorded_entities.py | 6 ++-- .../components/recorder/test_websocket_api.py | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/homeassistant/components/recorder/recorded_entities.py b/homeassistant/components/recorder/recorded_entities.py index 20eaf34c51ae..f5674e57dd81 100644 --- a/homeassistant/components/recorder/recorded_entities.py +++ b/homeassistant/components/recorder/recorded_entities.py @@ -276,7 +276,7 @@ class RecordedEntities: @websocket_api.require_admin @websocket_api.websocket_command( { - vol.Required("type"): "homeassistant/record_entity/set_options", + vol.Required("type"): "recorder/recorded_entities/set_options", vol.Required("entity_ids"): [str], vol.Required("recording_disabled_by"): vol.Any( None, @@ -304,7 +304,7 @@ def ws_record_entity( @websocket_api.require_admin @websocket_api.websocket_command( { - vol.Required("type"): "homeassistant/record_entity/list", + vol.Required("type"): "recorder/recorded_entities/list", } ) def ws_list_recorded_entities( @@ -324,7 +324,7 @@ def ws_list_recorded_entities( @websocket_api.require_admin @websocket_api.websocket_command( { - vol.Required("type"): "homeassistant/record_entity/get", + vol.Required("type"): "recorder/recorded_entities/get", vol.Required("entity_id"): str, } ) diff --git a/tests/components/recorder/test_websocket_api.py b/tests/components/recorder/test_websocket_api.py index 19df1cdc3948..3945c295586e 100644 --- a/tests/components/recorder/test_websocket_api.py +++ b/tests/components/recorder/test_websocket_api.py @@ -4767,14 +4767,14 @@ async def test_import_statistics_with_last_reset( } -async def test_record_entity_ws( +async def test_recorded_entities_ws( hass: HomeAssistant, async_setup_recorder_instance: RecorderInstanceGenerator, entity_registry: er.EntityRegistry, hass_ws_client: WebSocketGenerator, caplog: pytest.LogCaptureFixture, ) -> None: - """Test record entity WS commands.""" + """Test recorded entities WS commands.""" client = await hass_ws_client() # Prime entity registry @@ -4789,7 +4789,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/list", + "type": "recorder/recorded_entities/list", } ) response = await client.receive_json() @@ -4803,7 +4803,7 @@ async def test_record_entity_ws( # Change setting of an entity await client.send_json_auto_id( { - "type": "homeassistant/record_entity/set_options", + "type": "recorder/recorded_entities/set_options", "entity_ids": ["test.recorder"], "recording_disabled_by": None, } @@ -4813,7 +4813,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/list", + "type": "recorder/recorded_entities/list", } ) response = await client.receive_json() @@ -4827,7 +4827,7 @@ async def test_record_entity_ws( # Change setting of an entity await client.send_json_auto_id( { - "type": "homeassistant/record_entity/set_options", + "type": "recorder/recorded_entities/set_options", "entity_ids": ["test2.recorder"], "recording_disabled_by": "user", } @@ -4837,7 +4837,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/list", + "type": "recorder/recorded_entities/list", } ) response = await client.receive_json() @@ -4851,7 +4851,7 @@ async def test_record_entity_ws( # Change setting of an entity await client.send_json_auto_id( { - "type": "homeassistant/record_entity/set_options", + "type": "recorder/recorded_entities/set_options", "entity_ids": ["test2.recorder"], "recording_disabled_by": "my dog", } @@ -4870,7 +4870,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/list", + "type": "recorder/recorded_entities/list", } ) response = await client.receive_json() @@ -4884,7 +4884,7 @@ async def test_record_entity_ws( # Change setting of an unknown entity await client.send_json_auto_id( { - "type": "homeassistant/record_entity/set_options", + "type": "recorder/recorded_entities/set_options", "entity_ids": ["test.test"], "recording_disabled_by": None, } @@ -4894,7 +4894,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/list", + "type": "recorder/recorded_entities/list", } ) response = await client.receive_json() @@ -4909,7 +4909,7 @@ async def test_record_entity_ws( # Test getting a single entity's settings await client.send_json_auto_id( { - "type": "homeassistant/record_entity/get", + "type": "recorder/recorded_entities/get", "entity_id": "test.recorder", } ) @@ -4918,7 +4918,7 @@ async def test_record_entity_ws( await client.send_json_auto_id( { - "type": "homeassistant/record_entity/get", + "type": "recorder/recorded_entities/get", "entity_id": "test2.recorder", } ) @@ -4928,7 +4928,7 @@ async def test_record_entity_ws( # Test getting settings for an unknown entity await client.send_json_auto_id( { - "type": "homeassistant/record_entity/get", + "type": "recorder/recorded_entities/get", "entity_id": "unknown.entity", } )