Skip to content

Commit 795ef07

Browse files
authored
Restore original websocket commands for config entries (home-assistant#93707)
Restore original websocket commands and add "config_entries/get_single"
1 parent 5f584d5 commit 795ef07

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

homeassistant/components/config/config_entries.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ async def async_setup(hass):
4141
hass.http.register_view(OptionManagerFlowIndexView(hass.config_entries.options))
4242
hass.http.register_view(OptionManagerFlowResourceView(hass.config_entries.options))
4343

44-
websocket_api.async_register_command(hass, config_entries_get_matching)
44+
websocket_api.async_register_command(hass, config_entries_get)
4545
websocket_api.async_register_command(hass, config_entry_disable)
46-
websocket_api.async_register_command(hass, config_entry_get)
46+
websocket_api.async_register_command(hass, config_entry_get_single)
4747
websocket_api.async_register_command(hass, config_entry_update)
4848
websocket_api.async_register_command(hass, config_entries_subscribe)
4949
websocket_api.async_register_command(hass, config_entries_progress)
@@ -288,12 +288,12 @@ def get_entry(
288288
@websocket_api.require_admin
289289
@websocket_api.websocket_command(
290290
{
291-
"type": "config_entries/get",
291+
"type": "config_entries/get_single",
292292
"entry_id": str,
293293
}
294294
)
295295
@websocket_api.async_response
296-
async def config_entry_get(
296+
async def config_entry_get_single(
297297
hass: HomeAssistant,
298298
connection: websocket_api.ActiveConnection,
299299
msg: dict[str, Any],
@@ -432,13 +432,13 @@ async def ignore_config_flow(
432432

433433
@websocket_api.websocket_command(
434434
{
435-
vol.Required("type"): "config_entries/get_matching",
435+
vol.Required("type"): "config_entries/get",
436436
vol.Optional("type_filter"): vol.All(cv.ensure_list, [str]),
437437
vol.Optional("domain"): str,
438438
}
439439
)
440440
@websocket_api.async_response
441-
async def config_entries_get_matching(
441+
async def config_entries_get(
442442
hass: HomeAssistant,
443443
connection: websocket_api.ActiveConnection,
444444
msg: dict[str, Any],

tests/components/bluetooth/test_config_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def test_options_flow_disabled_not_setup(
3636
await ws_client.send_json(
3737
{
3838
"id": 5,
39-
"type": "config_entries/get_matching",
39+
"type": "config_entries/get",
4040
"domain": "bluetooth",
4141
}
4242
)
@@ -370,7 +370,7 @@ async def test_options_flow_disabled_macos(
370370
await ws_client.send_json(
371371
{
372372
"id": 5,
373-
"type": "config_entries/get_matching",
373+
"type": "config_entries/get",
374374
"domain": "bluetooth",
375375
}
376376
)
@@ -403,7 +403,7 @@ async def test_options_flow_enabled_linux(
403403
await ws_client.send_json(
404404
{
405405
"id": 5,
406-
"type": "config_entries/get_matching",
406+
"type": "config_entries/get",
407407
"domain": "bluetooth",
408408
}
409409
)

tests/components/config/test_config_entries.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,9 @@ async def async_step_finish(self, user_input=None):
969969
}
970970

971971

972-
async def test_get(hass: HomeAssistant, hass_ws_client: WebSocketGenerator) -> None:
972+
async def test_get_single(
973+
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
974+
) -> None:
973975
"""Test that we can get a config entry."""
974976
assert await async_setup_component(hass, "config", {})
975977
ws_client = await hass_ws_client(hass)
@@ -982,7 +984,7 @@ async def test_get(hass: HomeAssistant, hass_ws_client: WebSocketGenerator) -> N
982984

983985
await ws_client.send_json_auto_id(
984986
{
985-
"type": "config_entries/get",
987+
"type": "config_entries/get_single",
986988
"entry_id": entry.entry_id,
987989
}
988990
)
@@ -1006,7 +1008,7 @@ async def test_get(hass: HomeAssistant, hass_ws_client: WebSocketGenerator) -> N
10061008

10071009
await ws_client.send_json_auto_id(
10081010
{
1009-
"type": "config_entries/get",
1011+
"type": "config_entries/get_single",
10101012
"entry_id": "blah",
10111013
}
10121014
)
@@ -1317,7 +1319,7 @@ async def test_get_matching_entries_ws(
13171319

13181320
ws_client = await hass_ws_client(hass)
13191321

1320-
await ws_client.send_json_auto_id({"type": "config_entries/get_matching"})
1322+
await ws_client.send_json_auto_id({"type": "config_entries/get"})
13211323
response = await ws_client.receive_json()
13221324
assert response["result"] == [
13231325
{
@@ -1394,7 +1396,7 @@ async def test_get_matching_entries_ws(
13941396

13951397
await ws_client.send_json_auto_id(
13961398
{
1397-
"type": "config_entries/get_matching",
1399+
"type": "config_entries/get",
13981400
"domain": "comp1",
13991401
"type_filter": "hub",
14001402
}
@@ -1419,7 +1421,7 @@ async def test_get_matching_entries_ws(
14191421

14201422
await ws_client.send_json_auto_id(
14211423
{
1422-
"type": "config_entries/get_matching",
1424+
"type": "config_entries/get",
14231425
"type_filter": ["service", "device"],
14241426
}
14251427
)
@@ -1457,7 +1459,7 @@ async def test_get_matching_entries_ws(
14571459

14581460
await ws_client.send_json_auto_id(
14591461
{
1460-
"type": "config_entries/get_matching",
1462+
"type": "config_entries/get",
14611463
"type_filter": "hub",
14621464
}
14631465
)
@@ -1500,7 +1502,7 @@ async def test_get_matching_entries_ws(
15001502
):
15011503
await ws_client.send_json_auto_id(
15021504
{
1503-
"type": "config_entries/get_matching",
1505+
"type": "config_entries/get",
15041506
"type_filter": "hub",
15051507
}
15061508
)
@@ -1586,7 +1588,7 @@ async def test_get_matching_entries_ws(
15861588
):
15871589
await ws_client.send_json_auto_id(
15881590
{
1589-
"type": "config_entries/get_matching",
1591+
"type": "config_entries/get",
15901592
"type_filter": ["helper"],
15911593
}
15921594
)
@@ -1602,7 +1604,7 @@ async def test_get_matching_entries_ws(
16021604
):
16031605
await ws_client.send_json_auto_id(
16041606
{
1605-
"type": "config_entries/get_matching",
1607+
"type": "config_entries/get",
16061608
"type_filter": ["device", "hub", "service"],
16071609
}
16081610
)

tests/components/shelly/test_config_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ async def test_options_flow_disabled_gen_1(
858858
await ws_client.send_json(
859859
{
860860
"id": 5,
861-
"type": "config_entries/get_matching",
861+
"type": "config_entries/get",
862862
"domain": "shelly",
863863
}
864864
)
@@ -879,7 +879,7 @@ async def test_options_flow_enabled_gen_2(
879879
await ws_client.send_json(
880880
{
881881
"id": 5,
882-
"type": "config_entries/get_matching",
882+
"type": "config_entries/get",
883883
"domain": "shelly",
884884
}
885885
)
@@ -900,7 +900,7 @@ async def test_options_flow_disabled_sleepy_gen_2(
900900
await ws_client.send_json(
901901
{
902902
"id": 5,
903-
"type": "config_entries/get_matching",
903+
"type": "config_entries/get",
904904
"domain": "shelly",
905905
}
906906
)

0 commit comments

Comments
 (0)