Discovery listener on all EntityComponents (#2042)

This commit is contained in:
Johann Kellerman 2016-05-12 06:58:22 +02:00 committed by Paulus Schoutsen
parent c341ae0a39
commit fbe940139a

View File

@ -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.