mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Fix platform discovery not working
This commit is contained in:
parent
ae0cf49560
commit
a4e0a7f235
@ -107,7 +107,6 @@ def prepare_setup_platform(hass, config, domain, platform_name):
|
|||||||
|
|
||||||
# Not found
|
# Not found
|
||||||
if platform is None:
|
if platform is None:
|
||||||
_LOGGER.error('Unable to find platform %s', platform_path)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Already loaded or no dependencies
|
# Already loaded or no dependencies
|
||||||
|
@ -35,17 +35,21 @@ class EntityComponent(object):
|
|||||||
self.group = None
|
self.group = None
|
||||||
self.is_polling = False
|
self.is_polling = False
|
||||||
|
|
||||||
|
self.config = None
|
||||||
|
|
||||||
def setup(self, config):
|
def setup(self, config):
|
||||||
"""
|
"""
|
||||||
Sets up a full entity component:
|
Sets up a full entity component:
|
||||||
- Loads the platforms from the config
|
- Loads the platforms from the config
|
||||||
- Will listen for supported discovered platforms
|
- Will listen for supported discovered platforms
|
||||||
"""
|
"""
|
||||||
|
self.config = config
|
||||||
|
|
||||||
# Look in config for Domain, Domain 2, Domain 3 etc and load them
|
# Look in config for Domain, Domain 2, Domain 3 etc and load them
|
||||||
for p_type, p_config in \
|
for p_type, p_config in \
|
||||||
config_per_platform(config, self.domain, self.logger):
|
config_per_platform(config, self.domain, self.logger):
|
||||||
|
|
||||||
self._setup_platform(config, p_type, p_config)
|
self._setup_platform(p_type, p_config)
|
||||||
|
|
||||||
if self.discovery_platforms:
|
if self.discovery_platforms:
|
||||||
discovery.listen(self.hass, self.discovery_platforms.keys(),
|
discovery.listen(self.hass, self.discovery_platforms.keys(),
|
||||||
@ -115,11 +119,11 @@ class EntityComponent(object):
|
|||||||
self._update_entity_states,
|
self._update_entity_states,
|
||||||
second=range(0, 60, self.scan_interval))
|
second=range(0, 60, self.scan_interval))
|
||||||
|
|
||||||
def _setup_platform(self, config, platform_type, platform_config,
|
def _setup_platform(self, platform_type, platform_config,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
""" Tries to setup a platform for this component. """
|
""" Tries to setup a platform for this component. """
|
||||||
platform = prepare_setup_platform(
|
platform = prepare_setup_platform(
|
||||||
self.hass, config, self.domain, platform_type)
|
self.hass, self.config, self.domain, platform_type)
|
||||||
|
|
||||||
if platform is None:
|
if platform is None:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user