async def async_setup(self, platform_config, discovery_info=None):
    'Set up the platform from a config file.'
    platform = self.platform
    hass = self.hass

    @callback
    def async_create_setup_task():
        'Get task to set up platform.'
        if getattr(platform, 'async_setup_platform', None):
            return platform.async_setup_platform(hass, platform_config, self._async_schedule_add_entities, discovery_info)
        return hass.loop.run_in_executor(None, platform.setup_platform, hass, platform_config, self._schedule_add_entities, discovery_info)
    (await self._async_setup_platform(async_create_setup_task))
Set up the platform from a config file.
async def async_setup(self, platform_config, discovery_info=None):
    
    platform = self.platform
    hass = self.hass

    @callback
    def async_create_setup_task():
        'Get task to set up platform.'
        if getattr(platform, 'async_setup_platform', None):
            return platform.async_setup_platform(hass, platform_config, self._async_schedule_add_entities, discovery_info)
        return hass.loop.run_in_executor(None, platform.setup_platform, hass, platform_config, self._schedule_add_entities, discovery_info)
    (await self._async_setup_platform(async_create_setup_task))