Add code-reuse to ensure unique entity ids

This commit is contained in:
Paulus Schoutsen committed 2014-03-23 12:31:24 -07:00
1 parent 84578c9894
commit 82357b421f
4 files changed
+31 -20

No files matched your search

+3 -1
View File
@@ -74,7 +74,9 @@ def setup(bus, statemachine):
except KeyError:
# New device, set it up
entity_id = ENTITY_ID_FORMAT.format(util.slugify(device.name))
entity_id = util.ensure_unique_string(
ENTITY_ID_FORMAT.format(util.slugify(device.name)),
ent_to_dev.keys())
sno_to_ent[device.serialnumber] = entity_id
ent_to_dev[entity_id] = device