Allow platforms to specify PLATFORM_SCHEMA
This commit is contained in:
1 parent
4fba89b789
commit
f6d584af09
5 files changed
+86
-21
No files matched your search
@@ -79,24 +79,22 @@ class EntityComponent(object):
|
||||
platform = prepare_setup_platform(
|
||||
self.hass, self.config, self.domain, platform_type)
|
||||
|
||||
if platform is None:
|
||||
return
|
||||
# Config > Platform > Component
|
||||
scan_interval = platform_config.get(
|
||||
CONF_SCAN_INTERVAL,
|
||||
getattr(platform, 'SCAN_INTERVAL', self.scan_interval))
|
||||
|
||||
try:
|
||||
# Config > Platform > Component
|
||||
scan_interval = platform_config.get(
|
||||
CONF_SCAN_INTERVAL,
|
||||
getattr(platform, 'SCAN_INTERVAL', self.scan_interval))
|
||||
platform.setup_platform(
|
||||
self.hass, platform_config,
|
||||
EntityPlatform(self, scan_interval).add_entities,
|
||||
discovery_info)
|
||||
platform_name = '{}.{}'.format(self.domain, platform_type)
|
||||
self.hass.config.components.append(platform_name)
|
||||
|
||||
self.hass.config.components.append(
|
||||
'{}.{}'.format(self.domain, platform_type))
|
||||
except Exception: # pylint: disable=broad-except
|
||||
self.logger.exception(
|
||||
'Error while setting up platform %s', platform_type)
|
||||
return
|
||||
|
||||
def add_entity(self, entity):
|
||||
"""Add entity to component."""
|
||||
|
||||
Reference in new issue
Block a user