mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-21 16:16:31 +00:00
Bugfix message handling (#735)
This commit is contained in:
parent
bf75a8a439
commit
94fd24c251
@ -57,7 +57,7 @@ class Discovery(CoreSysAttributes, JsonConfig):
|
|||||||
"""Return list of available discovery messages."""
|
"""Return list of available discovery messages."""
|
||||||
return list(self.message_obj.values())
|
return list(self.message_obj.values())
|
||||||
|
|
||||||
def send(self, addon, service, component, platform, config):
|
def send(self, addon, service, config):
|
||||||
"""Send a discovery message to Home Assistant."""
|
"""Send a discovery message to Home Assistant."""
|
||||||
try:
|
try:
|
||||||
DISCOVERY_SERVICES[service](config)
|
DISCOVERY_SERVICES[service](config)
|
||||||
@ -67,7 +67,7 @@ class Discovery(CoreSysAttributes, JsonConfig):
|
|||||||
raise DiscoveryError() from None
|
raise DiscoveryError() from None
|
||||||
|
|
||||||
# Create message
|
# Create message
|
||||||
message = Message(addon.slug, service, component, platform, config)
|
message = Message(addon.slug, service, config)
|
||||||
|
|
||||||
# Already exists?
|
# Already exists?
|
||||||
for old_message in self.list_messages:
|
for old_message in self.list_messages:
|
||||||
@ -115,7 +115,7 @@ class Discovery(CoreSysAttributes, JsonConfig):
|
|||||||
@attr.s
|
@attr.s
|
||||||
class Message:
|
class Message:
|
||||||
"""Represent a single Discovery message."""
|
"""Represent a single Discovery message."""
|
||||||
uuid = attr.ib(factory=lambda: uuid4().hex, cmp=False)
|
uuid = attr.ib(factory=lambda: uuid4().hex, cmp=False, init=False)
|
||||||
addon = attr.ib()
|
addon = attr.ib()
|
||||||
service = attr.ib()
|
service = attr.ib()
|
||||||
config = attr.ib(cmp=False)
|
config = attr.ib(cmp=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user