From fbe940139ab5c07aa46f4f976e6534786f84d1b0 Mon Sep 17 00:00:00 2001 From: Johann Kellerman Date: Thu, 12 May 2016 06:58:22 +0200 Subject: [PATCH] Discovery listener on all EntityComponents (#2042) --- homeassistant/helpers/entity_component.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index 2b94369bc69..2a99b57da55 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -63,15 +63,14 @@ class EntityComponent(object): self._setup_platform(self.discovery_platforms[service], {}, info)) - # Generic discovery listener for loading platform dynamically - # Refer to: homeassistant.components.discovery.load_platform() - def load_platform_callback(service, info): - """Callback to load a platform.""" - platform = info.pop(discovery.LOAD_PLATFORM) - self._setup_platform(platform, {}, info if info else None) - discovery.listen( - self.hass, discovery.LOAD_PLATFORM + '.' + self.domain, - load_platform_callback) + # Generic discovery listener for loading platform dynamically + # Refer to: homeassistant.components.discovery.load_platform() + def load_platform_callback(service, info): + """Callback to load a platform.""" + platform = info.pop(discovery.LOAD_PLATFORM) + self._setup_platform(platform, {}, info if info else None) + discovery.listen(self.hass, discovery.LOAD_PLATFORM + '.' + + self.domain, load_platform_callback) def extract_from_service(self, service): """Extract all known entities from a service call.