mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Discovery listener on all EntityComponents (#2042)
This commit is contained in:
parent
c341ae0a39
commit
fbe940139a
@ -63,15 +63,14 @@ class EntityComponent(object):
|
|||||||
self._setup_platform(self.discovery_platforms[service], {},
|
self._setup_platform(self.discovery_platforms[service], {},
|
||||||
info))
|
info))
|
||||||
|
|
||||||
# Generic discovery listener for loading platform dynamically
|
# Generic discovery listener for loading platform dynamically
|
||||||
# Refer to: homeassistant.components.discovery.load_platform()
|
# Refer to: homeassistant.components.discovery.load_platform()
|
||||||
def load_platform_callback(service, info):
|
def load_platform_callback(service, info):
|
||||||
"""Callback to load a platform."""
|
"""Callback to load a platform."""
|
||||||
platform = info.pop(discovery.LOAD_PLATFORM)
|
platform = info.pop(discovery.LOAD_PLATFORM)
|
||||||
self._setup_platform(platform, {}, info if info else None)
|
self._setup_platform(platform, {}, info if info else None)
|
||||||
discovery.listen(
|
discovery.listen(self.hass, discovery.LOAD_PLATFORM + '.' +
|
||||||
self.hass, discovery.LOAD_PLATFORM + '.' + self.domain,
|
self.domain, load_platform_callback)
|
||||||
load_platform_callback)
|
|
||||||
|
|
||||||
def extract_from_service(self, service):
|
def extract_from_service(self, service):
|
||||||
"""Extract all known entities from a service call.
|
"""Extract all known entities from a service call.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user