Skip to content

Commit

Permalink
Generate ID when not provided (#39082)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Aug 20, 2020
1 parent af6ca7a commit 3182dac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/tag/__init__.py
@@ -1,6 +1,7 @@
"""The Tag integration."""
import logging
import typing
import uuid

import voluptuous as vol

Expand Down Expand Up @@ -65,6 +66,8 @@ class TagStorageCollection(collection.StorageCollection):
async def _process_create_data(self, data: typing.Dict) -> typing.Dict:
"""Validate the config is valid."""
data = self.CREATE_SCHEMA(data)
if not data[TAG_ID]:
data[TAG_ID] = str(uuid.uuid4())
# make last_scanned JSON serializeable
if LAST_SCANNED in data:
data[LAST_SCANNED] = str(data[LAST_SCANNED])
Expand Down

0 comments on commit 3182dac

Please sign in to comment.