1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Standardize uuid generation for events/storage/registry (#39184)

This commit is contained in:
J. Nick Koston
2020-08-24 10:21:30 -05:00
committed by GitHub
parent 28332f23b3
commit bee6d87e7a
6 changed files with 34 additions and 15 deletions

View File

@@ -4,7 +4,6 @@ import functools
import logging
from types import MappingProxyType
from typing import Any, Callable, Dict, List, Optional, Set, Union, cast
import uuid
import weakref
import attr
@@ -16,6 +15,7 @@ from homeassistant.helpers import entity_registry
from homeassistant.helpers.event import Event
from homeassistant.setup import async_process_deps_reqs, async_setup_component
from homeassistant.util.decorator import Registry
import homeassistant.util.uuid as uuid_util
_LOGGER = logging.getLogger(__name__)
_UNDEF: dict = {}
@@ -135,7 +135,7 @@ class ConfigEntry:
) -> None:
"""Initialize a config entry."""
# Unique id of the config entry
self.entry_id = entry_id or uuid.uuid4().hex
self.entry_id = entry_id or uuid_util.uuid_v1mc_hex()
# Version of the configuration.
self.version = version