Load YAML config into an ordered dict

This commit is contained in:
Paulus Schoutsen committed 2016-01-23 22:41:01 -08:00
1 parent e5497d89f4
commit de08f0afaa
6 files changed
+71 -44

No files matched your search

+2 -5
View File
@@ -11,7 +11,6 @@ import logging
import signal
import threading
import enum
import re
import functools as ft
from collections import namedtuple
@@ -26,6 +25,7 @@ from homeassistant.exceptions import (
import homeassistant.util as util
import homeassistant.util.dt as dt_util
import homeassistant.util.location as location
from homeassistant.helpers.entity import valid_entity_id
import homeassistant.helpers.temperature as temp_helper
from homeassistant.config import get_default_config_dir
@@ -42,9 +42,6 @@ SERVICE_CALL_LIMIT = 10 # seconds
# will be added for each component that polls devices.
MIN_WORKER_THREAD = 2
# Pattern for validating entity IDs (format: <domain>.<entity>)
ENTITY_ID_PATTERN = re.compile(r"^(?P<domain>\w+)\.(?P<entity>\w+)$")
_LOGGER = logging.getLogger(__name__)
# Temporary to support deprecated methods
@@ -339,7 +336,7 @@ class State(object):
def __init__(self, entity_id, state, attributes=None, last_changed=None,
last_updated=None):
"""Initialize a new state."""
if not ENTITY_ID_PATTERN.match(entity_id):
if not valid_entity_id(entity_id):
raise InvalidEntityFormatError((
"Invalid entity id encountered: {}. "
"Format should be <domain>.<object_id>").format(entity_id))