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

+9
View File
@@ -6,6 +6,7 @@ Provides ABC for entities in HA.
"""
from collections import defaultdict
import re
from homeassistant.exceptions import NoEntitySpecifiedError
@@ -17,6 +18,14 @@ from homeassistant.const import (
# Dict mapping entity_id to a boolean that overwrites the hidden property
_OVERWRITE = defaultdict(dict)
# Pattern for validating entity IDs (format: <domain>.<entity>)
ENTITY_ID_PATTERN = re.compile(r"^(\w+)\.(\w+)$")
def valid_entity_id(entity_id):
"""Test if an entity ID is a valid format."""
return ENTITY_ID_PATTERN.match(entity_id) is not None
class Entity(object):
""" ABC for Home Assistant entities. """