mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Maintain group ordering across validation.
This commit is contained in:
parent
deffbeb922
commit
e5eb3b13c4
@ -5,6 +5,7 @@ For more details about this component, please refer to the documentation at
|
|||||||
https://home-assistant.io/components/group/
|
https://home-assistant.io/components/group/
|
||||||
"""
|
"""
|
||||||
import threading
|
import threading
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ _SINGLE_GROUP_CONFIG = vol.Schema(vol.All(_conf_preprocess, {
|
|||||||
|
|
||||||
def _group_dict(value):
|
def _group_dict(value):
|
||||||
"""Validate a dictionary of group definitions."""
|
"""Validate a dictionary of group definitions."""
|
||||||
config = {}
|
config = OrderedDict()
|
||||||
for key, group in value.items():
|
for key, group in value.items():
|
||||||
try:
|
try:
|
||||||
config[key] = _SINGLE_GROUP_CONFIG(group)
|
config[key] = _SINGLE_GROUP_CONFIG(group)
|
||||||
@ -59,7 +60,7 @@ def _group_dict(value):
|
|||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.All(dict, _group_dict)
|
DOMAIN: vol.All(dict, _group_dict)
|
||||||
}, extra=True)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
# List of ON/OFF state tuples for groupable states
|
# List of ON/OFF state tuples for groupable states
|
||||||
_GROUP_TYPES = [(STATE_ON, STATE_OFF), (STATE_HOME, STATE_NOT_HOME),
|
_GROUP_TYPES = [(STATE_ON, STATE_OFF), (STATE_HOME, STATE_NOT_HOME),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user