From 7fba0ca2c09ef6697723869b496476bd66c3da91 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 13 Aug 2025 03:34:58 -0700 Subject: [PATCH] Add 'all' option to light/switch group config flow (#149671) --- homeassistant/components/group/config_flow.py | 18 ++++++++++++++++-- homeassistant/components/group/strings.json | 8 ++++++++ tests/components/group/test_config_flow.py | 6 ++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/group/config_flow.py b/homeassistant/components/group/config_flow.py index 152e629be2e..88f7d9017ab 100644 --- a/homeassistant/components/group/config_flow.py +++ b/homeassistant/components/group/config_flow.py @@ -146,6 +146,20 @@ async def light_switch_options_schema( ) +LIGHT_CONFIG_SCHEMA = basic_group_config_schema("light").extend( + { + vol.Required(CONF_ALL, default=False): selector.BooleanSelector(), + } +) + + +SWITCH_CONFIG_SCHEMA = basic_group_config_schema("switch").extend( + { + vol.Required(CONF_ALL, default=False): selector.BooleanSelector(), + } +) + + GROUP_TYPES = [ "binary_sensor", "button", @@ -210,7 +224,7 @@ CONFIG_FLOW = { validate_user_input=set_group_type("fan"), ), "light": SchemaFlowFormStep( - basic_group_config_schema("light"), + LIGHT_CONFIG_SCHEMA, preview="group", validate_user_input=set_group_type("light"), ), @@ -235,7 +249,7 @@ CONFIG_FLOW = { validate_user_input=set_group_type("sensor"), ), "switch": SchemaFlowFormStep( - basic_group_config_schema("switch"), + SWITCH_CONFIG_SCHEMA, preview="group", validate_user_input=set_group_type("switch"), ), diff --git a/homeassistant/components/group/strings.json b/homeassistant/components/group/strings.json index bb9ab4b25d8..8a9f4377a62 100644 --- a/homeassistant/components/group/strings.json +++ b/homeassistant/components/group/strings.json @@ -66,9 +66,13 @@ "light": { "title": "[%key:component::group::config::step::user::title%]", "data": { + "all": "[%key:component::group::config::step::binary_sensor::data::all%]", "entities": "[%key:component::group::config::step::binary_sensor::data::entities%]", "hide_members": "[%key:component::group::config::step::binary_sensor::data::hide_members%]", "name": "[%key:common::config_flow::data::name%]" + }, + "data_description": { + "all": "[%key:component::group::config::step::binary_sensor::data_description::all%]" } }, "lock": { @@ -115,9 +119,13 @@ "switch": { "title": "[%key:component::group::config::step::user::title%]", "data": { + "all": "[%key:component::group::config::step::binary_sensor::data::all%]", "entities": "[%key:component::group::config::step::binary_sensor::data::entities%]", "hide_members": "[%key:component::group::config::step::binary_sensor::data::hide_members%]", "name": "[%key:common::config_flow::data::name%]" + }, + "data_description": { + "all": "[%key:component::group::config::step::binary_sensor::data_description::all%]" } } } diff --git a/tests/components/group/test_config_flow.py b/tests/components/group/test_config_flow.py index 322e6ebdad0..b1bb6e5d7bb 100644 --- a/tests/components/group/test_config_flow.py +++ b/tests/components/group/test_config_flow.py @@ -44,7 +44,8 @@ from tests.typing import WebSocketGenerator {}, ), ("fan", "on", "on", {}, {}, {}, {}), - ("light", "on", "on", {}, {}, {}, {}), + ("light", "on", "on", {}, {}, {"all": False}, {}), + ("light", "on", "on", {}, {"all": True}, {"all": True}, {}), ("lock", "locked", "locked", {}, {}, {}, {}), ("notify", STATE_UNKNOWN, "2021-01-01T23:59:59.123+00:00", {}, {}, {}, {}), ("media_player", "on", "on", {}, {}, {}, {}), @@ -57,7 +58,8 @@ from tests.typing import WebSocketGenerator {"type": "sum"}, {}, ), - ("switch", "on", "on", {}, {}, {}, {}), + ("switch", "on", "on", {}, {}, {"all": False}, {}), + ("switch", "on", "on", {}, {"all": True}, {"all": True}, {}), ], ) async def test_config_flow(