1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 02:18:59 +00:00

Allow update discovery messages (#1136)

* Allow update discovery messages

* Update __init__.py

* Update __init__.py

* Update __init__.py

* fix lint

* Fix style
This commit is contained in:
Pascal Vizeli
2019-06-24 23:29:42 +02:00
committed by GitHub
parent b8b73cf880
commit ce18183daa

View File

@@ -85,11 +85,16 @@ class Discovery(CoreSysAttributes, JsonConfig):
message = Message(addon.slug, service, config)
# Already exists?
for old_message in self.list_messages:
if old_message != message:
for exists_msg in self.list_messages:
if exists_msg != message:
continue
_LOGGER.info("Duplicate discovery message from %s", addon.slug)
return old_message
if exists_msg.config != config:
message = exists_msg
message.config = config
else:
_LOGGER.debug("Duplicate discovery message from %s", addon.slug)
return exists_msg
break
_LOGGER.info("Send discovery to Home Assistant %s from %s", service, addon.slug)
self.message_obj[message.uuid] = message