

def _setup_platform(self, platform_type, platform_config, discovery_info=None):
    'Setup a platform for this component.'
    platform = prepare_setup_platform(self.hass, self.config, self.domain, platform_type)
    if (platform is None):
        return
    scan_interval = platform_config.get(CONF_SCAN_INTERVAL, getattr(platform, 'SCAN_INTERVAL', self.scan_interval))
    entity_namespace = platform_config.get(CONF_ENTITY_NAMESPACE)
    try:
        platform.setup_platform(self.hass, platform_config, EntityPlatform(self, scan_interval, entity_namespace).add_entities, discovery_info)
        self.hass.config.components.append('{}.{}'.format(self.domain, platform_type))
    except Exception:
        self.logger.exception('Error while setting up platform %s', platform_type)

dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/helpers/entity_component.py EntityComponent._setup_platform/original