Skip to content

Commit 380c737

Browse files
authored
Add reorder option to entity selector (home-assistant#149002)
1 parent 33cc257 commit 380c737

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

homeassistant/helpers/selector.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ class EntitySelectorConfig(BaseSelectorConfig, EntityFilterSelectorConfig, total
813813
exclude_entities: list[str]
814814
include_entities: list[str]
815815
multiple: bool
816+
reorder: bool
816817
filter: EntityFilterSelectorConfig | list[EntityFilterSelectorConfig]
817818

818819

@@ -829,6 +830,7 @@ class EntitySelector(Selector[EntitySelectorConfig]):
829830
vol.Optional("exclude_entities"): [str],
830831
vol.Optional("include_entities"): [str],
831832
vol.Optional("multiple", default=False): cv.boolean,
833+
vol.Optional("reorder", default=False): cv.boolean,
832834
vol.Optional("filter"): vol.All(
833835
cv.ensure_list,
834836
[ENTITY_FILTER_SELECTOR_CONFIG_SCHEMA],

tests/components/blueprint/snapshots/test_importer.ambr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
'light',
204204
]),
205205
'multiple': False,
206+
'reorder': False,
206207
}),
207208
}),
208209
}),
@@ -217,6 +218,7 @@
217218
'binary_sensor',
218219
]),
219220
'multiple': False,
221+
'reorder': False,
220222
}),
221223
}),
222224
}),

tests/helpers/test_selector.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ def test_device_selector_schema_error(schema) -> None:
231231
["sensor.abc123", "sensor.ghi789"],
232232
),
233233
),
234+
(
235+
{"multiple": True, "reorder": True},
236+
((["sensor.abc123", "sensor.def456"],)),
237+
(None, "abc123", ["sensor.abc123", None]),
238+
),
234239
(
235240
{"filter": {"domain": "light"}},
236241
("light.abc123", FAKE_UUID),

tests/helpers/test_service.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ def load_yaml(fname, secrets=None):
10911091
}
10921092
],
10931093
"multiple": False,
1094+
"reorder": False,
10941095
},
10951096
},
10961097
},
@@ -1113,6 +1114,7 @@ def load_yaml(fname, secrets=None):
11131114
}
11141115
],
11151116
"multiple": False,
1117+
"reorder": False,
11161118
},
11171119
},
11181120
},

0 commit comments

Comments
 (0)