mirror of
https://github.com/home-assistant/core.git
synced 2025-09-05 21:01:37 +02:00
Add 'all' option to light/switch group config flow (#149671)
This commit is contained in:
@@ -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"),
|
||||
),
|
||||
|
@@ -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%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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(
|
||||
|
Reference in New Issue
Block a user