mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Generate ID when not provided (#39082)
This commit is contained in:
parent
af6ca7a4d3
commit
3182dac1eb
@ -1,6 +1,7 @@
|
|||||||
"""The Tag integration."""
|
"""The Tag integration."""
|
||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
|
import uuid
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -65,6 +66,8 @@ class TagStorageCollection(collection.StorageCollection):
|
|||||||
async def _process_create_data(self, data: typing.Dict) -> typing.Dict:
|
async def _process_create_data(self, data: typing.Dict) -> typing.Dict:
|
||||||
"""Validate the config is valid."""
|
"""Validate the config is valid."""
|
||||||
data = self.CREATE_SCHEMA(data)
|
data = self.CREATE_SCHEMA(data)
|
||||||
|
if not data[TAG_ID]:
|
||||||
|
data[TAG_ID] = str(uuid.uuid4())
|
||||||
# make last_scanned JSON serializeable
|
# make last_scanned JSON serializeable
|
||||||
if LAST_SCANNED in data:
|
if LAST_SCANNED in data:
|
||||||
data[LAST_SCANNED] = str(data[LAST_SCANNED])
|
data[LAST_SCANNED] = str(data[LAST_SCANNED])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user