From 3d7de949d7f867ae6719bf27faa1399c036b3023 Mon Sep 17 00:00:00 2001 From: farmio Date: Tue, 20 Feb 2024 22:02:34 +0100 Subject: [PATCH] use ulid instead of uuid --- homeassistant/components/knx/storage/config_store.py | 4 ++-- homeassistant/components/knx/websocket.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/knx/storage/config_store.py b/homeassistant/components/knx/storage/config_store.py index 4367b75884f53..a6ced30cc7558 100644 --- a/homeassistant/components/knx/storage/config_store.py +++ b/homeassistant/components/knx/storage/config_store.py @@ -8,7 +8,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import entity_registry as er from homeassistant.helpers.storage import Store -from homeassistant.util.uuid import random_uuid_hex +from homeassistant.util.ulid import ulid_now from ..const import DOMAIN from .entity_store_schema import SCHEMA_OPTIONS @@ -67,7 +67,7 @@ async def create_entitiy( """Create a new entity.""" if platform not in self.async_add_entity: raise ConfigStoreException(f"Entity platform not ready: {platform}") - unique_id = f"knx_es_{random_uuid_hex()}" + unique_id = f"knx_es_{ulid_now()}" if unique_id in self.data["entities"].setdefault(platform, {}): raise ConfigStoreException("Unique id already used.") self.async_add_entity[platform](unique_id, data) diff --git a/homeassistant/components/knx/websocket.py b/homeassistant/components/knx/websocket.py index 6e5cda1f4ded3..6858508945bc5 100644 --- a/homeassistant/components/knx/websocket.py +++ b/homeassistant/components/knx/websocket.py @@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import device_registry as dr from homeassistant.helpers.typing import UNDEFINED -from homeassistant.util.uuid import random_uuid_hex +from homeassistant.util.ulid import ulid_now from .const import DOMAIN from .storage.config_store import ConfigStoreException @@ -413,7 +413,7 @@ def ws_create_device( ) -> None: """Create a new KNX device.""" knx: KNXModule = hass.data[DOMAIN] - identifier = f"knx_vdev_{random_uuid_hex()}" + identifier = f"knx_vdev_{ulid_now()}" device_registry = dr.async_get(hass) _device = device_registry.async_get_or_create( config_entry_id=knx.entry.entry_id,